KarrLab/wc_lang

View on GitHub
wc_lang/core.py

Summary

Maintainability
F
2 wks
Test Coverage
A
99%

File core.py has 4288 lines of code (exceeds 250 allowed). Consider refactoring.
Open

""" Data model to represent composite, multi-algorithmic biochemical models.

This module defines classes that represent the schema and provenance of a biochemical model:

* :obj:`Model`
Severity: Major
Found in wc_lang/core.py - About 1 wk to fix

    Function validate has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
    Open

        def validate(self, obj, value, tolerance=1E-10):
            """ Determine if `value` is a valid value of the attribute
    
            Args:
                obj (:obj:`Reaction`): object being validated
    Severity: Minor
    Found in wc_lang/core.py - About 5 hrs to fix

    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_products has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_products(self, __type=None, **kwargs):
            """ Get the species produced by this objective function
    
            Args:
                __type (:obj:`types.TypeType` or :obj:`tuple` of :obj:`types.TypeType`): subclass(es) of :obj:`Model`
    Severity: Minor
    Found in wc_lang/core.py - About 4 hrs to fix

    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

    Model has 31 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Model(obj_tables.Model, SbmlModelMixin):
        """ Model
    
        Attributes:
            id (:obj:`str`): unique identifier
    Severity: Minor
    Found in wc_lang/core.py - About 3 hrs to fix

      Function _get_cyclic_deps has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

          def _get_cyclic_deps(self):
              """ Verify that the networks of depencencies for observables and functions are acyclic
      
              Returns:
                  :obj:`dict`: dictionary of dictionary of lists of objects with cyclic dependencies,
      Severity: Minor
      Found in wc_lang/core.py - About 3 hrs to fix

      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 22 (exceeds 5 allowed). Consider refactoring.
      Open

          def validate(self):
              """ Check that the structure is valid
      
              * Format provided when structure is not None
              * Value provided when format is not None
      Severity: Minor
      Found in wc_lang/core.py - About 3 hrs to fix

      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 22 (exceeds 5 allowed). Consider refactoring.
      Open

          def import_from_sbml(self, sbml_rxn):
              """ Load from SBML reaction
      
              Args:
                  sbml (:obj:`libsbml.Reaction`): SBML reaction
      Severity: Minor
      Found in wc_lang/core.py - About 3 hrs to fix

      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 has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

              def gbl(self, *args):
                  parts = []
                  for arg in args:
                      if isinstance(arg, lark.lexer.Token) and \
                              arg.type == 'SPECIES_COEFFICIENT__SPECIES__COMPARTMENT__ID':
      Severity: Minor
      Found in wc_lang/core.py - About 2 hrs to fix

      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 19 (exceeds 5 allowed). Consider refactoring.
      Open

          def validate(self):
              """ Determine whether this `RateLaw` is valid
      
              * Check if identifier equal to `{reaction.id}-{direction.name}`
      
      
      Severity: Minor
      Found in wc_lang/core.py - About 2 hrs to fix

      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 19 (exceeds 5 allowed). Consider refactoring.
      Open

          def validate(self):
              """ Check if the reaction is valid
      
              * If the submodel is ODE or SSA, check that the reaction has a forward rate law
              * If the submodel is ODE or SSA and the reaction is reversible, check that the reaction has a
      Severity: Minor
      Found in wc_lang/core.py - About 2 hrs to fix

      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_immediate_children has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_immediate_children(self, kind=None, __type=None, __include_stop_conditions=True,
                                     **kwargs):
              """ Get a kind of children.
      
              If :obj:`kind` is :obj:`None`, children are defined to be the values of the related attributes defined
      Severity: Minor
      Found in wc_lang/core.py - About 2 hrs to fix

      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_children has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_children(self, kind=None, __type=None, recursive=True, __include_stop_conditions=True,
                           **kwargs):
              """ Get a kind of children.
      
              If :obj:`kind` is :obj:`None`, children are defined to be the values of the related attributes defined
      Severity: Minor
      Found in wc_lang/core.py - About 1 hr to fix

      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 evidence has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

              def evidence(self, *args):
                  kwargs = {}
                  for arg in args:
                      if isinstance(arg, lark.lexer.Token):
                          cls_name, _, attr_name = arg.type.partition('__')
      Severity: Minor
      Found in wc_lang/core.py - About 1 hr to fix

      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 14 (exceeds 5 allowed). Consider refactoring.
      Open

          def validate(self):
              """ Check that the stop condition is valid
      
              * Check that `expression` has units `units`
      
      
      Severity: Minor
      Found in wc_lang/core.py - About 1 hr to fix

      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 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def validate(self):
              """ Check that the Function is valid
      
              * Check that `expression` has units `units`
      
      
      Severity: Minor
      Found in wc_lang/core.py - About 1 hr to fix

      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 lcl_part has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

              def lcl_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, {}):
      Severity: Minor
      Found in wc_lang/core.py - About 1 hr to fix

      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 export_to_sbml has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def export_to_sbml(self, sbml_model):
              """ Add this reaction to a SBML model.
      
              Args:
                  sbml_model (:obj:`libsbml.Model`): SBML model
      Severity: Minor
      Found in wc_lang/core.py - About 1 hr to fix

      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_sub_compartments has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_sub_compartments(self, nested=False):
              """ Get sub-compartments, optionally including all nested sub-compartments
      
              Returns:
                  :obj:`list` of :obj:`Compartment`: list of sub-compartments
      Severity: Minor
      Found in wc_lang/core.py - About 1 hr to fix

      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 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def serialize(self, participants, encoded=None):
              """ Serialize related object
      
              Args:
                  participants (:obj:`list` of :obj:`SpeciesCoefficient`): Python representation of reaction participants
      Severity: Minor
      Found in wc_lang/core.py - About 1 hr to fix

      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 lcl has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

              def lcl(self, *args):
                  parts = []
                  for arg in args:
                      if isinstance(arg, lark.tree.Tree):
                          if arg.data == 'lcl_reactants':
      Severity: Minor
      Found in wc_lang/core.py - About 1 hr to fix

      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 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def validate(self):
              """ Determine if the dFBA objective expression is valid
      
              * Check that the expression is a linear function
              * Check if expression is a function of at least one reaction or dFBA objective reaction
      Severity: Minor
      Found in wc_lang/core.py - About 1 hr to fix

      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 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def import_relations_from_sbml(self, sbml, objs):
              """ Load relationships from SBML species
      
              Args:
                  sbml (:obj:`libsbml.Species`): SBML species
      Severity: Minor
      Found in wc_lang/core.py - About 1 hr to fix

      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
      Severity: Minor
      Found in wc_lang/core.py - About 55 mins to fix

      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 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
      Severity: Minor
      Found in wc_lang/core.py - About 45 mins to fix

      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_children has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def get_children(self, kind=None, __type=None, recursive=True, __include_stop_conditions=True,
      Severity: Minor
      Found in wc_lang/core.py - About 45 mins to fix

        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}`
        Severity: Minor
        Found in wc_lang/core.py - About 45 mins to fix

        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:
        Severity: Major
        Found in wc_lang/core.py - About 45 mins to fix

          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
          Severity: Minor
          Found in wc_lang/core.py - About 45 mins to fix

          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_immediate_children has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def get_immediate_children(self, kind=None, __type=None, __include_stop_conditions=True,
          Severity: Minor
          Found in wc_lang/core.py - About 35 mins to fix

            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
            Severity: Minor
            Found in wc_lang/core.py - About 35 mins to fix

            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
            Severity: Minor
            Found in wc_lang/core.py - About 35 mins to fix

            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`
            Severity: Minor
            Found in wc_lang/core.py - About 35 mins to fix

            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`
            
            
            Severity: Minor
            Found in wc_lang/core.py - About 35 mins to fix

            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, {}):
            Severity: Minor
            Found in wc_lang/core.py - About 35 mins to fix

            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
            
            
            Severity: Minor
            Found in wc_lang/core.py - About 25 mins to fix

            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
            Severity: Minor
            Found in wc_lang/core.py - About 25 mins to fix

            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 export_to_sbml has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def export_to_sbml(self, sbml_model):
                    """ Add this compartment to a SBML model.
            
                    Args:
                        sbml_model (:obj:`libsbml.Model`): SBML model
            Severity: Minor
            Found in wc_lang/core.py - About 25 mins to fix

            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 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def get(ids, species_iterator):
                    """ Find some Species instances
            
                    Args:
                        ids (:obj:`Iterator` of `str`): an iterator over some species identifiers
            Severity: Minor
            Found in wc_lang/core.py - About 25 mins to fix

            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

            There are no issues that match your filters.

            Category
            Status