Showing 37 of 37 total issues
File ast.py
has 1565 lines of code (exceeds 250 allowed). Consider refactoring. Open
from __future__ import annotations
import re
from dataclasses import MISSING, dataclass, field, fields
from fractions import Fraction
Function parse_data_markdown
has a Cognitive Complexity of 140 (exceeds 5 allowed). Consider refactoring. Open
def parse_data_markdown(
str_array: np.ndarray[np.str_],
fancy_table: bool = False,
ica_cell_pat=re.compile(r'^(\([0-9, ]+\))?({[^{}]*})?$'),
fancy_table_pat=re.compile(r'^({[^{}]*})?? ?(---|===|___)? ?({[^{}]*})?$'),
- 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 simplify
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
def simplify(self):
'''Reduced equivalent attrs to simplest form
e.g. from PanTableStr to PanCodeBlock should uses this
'''
- 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 normalize
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
def normalize(self, shape: Tuple[int, int]):
'''normalize
assume the types are correct. Normalize what's beyond type-correctness.
- 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_str_array
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
def to_str_array(self, fancy_table: bool = False) -> np.ndarray[np.str_]:
'''construct a table with both content and ica together
'''
# prepend a column if fancy-table
offset = int(fancy_table)
- 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_width
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
def auto_width(
self,
override_width: bool = False,
cell_width_func: Optional[Callable[[str], int]] = cell_width_func,
):
- 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
PanTableAbstract
has 25 functions (exceeds 20 allowed). Consider refactoring. Open
class PanTableAbstract:
'''an abstract class of PanTables
'''
cells: Union[TableArray, np.ndarray[Union[ListContainer, str]]]
Function put
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def put(
self,
content: Union[ListContainer, str],
row_span: int,
col_span: int,
- 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_pantable
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def to_pantable(self) -> PanTable:
'''return a PanTable representation of self
'''
# * 1st pass: assemble the caches
cache_texts: Dict[Union[str, Tuple[str, int], Tuple[str, int, int]], str] = {}
- 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 __post_init__
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def __post_init__(self):
'''fall back to default if invalid type
Only check for type here. e.g. positivity of width and table_width are not checked at this point.
'''
- 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_pantablemarkdown
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def to_pantablemarkdown(self) -> PanTableMarkdown:
'''return a PanTableMarkdown representation of self
'''
# * 1st pass: assemble the caches
cache_elems: Dict[Union[str, Tuple[str, int], Tuple[str, int, int]], ListContainer] = {}
- 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 load_csv
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def load_csv(
data: str,
options: PanTableOption,
) -> List[List[str]]:
'''loading CSV table
- 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 stringified
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def stringified(self, width: int = 15, cannonical=True) -> TableArray:
'''return stringified TableArray
:param int width: width per column
'''
- 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 __post_init__
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def __post_init__(self):
super().__post_init__()
shape = self.shape
m, n = 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 iter_convert_texts_panflute_to_markdown
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def iter_convert_texts_panflute_to_markdown(
elems: Iterable[ListContainer],
extra_args: Optional[List[str]] = None,
seperator: str = np.random.randint(65, 91, size=256, dtype=np.uint8).view('S256')[0].decode(),
) -> Iterator[str]:
- 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 _find_type_origin
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _find_type_origin(type_hint: Any) -> Generator[Any, None, None]:
if isinstance(type_hint, _SpecialForm):
# case of Any, ClassVar, Final, Literal,
# NoReturn, Optional, or Union without parameters
yield 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 from_panflute_ast
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def from_panflute_ast(cls, table: Table) -> PanTable:
ica_table = Ica(
table.identifier,
table.classes,
table.attributes,
Function _find_type_origin
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def _find_type_origin(type_hint: Any) -> Generator[Any, None, None]:
if isinstance(type_hint, _SpecialForm):
# case of Any, ClassVar, Final, Literal,
# NoReturn, Optional, or Union without parameters
yield 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 to_pantable
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def to_pantable(self) -> PanTable:
'''return a PanTable representation of self
'''
# * 1st pass: assemble the caches
cache_texts: Dict[Union[str, Tuple[str, int], Tuple[str, int, int]], str] = {}
Avoid deeply nested control flow statements. Open
if ica_row:
icas_row[i] = f'[]{ica_row}'
else: