Package wtf :: Module util :: Class BaseDecorator
[hide private]
[frames] | no frames]

Class BaseDecorator

source code

object --+
         |
        BaseDecorator
Known Subclasses:

Base decorator class

Implement the __call__ method in order to add some action.

Instance Methods [hide private]
 
__init__(self, func)
Initialization
source code
callable
__get__(self, inst, owner)
Generic attribute getter (descriptor protocol)
source code
any
__getattr__(self, name)
Pass attribute requests to the function
source code
any
__call__(self, *args, **kwargs)
Actual decorating entry point
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Instance Variables [hide private]
basestring __doc__
Function's doc string
str __name__
The "official" name of the function with decorator
callable _func
The decorated function
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, func)
(Constructor)

source code 
Initialization
Parameters:
  • func (callable) - The callable to decorate
Overrides: object.__init__

__get__(self, inst, owner)

source code 
Generic attribute getter (descriptor protocol)
Parameters:
  • inst (object) - Object instance
  • owner (type) - Object owner
Returns: callable
Proxy function which acts for the wrapped method

__getattr__(self, name)
(Qualification operator)

source code 
Pass attribute requests to the function
Parameters:
  • name (str) - The name of the attribute
Returns: any
The function attribute
Raises:
  • AttributeError - The attribute was not found

__call__(self, *args, **kwargs)
(Call operator)

source code 
Actual decorating entry point
Parameters:
  • args (tuple) - Positioned parameters
  • kwargs (dict) - named parameters
Returns: any
The return value of the decorated function (maybe modified or replaced by the decorator)