useful_inkleby.decorators package¶
Submodules¶
useful_inkleby.decorators.base module¶
Created on Jul 25, 2016
@author: Alex
-
class
useful_inkleby.decorators.base.
GenericDecorator
(*args, **kwargs)[source]¶ Bases:
object
tidies up shell game of decorators. arguments passed to the decorator at creation end up as self.args and self.kwargs. kwargs are also added to self. if args_map is populated - will also add those to self
args_map = (“foo”,)
populates self.foo with args[0]
if there is no args_map can be used bare (without initalisation)
default_kwargs sets the default value of any kwargs that might be passed in (also added to self)
override self.gateway if it’s a choice between using this function and a different one
overide self.arg_decorator to adjust arguments being passed in
expects self, function, then delivers any args and kwargs passed to the function
-
classmethod
allow_bare
()[source]¶ can this decorator be used without initialisation?
- only if no args_map - or all values in args_map are
- already provided by default_kwargs
-
arg_decorator
(function, *args, **kwargs)[source]¶ ” accesses properties passed to decorated object through arguments
-
args_map
= []¶
-
default_kwargs
= {}¶
-
classmethod