Package pyxb :: Package utils :: Module utility :: Class PrivateTransient_mixin
[hide private]
[frames] | no frames]

Class PrivateTransient_mixin

source code

object --+    
         |    
   cscRoot --+
             |
            PrivateTransient_mixin
Known Subclasses:

Emulate the transient keyword from Java for private member variables.

This class defines a __getstate__ method which returns a copy of self.__dict__ with certain members removed. Specifically, if a string "s" appears in a class member variable named __PrivateTransient defined in the "Class" class, then the corresponding private variable "_Class__s" will be removed from the state dictionary. This is used to eliminate unnecessary fields from instances placed in namespace archives without having to implement a __getstate__ method in every class in the instance hierarchy.

For an example, see pyxb.xmlschema.structures._SchemaComponent_mixin

If you use this, it is your responsibility to define the __PrivateTransient class variable and add to it the required variable names.

Classes that inherit from this are free to define their own __getstate__ method, which may or may not invoke the superclass one. If you do this, be sure that the class defining __getstate__ lists PrivateTransient_mixin as one of its direct superclasses, lest the latter end up earlier in the mro and consequently bypass the local override.

Instance Methods [hide private]
 
__getstate__(self) source code

Inherited from cscRoot: __init__

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

Class Variables [hide private]
  __Attribute = '__PrivateTransient'
Properties [hide private]

Inherited from object: __class__