Showing 140 of 219 total issues
Function shift_location
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def shift_location(original_location, shift, lim):
"""docstring."""
newparts = []
strand = original_location.strand
- 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 write
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def write(self, filename=None, f="gb"):
"""Writes the Dseqrecord to a file using the format f, which must
be a format supported by Biopython SeqIO for writing [#]_. Default
is "gb" which is short for Genbank. Note that Biopython SeqIO reads
more formats than it writes.
- 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 synced
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def synced(self, ref, limit=25):
"""This method returns a new circular sequence (Dseqrecord object), which has been rotated
in such a way that there is maximum overlap between the sequence and
ref, which may be a string, Biopython Seq, SeqRecord object or
another Dseqrecord object.
- 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 download_text
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def download_text(url):
cached = False
refresh = False
cache = _shelve.open(
_os.path.join(_os.environ["pydna_data_dir"], "web"),
- 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 assign_quantitiesB
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def assign_quantitiesB(samples, maxdef=Q_(150, "ng")):
"""
Assigns quantities (masses in nanograms) to the DNA fragments without
corresponding quantity assuming a linear relationship between the DNA
length (in basepairs) and its mass. As if the fragments originated in
- 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 __init__
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, frags=None, limit=25, algorithm=common_sub_strings):
# Fragments is a string subclass with some extra properties
# The order of the fragments has significance
fragments = []
for f in frags:
- 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 __getitem__
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def __getitem__(self, sl):
"""docstring."""
answer = Dseqrecord(_copy.copy(self))
answer.seq = self.seq.__getitem__(sl)
# answer.seq.alphabet = self.seq.alphabet
- 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 apply_cut
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def apply_cut(self, left_cut, right_cut):
dseq = self.seq.apply_cut(left_cut, right_cut)
# TODO: maybe remove depending on https://github.com/BjornFJohansson/pydna/issues/161
if left_cut == right_cut:
- 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 ferguson_to_mu0
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def ferguson_to_mu0(
field,
Tvals,
DNAvals,
dataset,
- 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 toGB
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def toGB(jseqs):
"parses json jseq data and prints out ApE compatible genbank"
# take first jseq from parsed list
if type(jseqs) == type([]):
- 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 __getitem__
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def __getitem__(self, sl):
"""Returns a subsequence. This method is used by the slice notation"""
if not self.circular:
x = len(self.crick) - self.ovhg - len(self.watson)
- 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 __getitem__
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def __getitem__(self, i):
"""Save indices of accessed items."""
if isinstance(i, slice):
result = self.__class__(self.data[i])
for ind in range(i.start, i.stop, i.step or 1):
- 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 pcr
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def pcr(*args, **kwargs):
"""pcr is a convenience function for the Anneal class to simplify its
usage, especially from the command line. If more than one or no PCR
product is formed, a ValueError is raised.
- 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 __init__
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function __init__
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def __init__(
self,
samples, # list of lists of Dseqrecords
names=None,
percentgel=Q_(1.0, "(g/(100 mL))*100"), # agar/buffer
Function __add__
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def __add__(self, other):
if hasattr(other, "seq") and hasattr(other.seq, "watson"):
other = _copy.deepcopy(other)
other_five_prime = other.seq.five_prime_end()
if other_five_prime[0] == "5'":
- 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 __init__
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, primers, template, limit=13, **kwargs):
r"""The Anneal class has to be initiated with at least an iterable of
primers and a template.
- 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 __init__
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function open
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def open(self, seq_to_open):
"""Open a sequence for editing in an external (DNA) editor.
Parameters
----------
- 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 _findDNAConcentrations
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def _findDNAConcentrations(self, background):
"""Determines where in the concentration of DNA in every part of the gel"""
length = len(self.lanes[0])
- 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 _findDNAConcentrations
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def _findDNAConcentrations(self, background):
"""Determines where in the concentration of DNA in every part of the gel"""
length = len(self.lanes[0])
- 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 vWBRfit
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def vWBRfit(
Function ferguson_to_mu0
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def ferguson_to_mu0(
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
Function lcs
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def lcs(self, other, *args, limit=25, **kwargs):
"""Return the longest common substring between the sequence.
and another sequence (other). The other sequence can be a string,
Seq, SeqRecord, Dseq or DseqRecord.
- 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 __contains__
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def __contains__(self, other):
if other.lower() in str(self.seq).lower():
return True
else:
s = self.seq.watson.replace(" ", "")
- 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 _to_units
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _to_units(quantity, units, var_name=None):
"""Asserts that the quantity has the proper dimensions
(inferred from the default units) if the quantity is an instance of
pint.unit.Quantity or assigns the default units if it's not.
"""
- 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
Function from_SeqRecord
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def from_SeqRecord(cls, record, *args, item="accession", start=None, stop=None, strand=1, **kwargs):
Function from_string
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def from_string(
Function add_feature
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def add_feature(self, x=None, y=None, seq=None, type_="misc", strand=1, *args, **kwargs):
Function size_to_mobility
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def size_to_mobility(
Function primer_design
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def primer_design(template, fp=None, rp=None, limit=13, target_tm=55.0, tm_func=_tm_default, **kwargs):
Function __init__
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, record, *args, item="accession", start=None, stop=None, strand=1, **kwargs):
Function __init__
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function add_feature
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def add_feature(self, x=None, y=None, seq=None, type_="misc", strand=1, *args, **kwargs):
Avoid deeply nested control flow statements. Open
if not forwdYstop:
distYfor = Q_(pxlYfor, "px") / res
forYI = Gaussian(distYfor, maxI, distYmid, std_dev)
rgb_arr[pxlYfor, from_x:to_x] += forYI
pxlYfor += 1
Function list_features
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def list_features(self):
"""Print ASCII table with all features.
Examples
--------
- 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 from_string
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def from_string(
Avoid deeply nested control flow statements. Open
if forYI <= Itol or pxlYfor == pxl_y:
forwdYstop = True
# Background color
if noise is None or noise <= 0:
Avoid deeply nested control flow statements. Open
if k in [
"ApEinfo_label",
"ApEinfo_fwdcolor",
"ApEinfo_revcolor",
"label",
Function looped
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def looped(self):
"""
Circular version of the Dseqrecord object.
The underlying linear Dseq object has to have compatible ends.
- 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 bckYI <= Itol or pxlYbck == -1:
bckwdYstop = True
if not forwdYstop:
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Avoid deeply nested control flow statements. Open
if f.location.start > len(ct) and f.location.end > len(ct):
f.location += -len(ct)
elif f.location.end > len(ct):
f.location = _CompoundLocation(
(
Function nucleotide
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def nucleotide(self, item: str, seq_start=None, seq_stop=None, strand=1):
"""This method downloads a genbank nuclotide record from genbank. This method is
cached by default. This can be controlled by editing the **pydna_cached_funcs** environment
variable. The best way to do this permanently is to edit the edit the
`pydna.ini` file. See the documentation of :func:`pydna.open_config_folder`
- 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 Zimm_g
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def Zimm_g(Nbp, DRouse, qeff, mu0, kB, T):
Avoid deeply nested control flow statements. Open
if pxlYbck < len(rgb_arr):
rgb_arr[pxlYbck, from_x:to_x] += bckYI
pxlYbck -= 1
Avoid deeply nested control flow statements. Open
if not bckwdYstop:
distYbck = Q_(pxlYbck, "px") / res
bckYI = Gaussian(distYbck, maxI, distYmid, std_dev)
if pxlYbck < len(rgb_arr):
rgb_arr[pxlYbck, from_x:to_x] += bckYI