module documentation

Serialize typegraphs into JSON. Usage: from pytype.typegraph import typegraph_serializer s = typegraph_serializer.encode_program(ctx.program) p = typegraph_serializer.decode_program(s) You can also call `json` methods directly, using `TypegraphEncoder` and `object_hook`: import json from pytype.typegraph import typegraph_serializer s = json.dumps(ctx.program, cls=typegraph_serializer.TypegraphEncoder) p = json.loads(s, object_hook=typegraph_serializer.object_hook) We are not interesting in deserialization into a usable cfg.Program. If you want to use the Program for your own needs later, use pytype as a library.

Class SerializedBinding Undocumented
Class SerializedCFGNode Undocumented
Class SerializedOrigin Undocumented
Class SerializedProgram Undocumented
Class SerializedQuery Undocumented
Class SerializedQueryStep Undocumented
Class SerializedVariable Undocumented
Class TypegraphEncoder Implements the JSONEncoder behavior for typegraph objects.
Function decode_program Undocumented
Function encode_program Undocumented
Function object_hook An object hook for json.load that produces serialized CFG objects.
Function to_serialized_program Undocumented
Variable BindingId Undocumented
Variable CFGNodeId Undocumented
Variable VariableId Undocumented
Function _decode Undocumented
Constant _TYP_MAP Undocumented
def decode_program(json_str: str) -> SerializedProgram: (source)

Undocumented

def encode_program(program: cfg.Program) -> str: (source)

Undocumented

def object_hook(obj: Dict[str, Any]) -> Any: (source)

An object hook for json.load that produces serialized CFG objects.

def to_serialized_program(program: cfg.Program) -> SerializedProgram: (source)

Undocumented

BindingId = (source)

Undocumented

CFGNodeId = (source)

Undocumented

VariableId = (source)

Undocumented

def _decode(obj): (source)

Undocumented

_TYP_MAP = (source)

Undocumented

Value
{'Program': SerializedProgram,
 'CFGNode': SerializedCFGNode,
 'Variable': SerializedVariable,
 'Binding': SerializedBinding,
 'Origin': SerializedOrigin,
 'QueryStep': SerializedQueryStep,
 'Query': SerializedQuery}