TGMtools API docs¶
Submodules¶
tgmtools.core |
Provides basic core functions to be used other Python projects. |
tgmtools.obsfuscate |
Provides basic file related functions to be used in other Python projects. |
core¶
Provides basic core functions to be used other Python projects.
-
exception
tgmtools.core.TGMException¶ Exception class used in the
tgmtoolsproject.
-
tgmtools.core.convert_nested_defaultdict_to_dict(dd)¶ Converts a nested
collections.defaultdictobject to a nested pure Python dictionary structure.Parameters: dd ( collections.defaultdictobject that is nested to any degree.) –Returns: nested_dict Return type: dictthat is equivalent to the original object.
-
tgmtools.core.make_nested_defaultdict(inner_type, N=1)¶ Creates an empty nested
collections.defaultdictobject.Parameters: - inner_type (type of object at the innermost level of the nested
collections.defaultdict.) – - N (
intof the number of nested levels (maximum five).) –
Returns: empty_nested_defaultdict
Return type: Nested
collections.defaultdictobjects that are empty.- inner_type (type of object at the innermost level of the nested
-
tgmtools.core.pf(item)¶ Convenience function that returns the output of
pprint.pformat.
-
tgmtools.core.pairwise(iterable)¶ s -> (s0,s1), (s1,s2), (s2, s3), ...
obsfuscate¶
Provides basic file related functions to be used in other Python projects.
-
tgmtools.obsfuscate.create_encoded_path(filename, hash_key=None, datetime_object=None)¶ Creates an encoded path to store files in from a hash_key and a
datetimeobject.Intended purpose is to prevent subdirectory count limits while providing obfuscation.
Parameters: Returns: encoded_path
Return type: strof encoded path that can be decoded usingdecode_path().
-
tgmtools.obsfuscate.decode_path(encoded_path, hash_key=None)¶ Decodes a path encoded by
create_encoded_path()using the same hash_key.Parameters: Returns: