KarrLab/wc_sim

View on GitHub
wc_sim/run_results.py

Summary

Maintainability
C
1 day
Test Coverage
A
100%

File run_results.py has 386 lines of code (exceeds 250 allowed). Consider refactoring.
Open

""" Store and retrieve combined results of a multialgorithmic simulation run

:Author: Arthur Goldberg <Arthur.Goldberg@mssm.edu>
:Author: Jonathan Karr <karr@mssm.edu>
:Date: 2018-05-20
Severity: Minor
Found in wc_sim/run_results.py - About 5 hrs to fix

    Function semantically_equal has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def semantically_equal(self, other, debug=False):
            """ Are the predictions and metadata in two :obj:`RunResults` objects semantically equal?
    
            Uses `numpy.allclose()` to compare predictions.
            Uses `semantically_equal` to ignore semantically insignificant metadata, such as the timestamp of a simulation's
    Severity: Minor
    Found in wc_sim/run_results.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 convert_checkpoints has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def convert_checkpoints(self):
            """ Convert the data in saved checkpoints into pandas dataframes for loading into hdf
    
            Returns:
                :obj:`tuple` of pandas objects: dataframes of the components of a simulation checkpoint history
    Severity: Minor
    Found in wc_sim/run_results.py - About 1 hr to fix

      Function convert_metadata has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def convert_metadata(self, metadata_class):
              """ Convert the saved simulation metadata into HDF5 attributes on a `metadata` Group
      
              Args:
                  metadata_class (:obj:`EnhancedDataClass`): the class that stored the metadata
      Severity: Minor
      Found in wc_sim/run_results.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_concentrations has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_concentrations(self, compartment_id=None):
              """ Get species concentrations at checkpoint times
      
              Args:
                  compartment_id (:obj:`str`, optional): if provided, obtain concentrations for species in
      Severity: Minor
      Found in wc_sim/run_results.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 dataframes_are_close has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def dataframes_are_close(df1, df2, rtol=None, atol=None):
           """ Indicate whether two Pandas DataFrames that contain floats are almost equal
      
           Args:
               df1 (:obj:`pandas.DataFrame`): one DataFrame
      Severity: Minor
      Found in wc_sim/run_results.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 convert_checkpoints has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def convert_checkpoints(self):
              """ Convert the data in saved checkpoints into pandas dataframes for loading into hdf
      
              Returns:
                  :obj:`tuple` of pandas objects: dataframes of the components of a simulation checkpoint history
      Severity: Minor
      Found in wc_sim/run_results.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