Utility functions

Utility functions for computing combinations of dimensions and hierarchy levels

class cubes.common.IgnoringDictionary(*args, **kwds)

Initialize an ordered dictionary. The signature is the same as regular dictionaries, but keyword arguments are not recommended because their insertion order is arbitrary.

set(key, value)

Sets value for key even if value is null.

class cubes.common.MissingPackage(package, feature=None, source=None, comment=None)

Bogus class to handle missing optional packages - packages that are not necessarily required for Cubes, but are needed for certain features.

cubes.common.localize_common(obj, trans)

Localize common attributes: label and description

cubes.common.localize_attributes(attribs, translations)

Localize list of attributes. translations should be a dictionary with keys as attribute names, values are dictionaries with localizable attribute metadata, such as label or description.

cubes.common.get_localizable_attributes(obj)

Returns a dictionary with localizable attributes of obj.

cubes.common.assert_instance(obj, class_, label)

Raises ArgumentError when obj is not instance of cls

cubes.common.assert_all_instances(list_, class_, label='object')

Raises ArgumentError when objects in list_ are not instances of cls

cubes.common.read_json_file(path, kind=None)

Read a JSON from path. This is convenience function that provides more descriptive exception handling.

cubes.common.sorted_dependencies(graph)

Return keys from deps ordered by dependency (topological sort). deps is a dictionary where keys are strings and values are list of strings where keys is assumed to be dependant on values.

Example:

A ---> B -+--> C
          |
          +--> D --> E

Will be: {"A": ["B"], "B": ["C", "D"], "D": ["E"],"E": []}

Previous topic

Authentication and Authorization

Next topic

Cubes Release Notes

This Page