File protein_data.py
has 888 lines of code (exceeds 250 allowed). Consider refactoring. Open
from collections import defaultdict, namedtuple
from pathlib import Path
from typing import Callable, Type
from warnings import warn
Function proteins_and_genes
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def proteins_and_genes(path='data/protein_data.tsv'):
"""Create proteins and genes based on data in a given file.
If protein/gene already exists it will be skipped.
- 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 parser
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def parser(line):
nonlocal previous_level, new_domains, domains_stack
result = expr.match(line)
- 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 parser
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def parser(line):
nonlocal skipped, wrong_length, not_matching_chrom
try:
- 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 parser
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def parser(line):
kinase_name, gene_name = line
protein = get_preferred_gene_isoform(gene_name)
if not protein:
- 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"