cobamp.utilities package

Submodules

cobamp.utilities.file_utils module

cobamp.utilities.file_utils.open_file(path, mode)[source]
cobamp.utilities.file_utils.pickle_object(obj, path)[source]

Stores an object as a file. Parameters ———- obj: The object instance path: Full path as a str where the file will be stored.

cobamp.utilities.file_utils.read_pickle(path)[source]

Reads a file containing a pickled object and returns it Parameters ———- path: Full path as a str where the file is stored.

cobamp.utilities.postfix_expressions module

class cobamp.utilities.postfix_expressions.Queue[source]

Bases: list

push(x)[source]
top()[source]
class cobamp.utilities.postfix_expressions.Stack[source]

Bases: list

push(x)[source]
top()[source]
cobamp.utilities.postfix_expressions.boolean_precedence(token)[source]
cobamp.utilities.postfix_expressions.eval_boolean_operator(operator, o1, o2)[source]
cobamp.utilities.postfix_expressions.eval_math_operator(operator, o1, o2)[source]
cobamp.utilities.postfix_expressions.evaluate_postfix_expression(op, eval_fx, type_conv=<class 'int'>)[source]
cobamp.utilities.postfix_expressions.is_boolean_operator(token)[source]
cobamp.utilities.postfix_expressions.is_boolean_value(token)[source]
cobamp.utilities.postfix_expressions.is_number_token(token)[source]
cobamp.utilities.postfix_expressions.is_operator_token(token)[source]
cobamp.utilities.postfix_expressions.is_string_token(token)[source]
cobamp.utilities.postfix_expressions.left_operator_association(op)[source]
cobamp.utilities.postfix_expressions.op_prec(op)[source]
cobamp.utilities.postfix_expressions.parse_infix_expression(op, is_operand_fx, is_operator_fx, precedence_fx)[source]
cobamp.utilities.postfix_expressions.tokenize_boolean_expression(inf_exp_str)[source]
cobamp.utilities.postfix_expressions.tokenize_infix_expression(inf_exp_str)[source]

cobamp.utilities.property_management module

class cobamp.utilities.property_management.PropertyDictionary(mandatory_properties={}, optional_properties={})[source]

Bases: object

Implements a dict with additional control on which objects can be added to which keys and whether these are optional or mandatory.

add_if_not_none(key, value)[source]
add_new_properties(mandatory_properties, optional_properties)[source]

Adds new properties to the dictionary and/or updates existing ones, if present. Parameters ———- mandatory_properties: A dict[str, function] optional_properties: A dict[str, function] ——-

get_mandatory_properties()[source]
get_optional_properties()[source]
has_required_properties()[source]

cobamp.utilities.set_utils module

cobamp.utilities.set_utils.has_no_overlap(set1, set2)[source]

set1: A set of frozenset instance. set2: A set of frozenset instance.

cobamp.utilities.set_utils.is_identical(set1, set2)[source]

set1: A set of frozenset instance. set2: A set of frozenset instance.

cobamp.utilities.set_utils.is_subset(which, of_what)[source]

which: A set or frozenset instance to be checked as a possible subset of of_what of_what: A set or frozenset instance

cobamp.utilities.test_utils module

cobamp.utilities.test_utils.timeit(method)[source]

Timer decorator for methods. Courtesy of Fahim Sakri from PythonHive Args:

method:

Returns:

Module contents