src/pybel/io/gpickle.py
def to_bytes(graph: BELGraph, protocol: int = pickle.HIGHEST_PROTOCOL) -> bytes:
    """Convert a graph to bytes with pickle.

    Note that the pickle module has some incompatibilities between Python 2 and 3. To export a universally importable
    pickle, choose 0, 1, or 2.

    :param graph: A BEL graph
    :param protocol: Pickling protocol to use. Defaults to ``HIGHEST_PROTOCOL``.

    .. seealso:: https://docs.python.org/3.6/library/pickle.html#data-stream-format
    """
    raise_for_not_bel(graph)
    return pickle.dumps(graph, protocol=protocol)
Convert a graph to bytes with pickle.

    Note that the pickle module has some incompatibilities between Python 2 and 3. To export a universally importable
    pickle, choose 0, 1, or 2.

    :param graph: A BEL graph
    :param protocol: Pickling protocol to use. Defaults to ``HIGHEST_PROTOCOL``.

    .. seealso:: https://docs.python.org/3.6/library/pickle.html#data-stream-format
    
Convert a graph to bytes with pickle.
Note that the pickle module has some incompatibilities between Python 2 and 3. To export a universally importable
pickle, choose 0, 1, or 2.
Convert a graph to bytes with pickle . Note that the pickle module has some incompatibilities between Python 2 and 3 . To export a universally importable pickle choose 0 1 or 2 .
def to_bytes(graph: BELGraph, protocol: int = pickle.HIGHEST_PROTOCOL) -> bytes:
    raise_for_not_bel(graph)
    return pickle.dumps(graph, protocol=protocol)
def to_bytes ( graph : BELGraph , protocol : int = pickle . HIGHEST_PROTOCOL ) -> bytes : raise_for_not_bel ( graph ) return pickle . dumps ( graph , protocol = protocol )
Convert a graph to bytes with pickle.
Convert a graph to bytes with pickle .
"""Convert a graph to bytes with pickle.

    Note that the pickle module has some incompatibilities between Python 2 and 3. To export a universally importable
    pickle, choose 0, 1, or 2.

    :param graph: A BEL graph
    :param protocol: Pickling protocol to use. Defaults to ``HIGHEST_PROTOCOL``.

    .. seealso:: https://docs.python.org/3.6/library/pickle.html#data-stream-format
    """
graph
BELGraph
A BEL graph
A BEL graph
protocol
int
Pickling protocol to use. Defaults to ``HIGHEST_PROTOCOL``.
Pickling protocol to use . Defaults to ` ` HIGHEST_PROTOCOL ` ` .