module documentation

Undocumented

Function add_pattern Record struct pattern that's been used for (de)serialization.
Function clear_patterns Clear record of struct pattern that have been used for (de)serialization.
Function compute_struct_pattern Get struct pattern.
Function get_patterns Get record of struct pattern that have been used for (de)serialization.
Function int32_pack Pack int32.
Function int32_unpack Unpack int32.
Function pack Create struct.pack call for when pattern is a string pattern.
Function pack2 Create struct.pack call for when pattern is the name of a variable.
Function reduce_pattern Optimize the struct format pattern.
Function serialize Return code to write expression to buffer.
Function unpack Create struct.unpack call for when pattern is a string pattern.
Function unpack2 Create struct.unpack call for when pattern refers to variable.
Function unpack3 Create an unpack call on the struct.Struct object with the name struct_var.
Variable _context_patterns Undocumented
def add_pattern(p):

Record struct pattern that's been used for (de)serialization.

def clear_patterns():

Clear record of struct pattern that have been used for (de)serialization.

def compute_struct_pattern(types):

Get struct pattern.

Parameters
typestype names, [str]
Returns
format string for struct if types are all simple. Otherwise, return None, str
def get_patterns():

Get record of struct pattern that have been used for (de)serialization.

def int32_pack(var):

Pack int32.

Parameters
varvariable name, str
Returns
struct packing code for an int32
def int32_unpack(var, buff):

Unpack int32.

Parameters
varvariable name, str
buffUndocumented
Returns
struct unpacking code for an int32
def pack(pattern, vars_):

Create struct.pack call for when pattern is a string pattern.

Parameters
patternpattern for pack, str
vars_name of variables to pack, str
def pack2(pattern, vars_):

Create struct.pack call for when pattern is the name of a variable.

Parameters
patternname of variable storing string pattern, struct
vars_name of variables to pack, str
def reduce_pattern(pattern):

Optimize the struct format pattern.

Parameters
patternstruct pattern, str
Returns
optimized struct pattern, str
def serialize(expr):

Return code to write expression to buffer.

Parameters
exprUndocumented
expr strstring python expression that is evaluated for serialization
Returns
python call to write value returned by expr to serialization buffer
def unpack(var, pattern, buff):

Create struct.unpack call for when pattern is a string pattern.

Parameters
varname of variable to unpack, str
patternpattern for pack, str
buffbuffer to unpack from, str
def unpack2(var, pattern, buff):

Create struct.unpack call for when pattern refers to variable.

Parameters
varvariable the stores the result of unpack call, str
patternname of variable that unpack will read from, str
buffbuffer that the unpack reads from, StringIO
def unpack3(var, struct_var, buff):

Create an unpack call on the struct.Struct object with the name struct_var.

Parameters
varvariable the stores the result of unpack call, str
struct_varUndocumented
buffbuffer that the unpack reads from, StringIO
str struct_varname of the struct variable used to unpack buff
_context_patterns: list =

Undocumented