carlculator/timeseriesx

View on GitHub

Showing 10 of 123 total issues

File timestamp_series.py has 414 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import collections
import copy
import datetime as dt
import numbers
import warnings
Severity: Minor
Found in timeseriesx/base/timestamp_series.py - About 5 hrs to fix

    TimestampSeries has 34 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class TimestampSeries(UnitMixin, TimeZoneMixin, FrequencyMixin, BaseTimeSeries):
    
        @staticmethod
        def create_null_timeseries(start, end, freq, unit=None, time_zone='infer'):
            """
    Severity: Minor
    Found in timeseriesx/base/timestamp_series.py - About 4 hrs to fix

      BaseTimeSeries has 29 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class BaseTimeSeries(metaclass=ABCMeta):
      
          # ------------------------------ properties ------------------------------ #
      
          @property
      Severity: Minor
      Found in timeseriesx/base/base_time_series.py - About 3 hrs to fix

        Function map has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def map(self, func, dimensionless=True):
                """
                apply a custom function to each value of the series
        
                :param function func: a function mapping a scalar to another scalar
        Severity: Minor
        Found in timeseriesx/base/timestamp_series.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 convert_unit has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            def convert_unit(self, unit):
                """
                convert the unit of the series
        
                :param str/pint.Unit unit:
        Severity: Minor
        Found in timeseriesx/mixins/unit.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 infer_freq has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

        def infer_freq(series):
            """
            infer the frequency from a pandas Series with `DatetimeIndex`
        
            :param pandas.Series series: a pandas Series with `DatetimeIndex`
        Severity: Minor
        Found in timeseriesx/validation/frequency.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 _validate_unit has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def _validate_unit(self):
                self._unit = coerce_unit(self._unit)
                if isinstance(self._series.dtype, PintType):
                    if self._series.pint.u != self._unit:
                        try:
        Severity: Minor
        Found in timeseriesx/mixins/unit.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 create_constant_timeseries has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def create_constant_timeseries(start, end, value, freq, unit=None,
        Severity: Minor
        Found in timeseriesx/base/timestamp_series.py - About 35 mins to fix

          Function fill_gaps has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def fill_gaps(self, start=None, end=None, value=np.NaN):
                  """
                  fill all gaps between `start` and `end` in a series with a frequency with a
                  constant value
          
          
          Severity: Minor
          Found in timeseriesx/mixins/frequency.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 __eq__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def __eq__(self, other):
                  if not isinstance(other, TimestampSeries):
                      return False
                  self_values = self.values
                  other_values = other.values
          Severity: Minor
          Found in timeseriesx/base/timestamp_series.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

          Severity
          Category
          Status
          Source
          Language