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_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
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.
- fastr.utils.dicteq.diffobj(self, other, path=None, visited=None)[source]¶
Compare two objects by comparing their __dict__ entries
- 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
gettools
Module¶
multiprocesswrapper
Module¶
verify
Module¶
- fastr.utils.verify.create_tool_test(filename, log=<Logger fastr (INFO)>)[source]¶
Create test for fastr verify tool.
By running fastr verify -c tool FILENAME the input data in the folders under ‘tests’ in the tool definition is processed by the tool. The output data is written to a folder in each test folder. In each test folder a gzipped pickle is created which is used to verify the working of the tool at a later time.
- Parameters
filename – filename of the tool definition
log – the logger to use to send messages to
- 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 loadlog – 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 tool correctly works. Returns Tool.
- Parameters
filename – filename of the tool definition
log – the logger to use to send messages to
perform_test – Boolean to
- Returns
Tool object
Subpackages¶
- cmd Package
cmd
Packagecat
Moduledump
Moduleexecute
Moduleextract_argparse
Moduleprovenance
Modulepylint
Modulereport
Modulerun
Modulesink
Modulesource
Moduletest
Moduletrace
Moduleupgrade
Moduleverify
Module
- secrets Package