Showing 108 of 164 total issues
Function model
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def model(self, inp):
def fft_model(inp):
if self.INPUT_ORDERING == 'natural':
offset = self.LOCAL_FFT_SIZE // 2
twiddles = [W(i, self.LOCAL_FFT_SIZE) for i in range(offset)]
- 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_ghdl_cocotb
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def run_ghdl_cocotb(*inputs, converter=None, netlist=None, verbose=False):
""" RTL simulator with GHDL and COCOTB. This requires that MODEL and PYHA simulations already ran.
Inputs to the simulator are 'pipeline compensated' from PYHA simulation.
"""
indata = []
- 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 auto_resize
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def auto_resize(target, value):
if not AutoResize.is_enabled() or not isinstance(target, (Sfix, Complex)) or Sfix._float_mode.enabled:
return value
if target.bits is not None:
right = value.right
- 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 __init__
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, val=0.0, left=None, right=None, overflow_style='wrap',
round_style='truncate', init_only=False, wrap_is_ok=False, signed=True, bits=None, size_res=None, upper_bits=None):
self.upper_bits = upper_bits
self.bits = bits
- 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 convert_input_types
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def convert_input_types(args, to_types=None, silence=False):
if not silence:
logger.info(f'Converting simulation inputs to hardware types...')
def convert_arg(default_type, arg, i):
- 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 transform_unroll_local_constructor
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def transform_unroll_local_constructor(red_node):
assigns = red_node.find_all('assign')
for node in assigns:
call = node.value.call
if call is None: # has no function call
- 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 update_input_types
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def update_input_types(self, args, kwargs):
if self.arg_types is None:
self.arg_types = list(args)
else:
for i, v in enumerate(args):
- 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 __deepcopy__
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def __deepcopy__(self, memo):
cls = self.__class__
result = cls.__new__(cls)
memo[id(self)] = result
- 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 get_sorted_traces
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def get_sorted_traces(cls):
class Tmp:
def __init__(self, data_model, data_pyha, label, time):
self.type = type
self.data_model = data_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 __init__
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, red_node, parent=None):
self.red_node = red_node
self.parent = parent
self.target = None
self.value = None
- 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 _pyha_floats_to_fixed
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def _pyha_floats_to_fixed(self, silence=False):
""" Go over the datamodel and convert floats to sfix, this is done before RTL/GATE simulation """
from pyha.common.complex import default_complex
# update atoms
for k, v in self.__dict__.items():
- 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 _pyha_floats_to_fixed
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def _pyha_floats_to_fixed(self, silence=False):
""" Go over the datamodel and convert floats to sfix, this is done before RTL/GATE simulation """
from pyha.common.complex import default_complex
if hasattr(self.data[0], '_pyha_update_registers'): # is submodule
for x in self.data:
- 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 __log_none_bounds
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def __log_none_bounds(self):
def get_full_var_name():
ret = []
node = self
- 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 __log_none_bounds
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def __log_none_bounds(self):
def get_full_var_name():
ret = []
node = self
- 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 get_objects_rednode
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def get_objects_rednode(obj):
"""
Returns the RedBaron node for the class instance.
This mocks the inspect module to improve the code search resolution (in general inspect finds all the classes from file that match the name and just returns the first)
- 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 __init__
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, val=0.0, left=None, right=None, overflow_style='wrap',
Function __init__
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, val=0.0 + 0.0j, left=0, right=-17, overflow_style='wrap', round_style='truncate',
Function np_to_py
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def np_to_py(array):
""" Convert numpy to python recursively.
For example float32 to float and ndarray to []
"""
# https://github.com/numpy/numpy/issues/8052
- 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 _pyha_enable_function_profiling_for_types
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _pyha_enable_function_profiling_for_types(self):
for k, v in self.__dict__.items():
if k == '_pyha_initial_self':
continue
if hasattr(v, '_pyha_update_registers'):
- 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 __str__
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def __str__(self):
# test if we are dealing with array appending ([a] + b)
if self.value == '+':
if isinstance(self.first, ListNodeVHDL) or isinstance(self.second, ListNodeVHDL):
- 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"