petspats/pyha

View on GitHub

Showing 108 of 164 total issues

Function assert_sim_match has 9 arguments (exceeds 4 allowed). Consider refactoring.
Open

def assert_sim_match(model, expected, *x, types=None, simulations=None, rtol=1e-04, atol=(2 ** -17) * 4, dir_path=None,
Severity: Major
Found in pyha/simulation/simulation_interface.py - About 1 hr to fix

    Function transform_registers has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def transform_registers(red_node):
        def add_next(x):
            if len(x) > 1 and str(x[0].value) == 'self':
                x[0].replace('self_next')
    
    
    Severity: Minor
    Found in pyha/conversion/redbaron_transforms.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 main has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def main(self, inp):
            if not inp.valid:
                return DataValid(self.out.data, valid=False)
    
            # Stage 1: handle the loopback memory; that sets the INPUT_STRIDE; also fetch the twiddle factor for stage 2
    Severity: Minor
    Found in pyha/cores/fft/fft_core/r2sdf.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 model has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def model(self, input_list):
            from pyha.simulation.tracer import Tracer
            if not Tracer.is_enabled():
                return numpy_model(input_list, self.FFT_SIZE, self.INPUT_ORDERING, self.INVERSE)
            else:
    Severity: Minor
    Found in pyha/cores/fft/fft_core/r2sdf.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 resize has 8 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def resize(fix: Sfix, left=0, right=-17, size_res=None, overflow_style='wrap', round_style='truncate', wrap_is_ok=False,
    Severity: Major
    Found in pyha/common/fixed_point.py - About 1 hr to fix

      Function initial_step has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def initial_step(self, phase, x, y):
              """
              Transform input to the CORDIC working quadrants
              """
              self.x[0] = x
      Severity: Minor
      Found in pyha/cores/cordic/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 _pyha_reset has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def _pyha_reset(self, prefix='self', filter_func=None):
              if filter_func:
                  if not filter_func(self):
                      return ''
              ret = ''
      Severity: Minor
      Found in pyha/conversion/type_transforms.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 transform_fixed_indexing_result_to_bool has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      def transform_fixed_indexing_result_to_bool(red_node):
          """ VHDL indexing of fixed point value returns 'std_logic' type, this casts such assignments to bool() """
      
          nodes = red_node.find_all('atomtrailers')
      
      
      Severity: Minor
      Found in pyha/conversion/redbaron_transforms.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 __str__ has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def __str__(self):
              base = '(' + ', '.join(str(x) for x in self.value) + ')'
      
              # find if this call is part of assignment node or AssociativeParenthesisNode
              p = self.red_node.parent
      Severity: Minor
      Found in pyha/conversion/redbaron_transforms.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 _size_add has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def _size_add(self, other):
              """ Size rules for add/sub operation. Handles the 'None'(lazy) cases. """
              if self.left is None and other.left is None:
                  left = None
              elif self.left is None:
      Severity: Minor
      Found in pyha/common/fixed_point.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 __call__ has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def __call__(self, *args, **kwargs):
              if self.call_time is None:
                  self.call_time = time.time()
      
              res = self.func(*args, **kwargs)
      Severity: Minor
      Found in pyha/simulation/tracer.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 _pyha_insert_tracer has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def _pyha_insert_tracer(self, label=''):
              from pyha.simulation.tracer import Tracer
              for k, v in self.__dict__.items():
                  if k == '_pyha_initial_self':
                      continue
      Severity: Minor
      Found in pyha/common/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 __mul__ has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def __mul__(self, other):
              other = self._convert_other_operand(other)
      
              if self.left is None and other.left is None:
                  left = None
      Severity: Minor
      Found in pyha/common/fixed_point.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 sims_close has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      def sims_close(simulation_results, expected=None, rtol=1e-04, atol=(2 ** -17) * 4, skip_first_n=0):
          """
          TODO: LEGACY
          Compare the results of ``simulate`` function.
      
      
      Severity: Minor
      Found in pyha/simulation/simulation_interface.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 update_output_types has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def update_output_types(self, ret):
              ret = get_iterable(ret)
              if self.output_types is None:
                  if isinstance(ret, tuple):
                      self.outputs_is_tuple = True
      Severity: Minor
      Found in pyha/common/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 simulate has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def simulate(model, *args, simulations=None, conversion_path=None, input_types=None,
      Severity: Major
      Found in pyha/simulation/simulation_interface.py - About 50 mins to fix

        Function resize has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def resize(self, left=0, right=0, type=None, overflow_style='wrap', round_style='truncate', wrap_is_ok=False,
        Severity: Major
        Found in pyha/common/complex.py - About 50 mins to fix

          Function resize has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def resize(self, left=0, right=0, type=None, overflow_style='wrap', round_style='truncate', wrap_is_ok=False,
          Severity: Major
          Found in pyha/common/fixed_point.py - About 50 mins to fix

            Function __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def __init__(self, fft_size, avg_freq_axis=2, avg_time_axis=1, window_type='hanning', fft_twiddle_bits=18,
            Severity: Major
            Found in pyha/cores/fft/spectrogram/spectrogram.py - About 50 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      for i in range(len(x.elems)):
                                          part.replace(f'{name}_{i}')
              
                                          head = 'if' if i == 0 else 'elif'
                                          new += f'{correct_indentation}\t{head} {index} == {i}:\n{correct_indentation}\t\t{line_node}\n'
              Severity: Major
              Found in pyha/conversion/redbaron_transforms.py - About 45 mins to fix
                Severity
                Category
                Status
                Source
                Language