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

Class ClassAlias

source code


Class alias.

All classes are initially set to a dynamic state.

Instance Methods [hide private]
 
__init__(self, klass, alias, attrs=None, attr_func=None, metadata=[])
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
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
 
_getAttrs(self, obj, static_attrs=None, dynamic_attrs=None, traverse=True) source code
 
getAttrs(self, obj, codec=None)
Returns a tuple of lists, static and dynamic attrs to encode.
source code
 
getAttributes(self, obj, codec=None)
Returns a collection of attributes for an object.
source code
 
applyAttributes(self, obj, attrs, codec=None)
Applies the collection of attributes attrs to aliased object obj.
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__

Class Methods [hide private]
 
checkClass(kls, klass)
This function is used to check the class being aliased to fits certain criteria.
source code
Instance Variables [hide private]
list attrs
A list of attributes to encode for this class.
list metadata
A list of metadata tags similar to ActionScript tags.
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, klass, alias, attrs=None, attr_func=None, metadata=[])
(Constructor)

source code 

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

Parameters:
  • klass (class) - The class to alias.
  • alias (str) - The alias to the class e.g. org.example.Person. If the value of this is None, then it is worked out based on the klass. The anonymous tag is also added to the class.
  • attrs (A list of attributes to encode for this class.) - list
  • metadata (A list of metadata tags similar to ActionScript tags.) - list
Raises:
  • TypeError - The klass must be a class type.
  • TypeError - The attr_func must be callable.
  • TypeError - __readamf__ must be callable.
  • TypeError - __writeamf__ must be callable.
  • AttributeError - An externalised class was specified, but no __readamf__ attribute was found.
  • AttributeError - An externalised class was specified, but no __writeamf__ attribute was found.
  • ValueError - The attrs keyword must be specified for static classes.
Overrides: object.__init__

__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(kls, klass)
Class Method

source code 

This function is used to check the class being aliased to 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

getAttrs(self, obj, codec=None)

source code 

Returns a tuple of lists, static and dynamic attrs to encode.

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

getAttributes(self, obj, codec=None)

source code 

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

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

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

source code 

Applies the collection of attributes attrs to aliased object obj. It is mainly used when reading aliased objects from an AMF byte stream.

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

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

source code 

Creates an instance of the klass.

Returns:
Instance of self.klass.