File terms.py
has 458 lines of code (exceeds 250 allowed). Consider refactoring. Open
# Standard Library
import re
import time
from typing import Any, List, Mapping, Optional, Union
Function get_term_completions
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
def get_term_completions(
completion_text: str,
size: int = 10,
entity_types: List[str] = None,
annotation_types: List[str] = None,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function get_normalized_terms
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def get_normalized_terms(
term_key: Key,
canonical_targets: Mapping[str, List[str]] = settings.BEL_CANONICALIZE,
decanonical_targets: Mapping[str, List[str]] = settings.BEL_DECANONICALIZE,
term: Optional[Term] = None,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function get_term_completions
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_term_completions(
Function get_term_search
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_term_search(search_term, size, entity_types, annotation_types, species, namespaces):
Function get_terms
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_terms(term_key: Key) -> List[Term]:
"""Get term(s) using term_key - given term_key may match multiple term records
Term Key can match the main key, alt_keys or obsolete_keys
"""
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function get_term
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_term(term_key: Key) -> Optional[Term]:
"""Expect one term to match term_key
Term Key can match the main key, alt_keys or obsolete_keys
"""
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function get_term_search
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_term_search(search_term, size, entity_types, annotation_types, species, namespaces):
"""Search for terms given search term"""
if not size:
size = 10
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"