fancytools.pystructure package¶
Subpackages¶
- fancytools.pystructure.headerSetter package
- Subpackages
- fancytools.pystructure.headerSetter.tests package
- Subpackages
- Submodules
- fancytools.pystructure.headerSetter.tests.addOrModifyHeader module
- fancytools.pystructure.headerSetter.tests.removeHeader module
- fancytools.pystructure.headerSetter.tests package
- Submodules
- fancytools.pystructure.headerSetter.headerSetter module
- Subpackages
Submodules¶
fancytools.pystructure.FallBack module¶
-
class
fancytools.pystructure.FallBack.FallBack(ownModuleName, fallbackModule, print_warning=True)[source]¶ Bases:
objecta class allowing to automatically using another module as fall back if the given module doesn’t have a needed attribute
to create the fall back compatibility just ad the following line to your module:
>>> FallBack(__name__, MyFallBackModule, print_warning=True)
fancytools.pystructure.GetCallablesInPackage module¶
-
class
fancytools.pystructure.GetCallablesInPackage.GetCallablesInPackage(package, modules_in_structure=False, include_classes=True, include_functions=False, min_level=0, max_level=None, exclude_empty_pck=True)[source]¶ Bases:
fancytools.fcollections.NestedOrderedDict.NestedOrderedDictReturn a NestedOrderedDict of all functions and classes within a given package. excluding ‘private’ modules beginning with ‘_’
Arguments Description package package or string of path to package to get all callables from Optional Default Description modules_in_structure False include the modules of the callables in the output include_classes True include classes in the output include_functions True include functions in the output min_level 0 minimum depth level in the package structure max_level None maximum depth level in the package structure exclude_empty_pck True exclude sub-packages without any callables from the output
fancytools.pystructure.getMembers module¶
Different functions to return members within a given module or package.
-
fancytools.pystructure.getMembers.getAvClassNamesInModule(prooveModule)[source]¶ get the class names within a module
-
fancytools.pystructure.getMembers.getAvClassNamesInPackage(package)[source]¶ get the class names within a package
-
fancytools.pystructure.getMembers.getAvailableClassesInModule(prooveModule)[source]¶ return a list of all classes in the given module that dont begin with ‘_’
-
fancytools.pystructure.getMembers.getAvailableClassesInPackage(package)[source]¶ return a list of all classes in the given package whose modules dont begin with ‘_’
fancytools.pystructure.runAllInDir module¶
fancytools.pystructure.stitchModules module¶
-
fancytools.pystructure.stitchModules.stitchModules(module, fallbackModule)[source]¶ complete missing attributes with those in fallbackModule
imagine you have 2 modules: a and b a is some kind of an individualised module of b - but will maybe not contain all attributes of b. in this case a should use the attributes from b
>>> import types >>> a = types.ModuleType('a', 'The a.py module') # you will have of course a file for those >>> b = types.ModuleType('b', 'The b.py module')
>>> b.var1 = 'standard 1' >>> b.var2 = 'standard 2'
>>> a.var1 = 'individual 1'
what we now want is to all all missing attributes from b to a:
>>> stitchModules(a,b)
>>> print a.var1 individual 1 >>> print a.var2 standard 2