Showing 270 of 903 total issues
Avoid deeply nested control flow statements. Open
with tracer.start_as_current_span("SHUTDOWN"):
queues.request.close()
queues.response.close(drain=False)
queues.message.close(drain=False)
break
Function get_view_for_tile
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_view_for_tile(self, partition, tile):
"""
get a view for a single tile in a partition-sized buffer
(partition-sized here means the reduced result for a whole partition,
not the partition itself!)
- 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 cbed_frame
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def cbed_frame(
fy=128, fx=128, zero=None, a=None, b=None, indices=None,
radius=4, all_equal=False, margin=None):
if zero is None:
zero = (fy//2, fx//2)
- 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 _mib_r24_px_to_bytes
has 10 arguments (exceeds 8 allowed). Consider refactoring. Open
def _mib_r24_px_to_bytes(
Avoid deeply nested control flow statements. Open
if __threadpool_counter == 0:
# The limit is set upon calling ThreadpoolController.limit()
__threadpool_limiter = __threadpool_wrapper(n)
__threadpool_counter += 1
Function _get_np_dtype
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _get_np_dtype(dtype: str, bit_depth: int) -> "nt.DTypeLike":
dtype = dtype.lower()
num_bits = int(dtype[1:])
if dtype[0] == "u":
num_bytes = num_bits // 8
- 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
Avoid deeply nested control flow statements. Open
if found_first_tile:
break
p.set_corrections(corrections)
Function allocate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def allocate(self, lib=None):
"""
Allocate a buffer as a dask array
nav buffer chunking is made identical to the partition structure
- 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_contiguous_view_for_tile
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_contiguous_view_for_tile(self, partition, tile):
'''
Make a cached contiguous copy of the view for a single tile
if necessary.
- 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
Avoid deeply nested control flow statements. Open
if __threadpool_counter == 0 and __threadpool_limiter is not None:
__threadpool_limiter.restore_original_limits()
__threadpool_limiter = None
Avoid deeply nested control flow statements. Open
with tracer.start_as_current_span("WARMUP"):
import libertem.udf.base # NOQA
import libertem.api # NOQA
import libertem.preload # NOQA
with env.enter():
Function radial_bins
has 10 arguments (exceeds 8 allowed). Consider refactoring. Open
def radial_bins(centerX, centerY, imageSizeX, imageSizeY,
Function _compute
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _compute(self, *args, udfs=None, user_backends=None, traverse=True, **kwargs):
"""
Acts as dask.compute(*args, **kwargs) but with knowledge
of Libertem data structures and compute resources
"""
- 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 to_sparse
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def to_sparse(a, shape: Optional[Union['Shape', tuple[int, ...]]] = None):
if isinstance(a, sparse.COO):
return a
elif isinstance(a, sparse.SparseArray):
return sparse.COO(a)
- 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_tiles
has 10 arguments (exceeds 8 allowed). Consider refactoring. Open
def get_tiles(
Avoid deeply nested control flow statements. Open
if tile.dtype != read_dtype or tile.c_contiguous is False:
data = tile.data.astype(read_dtype)
else:
data = tile.data
self.preprocess(data, tile.tile_slice, corrections)
Function get_tiles
has 10 arguments (exceeds 8 allowed). Consider refactoring. Open
def get_tiles(
Function __init__
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, mask_factories, use_torch=True, use_sparse=None, mask_count=None,
mask_dtype=None, preferred_dtype=None, backends=None, shifts=None, **kwargs):
_backends = backends
if backends is 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 _read_bytes
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _read_bytes(fp, size, error_template="ran out of data"):
"""
Read from file-like object until size bytes are read.
Raises ValueError if not EOF is encountered before size bytes are read.
Non-blocking objects only supported if they derive from io objects.
- 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 need_copy
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def need_copy(
self, decoder, roi, native_dtype, read_dtype, tiling_scheme=None, fileset=None,
sync_offset=0, corrections=None,
) -> bool:
# checking conditions in which "straight mmap" is not possible
- 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"