Entities¶
Base classes to derive decorators which keeps data about wrapped function and associated metadata per each invocation.
Special marks for module executables
-
class
fairways.decorators.entities.
Mark
(**options)[source]¶ Base class for decorators. These decorators are registered in a registry and can be invoked via convinient “mark_name” later. Each class of decorator “knows” about all functions decorated with it. It is possible to iterate over these functions, filter them by decorator mark, origin module. New decorators can be defined outside this module by new derived class and by special decorator @register_decorator
-
classmethod
chain
()[source]¶ Return items as a FuncFlow chain suitable for “chained” processing (filtering, mapping, etc…).
Returns: Same as for .items() but wrapped in funcflow.Chain. Return type: funcflow.Chain
-
decorator_kwargs
= []¶ Keyword arguments of decorator
-
decorator_required_kwargs
= []¶ Required keyword arguments of decorator
-
classmethod
find_module_entity
(module_name)[source]¶ Find record by module where decorator used.
Parameters: module_name (str) – Name of a module. Raises: TypeError – Do not use this method for base class Mark. Returns: Registry record. Note that the returned type depends on “registry_item_class”. Return type: RegistryItem
-
classmethod
items
()[source]¶ List of records per each decorated function. Each record has type which defined in class attribute “registry_item_class” Note that invocation of Mark.items() returns records for all subclasses of Mark while invocation of same method for subclass returns records for this class only.
Returns: Records list Return type: list
-
mark_name
= 'mark'¶ Alias to call decorator
-
once_per_module
= True¶ Should be used no more than once per module
-
registry_item_class
¶ Data model to keep info about wrapped function with user-defined metadata
alias of
RegistryItem
-
classmethod