Showing 84 of 109 total issues
Function validate_implicit_relationships_are_set
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def validate_implicit_relationships_are_set(self, model, root_model):
""" Check that there is only one instance of :obj:`root_model` and that each relationship to
:obj:`root_model` is set. 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_from_sbml
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def import_from_sbml(self, sbml):
""" Load 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 create_parameter
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_parameter(cls, sbml_model, id, value, units, name=None, constant=True):
Function create_template
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_template(path, write_schema=False, write_toc=True,
Avoid deeply nested control flow statements. Open
if cell.value and isinstance(cell.value, str):
cell.value = '!' + cell.value
Function create_base_unit
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_base_unit(cls, unit_def_id, unit_def, kind, exponent=1, scale=0, multiplier=1.0):
Avoid deeply nested control flow statements. Open
if cls.call_libsbml(g_child.getName) == 'key':
attr_name = cls.call_libsbml(g_child.toXMLString)[12:-13]
elif cls.call_libsbml(g_child.getName) == 'value':
val = cls.call_libsbml(g_child.toXMLString)[14:-15]
Avoid deeply nested control flow statements. Open
for ot_token in parsed_expr._obj_tables_tokens:
if (ot_token.code == ObjTablesTokenCodes.obj_id and
issubclass(ot_token.model_type, Reaction) and
ot_token.model_id == rxn.id):
new_obj_expr_elements.append(f'({rxn_for.id} - {rxn_bck.id})')
Function export_relations_to_sbml
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def export_relations_to_sbml(self, sbml_model, sbml_rxn):
""" Add relationships to/from object to SBML reaction.
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 8 (exceeds 5 allowed). Consider refactoring. Open
def run(self, path, model, models=None, get_related=True, include_all_attributes=False, validate=None,
title=None, description=None, keywords=None, version=None, language=None, creator=None,
write_schema=False, write_toc=True, extra_entries=0, data_repo_metadata=False, schema_package=None,
protected=True):
""" Write a list of model classes to an Excel file, with one worksheet for each model, or to
- 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
for cls_obj in cls_objects:
setattr(cls_obj, attr.name, model)
# validate
config = wc_lang.config.core.get_config()['wc_lang']['io']
Avoid deeply nested control flow statements. Open
if part_back:
rxn_bck.participants.append(part_back)
else:
rxn_bck.participants.create(species=part.species, coefficient=-1 * part.coefficient)
Avoid deeply nested control flow statements. Open
for dfba_obj_rxn in list(submodel.dfba_obj.expression.dfba_obj_reactions):
submodel.dfba_obj.expression.dfba_obj_reactions.remove(dfba_obj_rxn)
objs_for_merged_dfba_expression[DfbaObjReaction][dfba_obj_rxn.id] = dfba_obj_rxn
Function get_children
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_children(self, kind=None, __type=None, recursive=True, __include_stop_conditions=True,
Avoid deeply nested control flow statements. Open
if species.species_type.structure and species.species_type.structure.has_carbon():
flux_bounds = carbon_flux_bounds
else:
flux_bounds = no_carbon_flux_bounds
Function validate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def validate(self):
""" Validate that the dFBA objective is valid
* Check if the identifier is equal to
`dfba-net-species-{dfba_obj_reaction.id}-{species.id}`
- 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 part.species.has_attr_vals(__type=__type, **kwargs):
products.append(part.species)
# products of dFBA objective reactions
for dfba_obj_reaction in self.expression.dfba_obj_reactions:
Avoid deeply nested control flow statements. Open
if hasattr(wc_lang, table_id):
table = getattr(wc_lang, table_id)
table_format = table.Meta.table_format.name
else:
table_format = 'row'
Function get_annotations
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_annotations(cls, model_obj, nested_attr_paths, sbml_obj, model_objs=None):
""" Import annotations from a model object to an SBML object
Args:
model_obj (:obj:`obj_tables.Model`): model 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
Avoid deeply nested control flow statements. Open
if rxn:
assert rxn.submodel == submodel
assert rxn.name == name
assert rxn.participants == participants
assert rxn.reversible == reversible