File buffers.py
has 825 lines of code (exceeds 400 allowed). Consider refactoring. Open
from typing import Any, Optional, Union, TYPE_CHECKING, Generic, TypeVar
from collections.abc import Iterable
from typing_extensions import Literal
import mmap
import math
Function get_view_for_frame
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def get_view_for_frame(self, partition, tile, frame_idx):
"""
get a view for a single frame in a partition- or dataset-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 _shape_for_kind
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def _shape_for_kind(self, kind, orig_shape, roi_count=None):
"""
:meta private:
"""
if self._kind == "nav":
- 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
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 flush
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def flush(self, debug=False):
'''
Write back any cached contiguous copies
.. versionadded:: 0.5.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 data
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def data(self):
"""
Get the buffer contents in shape that corresponds to the
original dataset shape. If a ROI is set, embed the result into a new
array; unset values have NaN value for floating point types,
- 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
Error: invalid syntax (<unknown>, line 19)</unknown> Open
while batch := tuple(itertools.islice(it, n)):
- Read upRead up
- Exclude checks
We encountered an error attempting to analyze this line.