Showing 269 of 913 total issues
Function run_each_partition
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def run_each_partition(self, partitions, fn, all_nodes=False):
"""
Run `fn` for all partitions. Yields results in order of completion.
Parameters
- 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 disjunct_multiplier
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def disjunct_multiplier(excluded, sig_shape, base_shape=1, target=1):
'''
Calculate an integer i close to target which is a multiple of base_shape
and for which i * n not in "excluded" for any n > 0, i * n < sig_shape.
- 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 _parse_header_bytes
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def _parse_header_bytes(header: bytes, filesize: int) -> HeaderDict:
header: str = header.decode(encoding='ascii', errors='ignore')
parts = header.split(",")
header_size_bytes = int(parts[2])
parts = [p
- 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 close
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def close(self, drain: bool = True, force: bool = False):
if not self._closed:
if drain:
while True:
try:
- 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 detect_shape
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def detect_shape(path: str) -> tuple[int, tuple[int, ...]]:
series_header = read_series_header(path)
if series_header.version != 2:
raise DetectionError(
- 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_normal
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def _get_tiles_normal(self, tiling_scheme: TilingScheme, dest_dtype):
with self._get_h5ds() as dataset:
# because the dtype conversion done by HDF5 itself can be quite slow,
# we need to use a buffer for reading in hdf5 native dtype:
data_flat = np.zeros(tiling_scheme.shape, dtype=dataset.dtype).reshape((-1,))
- 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 array_backends
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def array_backends(self) -> Sequence[ArrayBackend]:
"""
All backends can be returned on request
.. versionadded:: 0.11.0
- 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 compoundAnalysisReducer
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const compoundAnalysisReducer = (state = initialCompoundAnalysisState, action: AllActions): CompoundAnalysisReducerState => {
switch (action.type) {
case compoundAnalysisActions.ActionTypes.CREATED: {
const newCompoundAnalysis = {
doAutoStart: action.payload.autoStart,
Function _frms6_read_ranges_tile_block
has 16 arguments (exceeds 8 allowed). Consider refactoring. Open
def _frms6_read_ranges_tile_block(
Function _mib_2x2_tile_block
has 16 arguments (exceeds 8 allowed). Consider refactoring. Open
def _mib_2x2_tile_block(
Function _k2is_read_ranges_tile_block
has 16 arguments (exceeds 8 allowed). Consider refactoring. Open
def _k2is_read_ranges_tile_block(
Function _default_read_ranges_tile_block
has 16 arguments (exceeds 8 allowed). Consider refactoring. Open
def _default_read_ranges_tile_block(
Function _read_block_dense
has 16 arguments (exceeds 8 allowed). Consider refactoring. Open
def _read_block_dense(
Function createOrUpdate
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function* createOrUpdate(
compoundAnalysis: CompoundAnalysisState, analysisId: string | undefined,
analysisIndex: number, details: AnalysisDetails
): Generator<unknown, string, any> {
if (analysisId) {
Function get_resource_details
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def get_resource_details(self):
workers = self.get_available_workers()
details = {}
for worker in workers:
- 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 main
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def main(port, local_directory, browser, cpus, gpus, open_ds, log_level,
insecure, host="localhost", token_path=None, preload: tuple[str, ...] = (),
snooze_timeout: Optional[float] = None):
# Mitigation for https://stackoverflow.com/questions/71283820/
# directory-parameter-on-windows-has-trailing-backslash-replaced-with-double-quote
- 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 _build_sparse
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def _build_sparse(m, dtype: npt.DTypeLike, sparse_backend: SparseSupportedT, backend: ArrayBackend):
if sparse_backend == 'sparse.pydata' and backend == NUMPY:
# sparse.pydata.org is fastest for masks with few layers
# and few entries
return m.astype(dtype)
- 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 12 (exceeds 5 allowed). Consider refactoring. Open
def __init__(
self,
mask_factories: Union[FactoryT, Sequence[FactoryT]],
dtype: Optional[npt.DTypeLike] = None,
use_sparse: Optional[Union[bool, SparseSupportedT]] = 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 build_mapping
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def build_mapping(el: Any,
unpackable_types: dict[type, Callable[[Iterable],
Iterable[tuple[Any, Any]]]] = None,
ignore_types: Optional[tuple[type, ...]] = None,
_pos: list[tuple[type, Any]] = None) -> list[list[tuple[type, Any]]]:
- 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 CenterOfMassAnalysis
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
const CenterOfMassAnalysis: React.FC<CompoundAnalysisProps> = ({ compoundAnalysis, dataset }) => {
const { shape } = dataset.params;
const [scanHeight, scanWidth, imageHeight, imageWidth] = shape;
const minLength = Math.min(imageWidth, imageHeight);
const [cx, setCx] = useState(imageWidth / 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"