Package param :: Module parameterized :: Class PicklableClassAttributes
[hide private]
[frames] | no frames]

Class PicklableClassAttributes

source code


Supports pickling of Parameterized class attributes for a given module.

When requested to be pickled, stores a module's PO classes' attributes, and any given startup_commands. On unpickling, executes the startup commands and sets the class attributes.

Instance Methods [hide private]
 
__init__(self, module, exclusions=(), startup_commands=())
module: a module object, such as topo
source code
 
__getstate__(self)
Return a dictionary of self.module's PO classes' attributes, plus self.startup_commands.
source code
 
__setstate__(self, state)
Execute the startup commands and set class attributes.
source code
 
get_PO_class_attributes(self, module, class_attributes, processed_modules, exclude=())
Recursively search module and get attributes of Parameterized classes within it.
source code

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

Class Variables [hide private]
  do_not_restore = ['topo.base.boundingregion.BoundingRegion', '...
list() -> new list list(sequence) -> new list initialized from sequence's items
  param_name_changes = {}
dict() -> new empty dictionary.
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, module, exclusions=(), startup_commands=())
(Constructor)

source code 

module: a module object, such as topo

Any submodules listed by name in exclusions will not have their classes' attributes saved.

Overrides: object.__init__

get_PO_class_attributes(self, module, class_attributes, processed_modules, exclude=())

source code 

Recursively search module and get attributes of Parameterized classes within it.

class_attributes is a dictionary {module.path.and.Classname: state}, where state is the dictionary {attribute: value}.

Something is considered a module for our purposes if inspect says it's a module, and it defines __all__. We only search through modules listed in __all__.

Keeps a list of processed modules to avoid looking at the same one more than once (since e.g. __main__ contains __main__ contains __main__...)

Modules can be specifically excluded if listed in exclude.


Class Variable Details [hide private]

do_not_restore

list() -> new list list(sequence) -> new list initialized from sequence's items
Value:
['topo.base.boundingregion.BoundingRegion',
 'topo.base.boundingregion.BoundingBox',
 'topo.base.boundingregion.BoundingCircle',
 'topo.base.boundingregion.BoundingEllipse',
 'topo.base.cf.ConnectionField',
 'topo.projection.basic.SharedWeightCF',
 'param.normalize_path',
 'param.resolve_path']

param_name_changes

dict() -> new empty dictionary.
dict(mapping) -> new dictionary initialized from a mapping object's
    (key, value) pairs.
dict(seq) -> new dictionary initialized as if via:
    d = {}
    for k, v in seq:
        d[k] = v
dict(**kwargs) -> new dictionary initialized with the name=value pairs
    in the keyword argument list.  For example:  dict(one=1, two=2)

Value:
{}