utils Package

utils Package

A collections of utils for fastr (command line tools or non-core functionality)

compare Module

Module to compare various fastr specific things such as a execution directory or a reference directory.

fastr.utils.compare.compare_execution_dir(path1, path2)[source]
fastr.utils.compare.compare_job_dirs(sample, node, node_dir1, node_dir2)[source]
fastr.utils.compare.compare_job_output_data(output, job1, job2)[source]
fastr.utils.compare.compare_set(set1, set2, path, sub_compare_func, f_args=None, f_kwargs=None)[source]

Compare two sets and dispatch each item to a sub comparison function

Parameters
  • set1 (Iterable) – first set of items

  • set2 (Iterable) – second set of items

  • path (str) – identifier of the data location

  • sub_compare_func – function to apply to items

  • f_args – args to pass to sub_compare_func

  • f_kwargs – kwargs to pass to sub_compare_func

Returns

generator that iterates over the differences

Return type

generator

fastr.utils.compare.compare_value_dict_item(key, data1, data2, path)[source]
fastr.utils.compare.compare_value_list(data1, data2, path, key=None)[source]

dicteq Module

Some helper function to compare dictionaries and find the parts of the dict that are different. This is mostly to help in debugging.

fastr.utils.dicteq.dicteq(self, other)[source]

Compare two dicts for equality

Parameters
  • self – the first object to compare

  • other – the oth

Returns

fastr.utils.dicteq.diffdict(self, other, path=None, visited=None)[source]

Find the differences in two dictionaries.

Parameters
  • self – the first object to compare

  • other (dict) – other dictionary

  • path (list) – the path for nested dicts (too keep track of recursion)

Returns

list of messages indicating the differences

Return type

list

fastr.utils.dicteq.diffobj(self, other, path=None, visited=None)[source]

Compare two objects by comparing their __dict__ entries

Parameters
  • self – the first object to compare

  • other – other objects to compare

  • path (list) – the path for nested dicts (too keep track of recursion)

Returns

list of messages

Return type

list

fastr.utils.dicteq.diffobj_str(self, other)[source]

Compare two objects by comparing their __dict__ entries, but returns the differences in a single string ready for logging.

Parameters
  • self – the first object to compare

  • other – other object to compare to

Returns

the description of the differences

Return type

str

gettools Module

fastr.utils.gettools.main()[source]

multiprocesswrapper Module

fastr.utils.multiprocesswrapper.function_wrapper(filepath, fnc_name, *args, **kwargs)[source]

verify Module

fastr.utils.verify.verify_resource_loading(filename, log=<Logger fastr (INFO)>)[source]

Verify that a resource file can be loaded. Returns loaded object.

Parameters
  • filename (str) – path of the object to load

  • log – the logger to use to send messages to

Returns

loaded resource

fastr.utils.verify.verify_tool(filename, log=<Logger fastr (INFO)>, perform_tests=True)[source]

Verify that a file