cottax.consumers.pickle module

A graph written as a pickle: every node pickles and refers to nothing in __main__.

check_nodes_pickle[N: Label, V: Place](graph: NestingGraph[N, V])[source]

Each node pickles, and names nothing in __main__

Return type:

Iterator[Violation]

write_pickle[N: Label, V: Place](graph: NestingGraph[N, V])[source]

A graph whose every node another process can unpickle, pickled; pickle.loads gives it back.

Return type:

bytes

class Unpicklable(node: object, reason: str)[source]

Bases: Violation

node: object
reason: str
template: AbstractClassVar[str] = '{node!r} does not pickle ({reason}): a lambda or a local function has no name to be found by; bind it at module level'

e.g. ‘output {place!r} is owned by both {other!r} and {node!r}’

Type:

Wording

class DefinedInMain(node: object)[source]

Bases: Violation

node: object
template: AbstractClassVar[str] = '{node!r} holds something defined in `__main__`, which loads back only in the process that wrote it; move it into a module'

e.g. ‘output {place!r} is owned by both {other!r} and {node!r}’

Type:

Wording