File genbankfixer.py
has 377 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2013-2023 by Björn Johansson. All rights reserved.
# This code is part of the pydna distribution and governed by its
# license. Please see the LICENSE.txt file that should have been included
Function toGB
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def toGB(jseq):
"parses json jseq data and prints out ApE compatible genbank"
# construct the LOCUS header string
# LOCUS format:
- 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 toJSON
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def toJSON(gbkstring):
parsed = multipleGB.parseString(gbkstring)
jseqlist = []
- 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 wrapstring
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def wrapstring(str_, rowstart, rowend, padfirst=True):
"""
wraps the provided string in lines of length rowend-rowstart
and padded on the left by rowstart.
-> if padfirst is false the first line is not padded
- 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
Avoid deeply nested control flow statements. Open
if k in [
"ApEinfo_label",
"ApEinfo_fwdcolor",
"ApEinfo_revcolor",
"label",
Avoid deeply nested control flow statements. Open
if isinstance(val, str):
dct[key] = a[key].strip()
nl.append(dct)
Function parseGBLoc
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def parseGBLoc(s, l_, t):
"""retwingles parsed genbank location strings, assumes no joins of RC and FWD sequences"""
strand = 1
locationlist = []
- 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"