Showing 84 of 109 total issues
Avoid deeply nested control flow statements. Open
for i_author in range(cls.call_libsbml(sbml_authors.getNumChildren, returns_int=True)):
sbml_au = cls.call_libsbml(sbml_authors.getChild, i_author)
au = model.authors.create()
for i_prop in range(cls.call_libsbml(sbml_au.getNumChildren, returns_int=True)):
sbml_prop = cls.call_libsbml(sbml_au.getChild, i_prop)
Avoid deeply nested control flow statements. Open
if submodel.dfba_obj.expression.expression:
merged_dfba_expression.append(submodel.dfba_obj.expression.expression)
for rxn in list(submodel.dfba_obj.expression.reactions):
Avoid deeply nested control flow statements. Open
for rxn in list(submodel.dfba_obj.expression.reactions):
submodel.dfba_obj.expression.reactions.remove(rxn)
objs_for_merged_dfba_expression[Reaction][rxn.id] = rxn
for dfba_obj_rxn in list(submodel.dfba_obj.expression.dfba_obj_reactions):
Function remove_metadata
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def remove_metadata(model):
""" Remove metadata from model
Args:
model (:obj:`wc_utils.workbook.Workbook`): model
- 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_errors_warnings
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_errors_warnings(cls, sbml_doc):
""" Get libSBML errors and warnings
Args:
sbml_doc (:obj:`libsbml.SBMLDocument`): SBML document
- 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 rxn.flux_bounds:
if not math.isnan(rxn.flux_bounds.min) and not math.isnan(rxn.flux_bounds.max):
# assume flux_bounds.min <= flux_bounds.max
assert rxn.flux_bounds.min <= rxn.flux_bounds.max, \
f"min flux bound greater than max in {rxn.id}"
Function validate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def validate(self):
""" Determine if the model is valid
* Network of compartments is rooted and acyclic
* Networks of observables and functions are acyclic
- 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 transform
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def transform(filename):
# read
wb = openpyxl.load_workbook(filename=filename)
for ws in wb:
- 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 cell.value and isinstance(cell.value, str):
cell.value = '!' + cell.value
else:
Function get_immediate_children
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_immediate_children(self, kind=None, __type=None, __include_stop_conditions=True,
Function parse_units
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def parse_units(cls, sbml_model):
""" Parse SBML units to Python
Args:
sbml_model (:obj:`libsbml.Model`): SBML model
- 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 7 (exceeds 5 allowed). Consider refactoring. Open
def run(cls, model):
""" Encode a `wc_lang` model with at most 1 submodel into SBML
* Validate model
* Create SBML document
- 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 validate_implicit_relationships
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def validate_implicit_relationships(cls, root_model):
""" Check that relationships to :obj:`root_model` do not need to be explicitly exported because
they can be inferred by :obj:`Reader.run`. This is necessary to enable the relationships
to :obj:`root_model` to not be exported in workbooks, and instead added by :obj:`Reader.run`.
- 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 import_relations_from_sbml
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def import_relations_from_sbml(self, sbml, objs):
""" Load relationships from SBML compartment
Args:
sbml (:obj:`libsbml.Compartment`): SBML compartment
- 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 7 (exceeds 5 allowed). Consider refactoring. Open
def __getitem__(cls, name):
""" Get value by name
Args:
name (:obj:`str`): attribute name
- 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_species
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_species(self, __type=None, **kwargs):
""" Get species
Args:
__type (:obj:`types.TypeType` or :obj:`tuple` of :obj:`types.TypeType`): subclass(es) of :obj:`Model`
- 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 validate
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def validate(self):
""" Check that the compartment is valid
* Check that the units of density are `g l^-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 gbl_part
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def gbl_part(self, *args):
coeff = 1.
for arg in args:
if arg.type == 'SPECIES_COEFFICIENT__SPECIES__SPECIES_TYPE__ID':
if arg.value not in self.objects.get(SpeciesType, {}):
- 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 validate
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def validate(self):
""" Determine if the submodel is valid
* dFBA submodel has an objective
- 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 _serialize
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _serialize(species, coefficient, show_compartment=True, show_coefficient_sign=True):
""" Serialize values
Args:
species (:obj:`Species`): species
- 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"