Package pypat :: Package structural :: Module adapter :: Class Adapter
[hide private]
[frames] | no frames]

Class Adapter

source code

object --+
         |
        Adapter


Adapter class as part of the Adapter design pattern.

- External Usage Documentation: U{https://github.com/tylerlaberge/PyPatterns/wiki/Structural-Pattern-Usage}
- External Adapter Pattern Documentation: U{https://en.wikipedia.org/wiki/Adapter_pattern}

Instance Methods [hide private]
 
__init__(self, adaptee, **adapted_methods)
Initialize a new adapter instance.
source code
 
__getattr__(self, attr)
All non-adapted calls are passed to the adaptee.
source code
 
original_dict(self)
Get the adaptee's __dict__
source code

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

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, adaptee, **adapted_methods)
(Constructor)

source code 

Initialize a new adapter instance.

Parameters:
  • adaptee (Object) - The object to adapt to a new interface.
  • adapted_methods (dict) - A dictionary of methods to adapt.
Overrides: object.__init__

__getattr__(self, attr)
(Qualification operator)

source code 

All non-adapted calls are passed to the adaptee.

Parameters:
  • attr - The attribute to get from the adaptee.