src/pybel/canonicalize.py
def _to_bel_lines_footer(graph, use_identifiers: bool = False) -> Iterable[str]:
    """Iterate the lines of a BEL graph's corresponding BEL script's footer.

    :param pybel.BELGraph graph: A BEL graph
    :param use_identifiers: Enables extended `BEP-0008 <http://bep.bel.bio/published/BEP-0008.html>`_ syntax
    """
    unqualified_edges_to_serialize = [
        (u, v, d)
        for u, v, d in graph.edges(data=True)
        if d[RELATION] in UNQUALIFIED_EDGES and EVIDENCE not in d
    ]

    isolated_nodes_to_serialize = [
        node
        for node in graph
        if not graph.pred[node] and not graph.succ[node]
    ]

    if unqualified_edges_to_serialize or isolated_nodes_to_serialize:
        yield '###############################################\n'
        yield SET_CITATION_FMT.format(CITATION_TYPE_PUBMED, PYBEL_PUBMED)
        yield 'SET SupportingText = "{}"'.format(PYBEL_AUTOEVIDENCE)

        for u, v, data in unqualified_edges_to_serialize:
            yield '{} {} {}'.format(
                u.as_bel(use_identifiers=use_identifiers),
                data[RELATION],
                v.as_bel(use_identifiers=use_identifiers),
            )

        for node in isolated_nodes_to_serialize:
            yield node.as_bel(use_identifiers=use_identifiers)

        yield 'UNSET SupportingText'
        yield 'UNSET Citation'
Iterate the lines of a BEL graph's corresponding BEL script's footer.

    :param pybel.BELGraph graph: A BEL graph
    :param use_identifiers: Enables extended `BEP-0008 <http://bep.bel.bio/published/BEP-0008.html>`_ syntax
    
Iterate the lines of a BEL graph's corresponding BEL script's footer.
Iterate the lines of a BEL graph ' s corresponding BEL script ' s footer .
def _to_bel_lines_footer(graph, use_identifiers: bool = False) -> Iterable[str]:
    unqualified_edges_to_serialize = [
        (u, v, d)
        for u, v, d in graph.edges(data=True)
        if d[RELATION] in UNQUALIFIED_EDGES and EVIDENCE not in d
    ]
    isolated_nodes_to_serialize = [
        node
        for node in graph
        if not graph.pred[node] and not graph.succ[node]
    ]
    if unqualified_edges_to_serialize or isolated_nodes_to_serialize:
        yield '###############################################\n'
        yield SET_CITATION_FMT.format(CITATION_TYPE_PUBMED, PYBEL_PUBMED)
        yield 'SET SupportingText = "{}"'.format(PYBEL_AUTOEVIDENCE)
        for u, v, data in unqualified_edges_to_serialize:
            yield '{} {} {}'.format(
                u.as_bel(use_identifiers=use_identifiers),
                data[RELATION],
                v.as_bel(use_identifiers=use_identifiers),
            )
        for node in isolated_nodes_to_serialize:
            yield node.as_bel(use_identifiers=use_identifiers)
        yield 'UNSET SupportingText'
        yield 'UNSET Citation'
def _to_bel_lines_footer ( graph , use_identifiers : bool = False ) -> Iterable [ str ] : unqualified_edges_to_serialize = [ ( u , v , d ) for u , v , d in graph . edges ( data = True ) if d [ RELATION ] in UNQUALIFIED_EDGES and EVIDENCE not in d ] isolated_nodes_to_serialize = [ node for node in graph if not graph . pred [ node ] and not graph . succ [ node ] ] if unqualified_edges_to_serialize or isolated_nodes_to_serialize : yield '###############################################\n' yield SET_CITATION_FMT . format ( CITATION_TYPE_PUBMED , PYBEL_PUBMED ) yield 'SET SupportingText = "{}"' . format ( PYBEL_AUTOEVIDENCE ) for u , v , data in unqualified_edges_to_serialize : yield '{} {} {}' . format ( u . as_bel ( use_identifiers = use_identifiers ) , data [ RELATION ] , v . as_bel ( use_identifiers = use_identifiers ) , ) for node in isolated_nodes_to_serialize : yield node . as_bel ( use_identifiers = use_identifiers ) yield 'UNSET SupportingText' yield 'UNSET Citation'
Iterate the lines of a BEL graph's corresponding BEL script's footer.
Iterate the lines of a BEL graph ' s corresponding BEL script ' s footer .
"""Iterate the lines of a BEL graph's corresponding BEL script's footer.

    :param pybel.BELGraph graph: A BEL graph
    :param use_identifiers: Enables extended `BEP-0008 <http://bep.bel.bio/published/BEP-0008.html>`_ syntax
    """
graph
A BEL graph
A BEL graph
use_identifiers
bool
Enables extended `BEP-0008 `_ syntax
Enables extended ` BEP - 0008 ` _ syntax