src/pybel/tokens.py
def _fusion_to_dsl(tokens) -> FusionBase:
    """Convert a PyParsing data dictionary to a PyBEL fusion data dictionary.

    :param tokens: A PyParsing data dictionary representing a fusion
    :type tokens: ParseResult
    """
    func = tokens[FUNCTION]
    fusion_dsl = FUNC_TO_FUSION_DSL[func]
    member_dsl = FUNC_TO_DSL[func]

    partner_5p = tokens[FUSION][PARTNER_5P]
    partner_5p_concept = (
        partner_5p[CONCEPT]
        if CONCEPT in tokens[FUSION][PARTNER_5P] else
        partner_5p
    )
    partner_5p_node = member_dsl(
        namespace=partner_5p_concept[NAMESPACE],
        name=partner_5p_concept[NAME],
        identifier=partner_5p_concept.get(IDENTIFIER),
        xrefs=partner_5p.get(XREFS),
    )

    partner_3p = tokens[FUSION][PARTNER_3P]
    partner_3p_concept = (
        partner_3p[CONCEPT]
        if CONCEPT in tokens[FUSION][PARTNER_3P] else
        partner_3p
    )
    partner_3p_node = member_dsl(
        namespace=partner_3p_concept[NAMESPACE],
        name=partner_3p_concept[NAME],
        identifier=partner_3p_concept.get(IDENTIFIER),
        xrefs=partner_3p.get(XREFS),
    )

    range_5p = _fusion_range_to_dsl(tokens[FUSION][RANGE_5P])
    range_3p = _fusion_range_to_dsl(tokens[FUSION][RANGE_3P])

    return fusion_dsl(
        partner_5p=partner_5p_node,
        partner_3p=partner_3p_node,
        range_5p=range_5p,
        range_3p=range_3p,
    )
Convert a PyParsing data dictionary to a PyBEL fusion data dictionary.

    :param tokens: A PyParsing data dictionary representing a fusion
    :type tokens: ParseResult
    
Convert a PyParsing data dictionary to a PyBEL fusion data dictionary.
Convert a PyParsing data dictionary to a PyBEL fusion data dictionary .
def _fusion_to_dsl(tokens) -> FusionBase:
    func = tokens[FUNCTION]
    fusion_dsl = FUNC_TO_FUSION_DSL[func]
    member_dsl = FUNC_TO_DSL[func]
    partner_5p = tokens[FUSION][PARTNER_5P]
    partner_5p_concept = (
        partner_5p[CONCEPT]
        if CONCEPT in tokens[FUSION][PARTNER_5P] else
        partner_5p
    )
    partner_5p_node = member_dsl(
        namespace=partner_5p_concept[NAMESPACE],
        name=partner_5p_concept[NAME],
        identifier=partner_5p_concept.get(IDENTIFIER),
        xrefs=partner_5p.get(XREFS),
    )
    partner_3p = tokens[FUSION][PARTNER_3P]
    partner_3p_concept = (
        partner_3p[CONCEPT]
        if CONCEPT in tokens[FUSION][PARTNER_3P] else
        partner_3p
    )
    partner_3p_node = member_dsl(
        namespace=partner_3p_concept[NAMESPACE],
        name=partner_3p_concept[NAME],
        identifier=partner_3p_concept.get(IDENTIFIER),
        xrefs=partner_3p.get(XREFS),
    )
    range_5p = _fusion_range_to_dsl(tokens[FUSION][RANGE_5P])
    range_3p = _fusion_range_to_dsl(tokens[FUSION][RANGE_3P])
    return fusion_dsl(
        partner_5p=partner_5p_node,
        partner_3p=partner_3p_node,
        range_5p=range_5p,
        range_3p=range_3p,
    )
def _fusion_to_dsl ( tokens ) -> FusionBase : func = tokens [ FUNCTION ] fusion_dsl = FUNC_TO_FUSION_DSL [ func ] member_dsl = FUNC_TO_DSL [ func ] partner_5p = tokens [ FUSION ] [ PARTNER_5P ] partner_5p_concept = ( partner_5p [ CONCEPT ] if CONCEPT in tokens [ FUSION ] [ PARTNER_5P ] else partner_5p ) partner_5p_node = member_dsl ( namespace = partner_5p_concept [ NAMESPACE ] , name = partner_5p_concept [ NAME ] , identifier = partner_5p_concept . get ( IDENTIFIER ) , xrefs = partner_5p . get ( XREFS ) , ) partner_3p = tokens [ FUSION ] [ PARTNER_3P ] partner_3p_concept = ( partner_3p [ CONCEPT ] if CONCEPT in tokens [ FUSION ] [ PARTNER_3P ] else partner_3p ) partner_3p_node = member_dsl ( namespace = partner_3p_concept [ NAMESPACE ] , name = partner_3p_concept [ NAME ] , identifier = partner_3p_concept . get ( IDENTIFIER ) , xrefs = partner_3p . get ( XREFS ) , ) range_5p = _fusion_range_to_dsl ( tokens [ FUSION ] [ RANGE_5P ] ) range_3p = _fusion_range_to_dsl ( tokens [ FUSION ] [ RANGE_3P ] ) return fusion_dsl ( partner_5p = partner_5p_node , partner_3p = partner_3p_node , range_5p = range_5p , range_3p = range_3p , )
Convert a PyParsing data dictionary to a PyBEL fusion data dictionary.
Convert a PyParsing data dictionary to a PyBEL fusion data dictionary .
"""Convert a PyParsing data dictionary to a PyBEL fusion data dictionary.

    :param tokens: A PyParsing data dictionary representing a fusion
    :type tokens: ParseResult
    """
tokens
A PyParsing data dictionary representing a fusion
A PyParsing data dictionary representing a fusion