Package pyamf :: Class ClassAlias
[hide private]
[frames] | no frames]

Class ClassAlias

source code


Class alias. Provides class/instance meta data to the En/Decoder to allow fine grain control and some performance increases.

Instance Methods [hide private]
 
__init__(self, klass, alias=None, **kwargs)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
_checkExternal(self) source code
 
compile(self)
This compiles the alias into a form that can be of most benefit to the en/decoder.
source code
 
_compile_base_class(self, klass) source code
 
_finalise_compile(self) source code
 
is_compiled(self) source code
 
__str__(self)
str(x)
source code
 
__repr__(self)
repr(x)
source code
 
__eq__(self, other) source code
 
__hash__(self)
hash(x)
source code
 
checkClass(self, klass)
This function is used to check if the class being aliased fits certain criteria.
source code
 
getEncodableAttributes(self, obj, codec=None)
Returns a tuple containing a dict of static and dynamic attributes for an object to encode.
source code
 
getDecodableAttributes(self, obj, attrs, codec=None)
Returns a dictionary of attributes for obj that has been filtered, based on the supplied attrs.
source code
 
getProxiedAttribute(self, attr, obj)
Returns the proxied equivalent for obj.
source code
 
applyAttributes(self, obj, attrs, codec=None)
Applies the collection of attributes attrs to aliased object obj.
source code
 
getCustomProperties(self)
Overrride this to provide known static properties based on the aliased class.
source code
 
createInstance(self, codec=None, *args, **kwargs)
Creates an instance of the klass.
source code

Inherited from object: __delattr__, __getattribute__, __new__, __reduce__, __reduce_ex__, __setattr__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, klass, alias=None, **kwargs)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

__str__(self)
(Informal representation operator)

source code 

str(x)

Overrides: object.__str__
(inherited documentation)

__repr__(self)
(Representation operator)

source code 

repr(x)

Overrides: object.__repr__
(inherited documentation)

__hash__(self)
(Hashing function)

source code 

hash(x)

Overrides: object.__hash__
(inherited documentation)

checkClass(self, klass)

source code 

This function is used to check if the class being aliased fits certain criteria. The default is to check that the __init__ constructor does not pass in arguments.

Raises:
  • TypeError - __init__ doesn't support additional arguments

Since: 0.4

getEncodableAttributes(self, obj, codec=None)

source code 

Returns a tuple containing a dict of static and dynamic attributes for an object to encode.

Parameters:
  • codec - An optional argument that will contain the en/decoder instance calling this function.

Since: 0.5

getDecodableAttributes(self, obj, attrs, codec=None)

source code 

Returns a dictionary of attributes for obj that has been filtered, based on the supplied attrs. This allows for fine grain control over what will finally end up on the object or not ..

Parameters:
  • obj - The reference object.
  • attrs - The attrs dictionary that has been decoded.
  • codec - An optional argument that will contain the codec instance calling this function.
Returns:
A dictionary of attributes that can be applied to obj

Since: 0.5

getProxiedAttribute(self, attr, obj)

source code 

Returns the proxied equivalent for obj.

Parameters:
  • attr (str) - The attribute of the proxy request. Useful for class introspection.
  • obj - The object to proxy.
Returns:
The proxied object or the original object if it cannot be proxied.

applyAttributes(self, obj, attrs, codec=None)

source code 

Applies the collection of attributes attrs to aliased object obj. Called when decoding reading aliased objects from an AMF byte stream.

Override this to provide fine grain control of application of attributes to obj.

Parameters:
  • codec - An optional argument that will contain the en/decoder instance calling this function.

getCustomProperties(self)

source code 

Overrride this to provide known static properties based on the aliased class.

Since: 0.5

createInstance(self, codec=None, *args, **kwargs)

source code 

Creates an instance of the klass.

Returns:
Instance of self.klass.