File sars_cov_2_gene_annot.py
has 258 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Transform for SARS-CoV-2 gene annotation data."""
import logging
import os
from typing import Generator, List, Optional, TextIO
Function gpi_to_gene_node_data
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def gpi_to_gene_node_data(self, rec: dict) -> list:
"""Return node that can be passed to write_node_edge_item().
Uses a parsed gpi entry.
:param rec: record from gpi iterator
- 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 _gpi12iterator
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _gpi12iterator(handle: TextIO) -> Generator:
# Partly cribbed from Biopython GPI 1.1 parser
# There is no GPI 1.2 parser yet, so I made this
"""Read GPI 1.2 format files (PRIVATE).
- 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 gpa_to_edge_data
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def gpa_to_edge_data(self, rec: dict) -> list:
"""Return an edge with annotations given a parsed gpa entry.
:param rec: record from gpa iterator
:return:
- 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 run
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def run(self, data_file: Optional[str] = None):
"""Run the transform."""
# file housekeeping
os.makedirs(self.output_dir, exist_ok=True)
- 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"