File initalize_model.py
has 318 lines of code (exceeds 250 allowed). Consider refactoring. Open
""" Initalize the construction of wc_lang-encoded models from wc_kb-encoded knowledge base.
:Author: Balazs Szigeti <balazs.szigeti@mssm.edu>
:Date: 2018-01-21
:Copyright: 2018, Karr Lab
Function gen_kb_rate_laws
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def gen_kb_rate_laws(self):
""" Generate rate laws for reactions encoded in KB """
kb = self.knowledge_base
model = self.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 gen_species_type
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def gen_species_type(self, kb_species_type, extra_compartment_ids=None):
""" Generate a model species type
Args:
kb_species_type (:obj:`wc_kb.SpeciesType`): knowledge base species 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 run
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def run(self):
self.gen_compartments()
self.gen_parameters()
self.clean_and_validate_options()
- 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 gen_kb_reactions
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def gen_kb_reactions(self):
""" Generate reactions encoded within KB
TODO: rxn.submodel attribute is removed from KB, so submodel assignement needs to be taken care of here.
Since all rxns explicitly encoded in KB are metabolic ones, it is manually set to be metablism atm, but
not more sophisticated approach
- 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"