src/pybel/grounding.py
def _process_concept(*, concept, node=None, skip_namespaces: Optional[Collection[str]] = None) -> bool:
    """Process a node JSON object."""
    namespace = concept[NAMESPACE]
    if namespace.lower() in {'text', 'fixme'}:
        return False

    if skip_namespaces and namespace in skip_namespaces:
        return True

    prefix = normalize_prefix(namespace)
    if prefix is None:
        logger.warning('could not normalize namespace "%s" in concept "%s"', namespace, concept)
        return False

    concept[NAMESPACE] = prefix

    identifier = concept.get(IDENTIFIER)
    name = concept.get(NAME)
    if identifier:  # don't trust whatever was put for the name, even if it's available
        map_success = _handle_identifier_not_name(
            concept=concept,
            prefix=prefix,
            identifier=identifier,
            skip_namespaces=skip_namespaces
        )
        if not map_success:  # just in case the name gets put in the identifier
            map_success = _handle_name_and_not_identifier(
                concept=concept, prefix=prefix, name=identifier, node=node,
                skip_namespaces=skip_namespaces,
            )
    else:
        map_success = _handle_name_and_not_identifier(
            concept=concept, prefix=prefix, name=name, node=node,
            skip_namespaces=skip_namespaces,
        )

    if not map_success:
        return False

    _remap_by_identifier(concept)
    return True
Process a node JSON object.
Process a node JSON object.
Process a node JSON object .
def _process_concept(*, concept, node=None, skip_namespaces: Optional[Collection[str]] = None) -> bool:
    namespace = concept[NAMESPACE]
    if namespace.lower() in {'text', 'fixme'}:
        return False
    if skip_namespaces and namespace in skip_namespaces:
        return True
    prefix = normalize_prefix(namespace)
    if prefix is None:
        logger.warning('could not normalize namespace "%s" in concept "%s"', namespace, concept)
        return False
    concept[NAMESPACE] = prefix
    identifier = concept.get(IDENTIFIER)
    name = concept.get(NAME)
    if identifier:  
        map_success = _handle_identifier_not_name(
            concept=concept,
            prefix=prefix,
            identifier=identifier,
            skip_namespaces=skip_namespaces
        )
        if not map_success:  
            map_success = _handle_name_and_not_identifier(
                concept=concept, prefix=prefix, name=identifier, node=node,
                skip_namespaces=skip_namespaces,
            )
    else:
        map_success = _handle_name_and_not_identifier(
            concept=concept, prefix=prefix, name=name, node=node,
            skip_namespaces=skip_namespaces,
        )
    if not map_success:
        return False
    _remap_by_identifier(concept)
    return True
def _process_concept ( * , concept , node = None , skip_namespaces : Optional [ Collection [ str ] ] = None ) -> bool : namespace = concept [ NAMESPACE ] if namespace . lower ( ) in { 'text' , 'fixme' } : return False if skip_namespaces and namespace in skip_namespaces : return True prefix = normalize_prefix ( namespace ) if prefix is None : logger . warning ( 'could not normalize namespace "%s" in concept "%s"' , namespace , concept ) return False concept [ NAMESPACE ] = prefix identifier = concept . get ( IDENTIFIER ) name = concept . get ( NAME ) if identifier : map_success = _handle_identifier_not_name ( concept = concept , prefix = prefix , identifier = identifier , skip_namespaces = skip_namespaces ) if not map_success : map_success = _handle_name_and_not_identifier ( concept = concept , prefix = prefix , name = identifier , node = node , skip_namespaces = skip_namespaces , ) else : map_success = _handle_name_and_not_identifier ( concept = concept , prefix = prefix , name = name , node = node , skip_namespaces = skip_namespaces , ) if not map_success : return False _remap_by_identifier ( concept ) return True
Process a node JSON object.
Process a node JSON object .
"""Process a node JSON object.""" # don't trust whatever was put for the name, even if it's available # just in case the name gets put in the identifier
concept
node
skip_namespaces
Optional[Collection[str]]