src/pybel/canonicalize.py
def _set_annotation_to_str(annotation_data: Mapping[str, List[Entity]], key: str, use_curie: bool = False) -> str:
    """Return a set annotation string."""
    value = annotation_data[key]

    if len(value) == 1:
        value = list(value)[0]
        return f'SET {key} = "{value if use_curie else value.identifier}"'

    value_strings = ', '.join(
        f'"{v if use_curie else v.identifier}"'
        for v in sorted(value, key=lambda e: (e.namespace, e.identifier, e.name))
    )
    return f'SET {key} = {{{value_strings}}}'
Return a set annotation string.
Return a set annotation string.
Return a set annotation string .
def _set_annotation_to_str(annotation_data: Mapping[str, List[Entity]], key: str, use_curie: bool = False) -> str:
    value = annotation_data[key]
    if len(value) == 1:
        value = list(value)[0]
        return f'SET {key} = "{value if use_curie else value.identifier}"'
    value_strings = ', '.join(
        f'"{v if use_curie else v.identifier}"'
        for v in sorted(value, key=lambda e: (e.namespace, e.identifier, e.name))
    )
    return f'SET {key} = {{{value_strings}}}'
def _set_annotation_to_str ( annotation_data : Mapping [ str , List [ Entity ] ] , key : str , use_curie : bool = False ) -> str : value = annotation_data [ key ] if len ( value ) == 1 : value = list ( value ) [ 0 ] return f'SET {key} = "{value if use_curie else value.identifier}"' value_strings = ', ' . join ( f'"{v if use_curie else v.identifier}"' for v in sorted ( value , key = lambda e : ( e . namespace , e . identifier , e . name ) ) ) return f'SET {key} = {{{value_strings}}}'
Return a set annotation string.
Return a set annotation string .
"""Return a set annotation string."""
annotation_data
Mapping[str, List[Entity]]
key
str
use_curie
bool