src/pybel/parser/parse_bel.py
def check_function_semantics(self, line: str, position: int, tokens: ParseResults) -> ParseResults:
        """Raise an exception if the function used on the tokens is wrong.

        :raises: InvalidFunctionSemantic
        """
        concept = tokens.get(CONCEPT)
        if not self._namespace_dict or concept is None:
            return tokens

        namespace, name = concept[NAMESPACE], concept[NAME]

        if namespace in self.concept_parser.namespace_to_pattern:
            return tokens

        if self._allow_naked_names and namespace == DIRTY:  # Don't check dirty names in lenient mode
            return tokens

        valid_functions = set(
            itt.chain.from_iterable(
                belns_encodings.get(encoding, set())
                for encoding in self._namespace_dict[namespace][name]
            ),
        )

        if not valid_functions:
            raise InvalidEntity(self.get_line_number(), line, position, namespace, name)

        if tokens[FUNCTION] not in valid_functions:
            raise InvalidFunctionSemantic(
                line_number=self.get_line_number(),
                line=line,
                position=position,
                func=tokens[FUNCTION],
                namespace=namespace,
                name=name,
                allowed_functions=valid_functions,
            )

        return tokens
Raise an exception if the function used on the tokens is wrong.

        :raises: InvalidFunctionSemantic
        
Raise an exception if the function used on the tokens is wrong.
Raise an exception if the function used on the tokens is wrong .
def check_function_semantics(self, line: str, position: int, tokens: ParseResults) -> ParseResults:
        concept = tokens.get(CONCEPT)
        if not self._namespace_dict or concept is None:
            return tokens
        namespace, name = concept[NAMESPACE], concept[NAME]
        if namespace in self.concept_parser.namespace_to_pattern:
            return tokens
        if self._allow_naked_names and namespace == DIRTY:  
            return tokens
        valid_functions = set(
            itt.chain.from_iterable(
                belns_encodings.get(encoding, set())
                for encoding in self._namespace_dict[namespace][name]
            ),
        )
        if not valid_functions:
            raise InvalidEntity(self.get_line_number(), line, position, namespace, name)
        if tokens[FUNCTION] not in valid_functions:
            raise InvalidFunctionSemantic(
                line_number=self.get_line_number(),
                line=line,
                position=position,
                func=tokens[FUNCTION],
                namespace=namespace,
                name=name,
                allowed_functions=valid_functions,
            )
        return tokens
def check_function_semantics ( self , line : str , position : int , tokens : ParseResults ) -> ParseResults : concept = tokens . get ( CONCEPT ) if not self . _namespace_dict or concept is None : return tokens namespace , name = concept [ NAMESPACE ] , concept [ NAME ] if namespace in self . concept_parser . namespace_to_pattern : return tokens if self . _allow_naked_names and namespace == DIRTY : return tokens valid_functions = set ( itt . chain . from_iterable ( belns_encodings . get ( encoding , set ( ) ) for encoding in self . _namespace_dict [ namespace ] [ name ] ) , ) if not valid_functions : raise InvalidEntity ( self . get_line_number ( ) , line , position , namespace , name ) if tokens [ FUNCTION ] not in valid_functions : raise InvalidFunctionSemantic ( line_number = self . get_line_number ( ) , line = line , position = position , func = tokens [ FUNCTION ] , namespace = namespace , name = name , allowed_functions = valid_functions , ) return tokens
Raise an exception if the function used on the tokens is wrong.
Raise an exception if the function used on the tokens is wrong .
"""Raise an exception if the function used on the tokens is wrong.

        :raises: InvalidFunctionSemantic
        """ # Don't check dirty names in lenient mode
None
self
line
str
position
int
tokens
ParseResults