Vega strike Python Modules doc  0.5.1
Documentation of the " Modules " folder of Vega strike
 All Data Structures Namespaces Files Functions Variables
copy_reg Namespace Reference

Functions

def pickle
 
def constructor
 
def pickle_complex
 

Variables

list __all__ = ["pickle","constructor"]
 
dictionary dispatch_table = {}
 
dictionary safe_constructors = {}
 
int _HEAPTYPE = 1
 

Detailed Description

Helper to provide extensibility for pickle/cPickle.

This is only useful to add pickle support for extension types defined in
C, not for instances of user-defined classes.

Function Documentation

def copy_reg.constructor (   object)

Definition at line 25 of file copy_reg.py.

25 
26 def constructor(object):
27  if not callable(object):
28  raise TypeError("constructors must be callable")
29  safe_constructors[object] = 1
30 
31 # Example: provide pickling support for complex numbers.
def copy_reg.pickle (   ob_type,
  pickle_function,
  constructor_ob = None 
)

Definition at line 14 of file copy_reg.py.

References constructor().

14 
15 def pickle(ob_type, pickle_function, constructor_ob=None):
16  if type(ob_type) is _ClassType:
17  raise TypeError("copy_reg is not intended for use with classes")
18 
19  if not callable(pickle_function):
20  raise TypeError("reduction functions must be callable")
21  dispatch_table[ob_type] = pickle_function
22 
23  if constructor_ob is not None:
24  constructor(constructor_ob)
def copy_reg.pickle_complex (   c)

Definition at line 32 of file copy_reg.py.

32 
33 def pickle_complex(c):
34  return complex, (c.real, c.imag)
35 
36 pickle(type(1j), pickle_complex, complex)
37 
38 # Support for picking new-style objects

Variable Documentation

list __all__ = ["pickle","constructor"]

Definition at line 9 of file copy_reg.py.

int _HEAPTYPE = 1

Definition at line 45 of file copy_reg.py.

dictionary dispatch_table = {}

Definition at line 11 of file copy_reg.py.

dictionary safe_constructors = {}

Definition at line 12 of file copy_reg.py.