# pygae/galgebra

### Showing 836 of 836 total issues

#### File `ga.py` has 1838 lines of code (exceeds 250 allowed). Consider refactoring. Open

``````"""
Geometric Algebra (inherits Metric)
"""
import warnings
import operator``````
Found in galgebra/ga.py - About 5 days to fix

#### File `mv.py` has 1630 lines of code (exceeds 250 allowed). Consider refactoring. Open

``````"""
Multivector and Linear Multivector Differential Operator
"""

import copy``````
Found in galgebra/mv.py - About 4 days to fix

#### File `printer.py` has 950 lines of code (exceeds 250 allowed). Consider refactoring. Open

``````r"""
ANSI Enhanced Text Printing, Text Printer and LaTeX Printer for all Geometric Algebra classes

:math:`\LaTeX` printing
-----------------------``````
Found in galgebra/printer.py - About 2 days to fix

#### `Ga` has 112 functions (exceeds 20 allowed). Consider refactoring. Open

``````class Ga(metric.Metric):
r"""
The vector space (basis, metric, derivatives of basis vectors) is
defined by the base class :class:`~galgebra.metric.Metric`.

``````
Found in galgebra/ga.py - About 2 days to fix

#### File `lt.py` has 759 lines of code (exceeds 250 allowed). Consider refactoring. Open

``````"""
Multivector Linear Transformation
"""

import inspect``````
Found in galgebra/lt.py - About 1 day to fix

#### `Mv` has 80 functions (exceeds 20 allowed). Consider refactoring. Open

``````class Mv(printer.GaPrintable):
"""
Wrapper class for multivector objects (``self.obj``) so that it is easy
to overload operators (``*``, ``^``, ``|``, ``<``, ``>``)  for the various
multivector products and for printing.``````
Found in galgebra/mv.py - About 1 day to fix

#### File `metric.py` has 662 lines of code (exceeds 250 allowed). Consider refactoring. Open

``````"""
Metric Tensor and Derivatives of Basis Vectors.
"""

import copy``````
Found in galgebra/metric.py - About 1 day to fix

#### Function `_print_Function` has a Cognitive Complexity of 70 (exceeds 5 allowed). Consider refactoring. Open

``````    def _print_Function(self, expr, exp=None):

func = expr.func.__name__
name = func
if hasattr(self, '_print_' + func):``````
Found in galgebra/printer.py - About 1 day to fix

# 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"

#### Function `Symbolic_Matrix` has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring. Open

``````def Symbolic_Matrix(root, coords=None, mode='g', f=False, sub=True):
if sub:
pos = '_'
else:
pos = '__'``````
Found in galgebra/lt.py - About 1 day to fix

# 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"

#### Function `_latex` has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring. Open

``````    def _latex(self, print_obj: _LatexPrinter) -> str:

if self.obj == S.Zero:
return ZERO_STR

``````
Found in galgebra/mv.py - About 1 day to fix

# 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"

#### Function `__init__` has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring. Open

``````    def __init__(
self, basis, *,
g=None,
coords=None,
X=None,``````
Found in galgebra/metric.py - About 1 day to fix

# 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"

#### Function `_parse_paren` has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring. Open

``````def _parse_paren(line):
global _parse_paren_calls
_parse_paren_calls += 1

if ('(' not in line) or (')' not in line):``````
Found in galgebra/_utils/parser.py - About 1 day to fix

# 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"

#### Cyclomatic complexity is too high in method __init__. (41) Open

``````    def __init__(
self, basis, *,
g=None,
coords=None,
X=None,``````

## Cyclomatic Complexity

Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

Construct Effect on CC Reasoning
if +1 An if statement is a single decision.
elif +1 The elif statement adds another decision.
else +0 The else statement does not cause a new decision. The decision is at the if.
for +1 There is a decision at the start of the loop.
while +1 There is a decision at the while statement.
except +1 Each except branch adds a new conditional path of execution.
finally +0 The finally block is unconditionally executed.
with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
assert +1 The assert statement internally roughly equals a conditional statement.
Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

#### Function `_latex` has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring. Open

``````    def _latex(self, print_obj: _LatexPrinter) -> str:
if len(self.terms) == 0:
return ZERO_STR

self.consolidate_coefs()``````
Found in galgebra/mv.py - About 7 hrs to fix

# 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"

#### Function `_sympystr` has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring. Open

``````    def _sympystr(self, print_obj: printer.GaPrinter) -> str:

# note: this just replaces `self` for the rest of this function
obj = expand(self.obj)
obj = metric.Simp.apply(obj)``````
Found in galgebra/mv.py - About 7 hrs to fix

# 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"

#### Function `grad_sqr` has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring. Open

``````    def grad_sqr(self, A, grad_sqr_mode, mode, left):
r"""
where ``grad_sqr_mode`` = :math:`*_{1}` = ``*``, ``^``, or ``|`` and
``mode`` = :math:`*_{2}` = ``*``, ``^``, or ``|``.``````
Found in galgebra/ga.py - About 6 hrs to fix

# 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"

#### Cyclomatic complexity is too high in method _print_Function. (30) Open

``````    def _print_Function(self, expr, exp=None):

func = expr.func.__name__
name = func
if hasattr(self, '_print_' + func):``````

## Cyclomatic Complexity

Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

Construct Effect on CC Reasoning
if +1 An if statement is a single decision.
elif +1 The elif statement adds another decision.
else +0 The else statement does not cause a new decision. The decision is at the if.
for +1 There is a decision at the start of the loop.
while +1 There is a decision at the while statement.
except +1 Each except branch adds a new conditional path of execution.
finally +0 The finally block is unconditionally executed.
with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
assert +1 The assert statement internally roughly equals a conditional statement.
Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

#### Function `_print_Pow` has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open

``````    def _print_Pow(self, expr):
base = self._print(expr.base)
if ('_' in base or '^' in base) and 'cdot' not in base:
mode = True
else:``````
Found in galgebra/printer.py - About 5 hrs to fix

# 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"

#### Cyclomatic complexity is too high in method _latex. (28) Open

``````    def _latex(self, print_obj: _LatexPrinter) -> str:

if self.obj == S.Zero:
return ZERO_STR

``````

## Cyclomatic Complexity

Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

Construct Effect on CC Reasoning
if +1 An if statement is a single decision.
elif +1 The elif statement adds another decision.
else +0 The else statement does not cause a new decision. The decision is at the if.
for +1 There is a decision at the start of the loop.
while +1 There is a decision at the while statement.
except +1 Each except branch adds a new conditional path of execution.
finally +0 The finally block is unconditionally executed.
with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
assert +1 The assert statement internally roughly equals a conditional statement.
Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

#### Function `__init__` has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open

``````    def __init__(self, *args, ga, f=False, mode='g'):
"""
__init__(self, *args, ga, **kwargs)

Note this constructor is overloaded, based on the type of the``````
Found in galgebra/lt.py - About 5 hrs to fix

# 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"