simple_capture package¶
Submodules¶
simple_capture.utils module¶
Contains miscellaneous utilities.
-
class
simple_capture.utils.RegistryEnabledObject(**kwargs)¶ Bases:
objectBase class for registry classes.
-
abstract classmethod
help()¶ Get a help message, used in the
simple_capture.config.commands.Showcommand.- Returns
Help message.
- Return type
str
-
abstract classmethod
retrieve_registry()¶ Get the registry of this class.
- Returns
Registry of subclasses
- Return type
dict(str, type)
-
abstract classmethod
-
simple_capture.utils.class_attribute_register(registry_enabled_object, name_attribute)¶ Decorator factory. Used to add a class to a registry. >>> class Ham(RegistryEnabledObject): … _reg = {} … @classmethod … def retrieve_registry(cls): … return _reg … >>> @class_attribute_register(Ham, ‘name’): … class Eggs: … name = spam … >>> Ham.retrieve_registry()[‘spam’] <class ‘__main__.Eggs’>
Unlike
simple_capture.utils.register(), this retrieves the name through a class attribute. This is useful when adding a base class to its own registry, seesimple_capture.source.filters.Filter.- Parameters
registry_enabled_object (type) – Class containing target registry.
name_attribute (str) – Name of class attribute specifying name in registry.
- Returns
Decorator to register class.
- Return type
callable
-
simple_capture.utils.init_log(level=20, log_file=None)¶ Ensure the log is at the requested level.
- Parameters
level (int) – Log level.
log_file (bool) – Log to a file instead of stdout.
-
simple_capture.utils.register(registry_enabled_object, name)¶ Decorator factory. Used to add a class to a registry. >>> class Ham(RegistryEnabledObject): … _reg = {} … @classmethod … def retrieve_registry(cls): … return _reg … >>> @register(Ham, ‘spam’) … class Eggs: … pass … >>> Ham.retrieve_registry()[‘spam’] <class ‘__main__.Eggs’>
- Parameters
registry_enabled_object (type) – Class containing target registry.
name (str) – Name of member in registry.
- Returns
Decorator to register class.
- Return type
callable
Module contents¶
Defines interfaces with configuration files.