File lib_cast.py
has 819 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""
Usage: lib_cast (-h | -v | -i)
-h, --help show help
-v, --version show version
Function cast_float_to_human_readable_size
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def cast_float_to_human_readable_size(value: Union[Decimal, float, int], unit: str = 'Byte', decimals: int = 2,
base1024: bool = False, short_form: bool = False,
remove_trailing_zeros: bool = False, show_exponent: bool = True) -> str:
"""
format numbers into human readable format
- 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 cast_float_2_human_readable_timediff
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def cast_float_2_human_readable_timediff(float_seconds: Union[Decimal, float], language: str = 'de') -> str:
"""
dient dazu Laufzeiten von Programmen gerundet in einem lesbaren Format anzuzeigen
>>> cast_float_2_human_readable_timediff(89452.456898418)
- 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 cast_float_2_human_readable_timediff
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def cast_float_2_human_readable_timediff(float_seconds: Union[Decimal, float], language: str = 'de') -> str:
"""
dient dazu Laufzeiten von Programmen gerundet in einem lesbaren Format anzuzeigen
>>> cast_float_2_human_readable_timediff(89452.456898418)
Function cast_human_readable_size_to_float
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def cast_human_readable_size_to_float(s_human_readable_size: Union[str, int, bool, float]) -> float:
"""
IEC (2^n)
Ki(Kibi 2^10), Mi(Mebi 2^20), Gi(Gibi 2^30) Ti(Tebi 2^40),
Pi(Pebi 2^50), Ei(Exbi 2^60), Zi(Zebi 2^70), Yi(Yobi 2^80)
- 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 cast_float_to_human_readable_size
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def cast_float_to_human_readable_size(value: Union[Decimal, float, int], unit: str = 'Byte', decimals: int = 2,
base1024: bool = False, short_form: bool = False,
remove_trailing_zeros: bool = False, show_exponent: bool = True) -> str:
"""
format numbers into human readable format
Function cast_to_bool
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def cast_to_bool(value: Union[str, int, bool, float, None]) -> bool:
"""
>>> cast_to_bool('')
False
>>> cast_to_bool('j')
- 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 cast_float_to_human_readable_size
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def cast_float_to_human_readable_size(value: Union[Decimal, float, int], unit: str = 'Byte', decimals: int = 2,
Function cast_float_2_string
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def cast_float_2_string(value: Union[Decimal, float],
Function cast_float_2_human_readable_dimension
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def cast_float_2_human_readable_dimension(dimension_in_meters: Union[Decimal, float], language: str = 'de', unit_short: bool = True) -> str:
"""
>>> cast_float_2_human_readable_dimension(dimension_in_meters=Decimal('9876.987654'))
'9.88 km'
>>> cast_float_2_human_readable_dimension(dimension_in_meters=Decimal('876.987654'))
- 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 too many return
statements within this function. Open
return s_dimension
Avoid too many return
statements within this function. Open
return s_dimension
Avoid too many return
statements within this function. Open
return s_weight
Avoid too many return
statements within this function. Open
return s_dimension
Avoid too many return
statements within this function. Open
return s_dimension
Avoid too many return
statements within this function. Open
return False
Function cast_float_2_human_readable_iterations
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def cast_float_2_human_readable_iterations(float_seconds: Union[Decimal, float]) -> str:
"""
>>> cast_float_2_human_readable_iterations(42328.123456789)
'2.04 Iterationen pro Tag'
>>> cast_float_2_human_readable_iterations(3456.123456789)
- 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"