src/torchio/transforms/transform.py
File transform.py
has 510 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import copy
import numbers
import warnings
from abc import ABC
from abc import abstractmethod
Function __call__
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
Open
def __call__(
self,
data: TypeTransformInput,
) -> TypeTransformInput:
"""Transform data and return a result of the same type.
- 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 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def __init__(
Function parse_params
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def parse_params(self, params, around, name, make_ranges=True, **kwargs):
params = to_tuple(params)
# d or (a, b)
if len(params) == 1 or (len(params) == 2 and make_ranges):
params *= 3 # (d, d, d) or (a, b, a, b, a, b)
- 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_mask_from_masking_method
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def get_mask_from_masking_method(
Function parse_params
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def parse_params(self, params, around, name, make_ranges=True, **kwargs):
Function _parse_range
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def _parse_range(