pygae/galgebra

View on GitHub

Showing 281 of 843 total issues

Function ReciprocalFrame has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def ReciprocalFrame(self, basis: Sequence[_mv.Mv], mode: str = 'norm') -> Tuple[_mv.Mv, ...]:
        r"""
        Compute the reciprocal frame :math:`v^i` of a set of vectors :math:`v_i`.

        Parameters
Severity: Minor
Found in galgebra/ga.py - About 1 hr 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"

Further reading

Function split_multivector has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def split_multivector(self, A: _MaybeMv) -> Tuple[Union[Expr, int], Union[Expr, int]]:
        """
        Split multivector :math:`A` into commutative part :math:`a` and
        non-commutative part :math:`A'` so that :math:`A = a+A'`
        """
Severity: Minor
Found in galgebra/ga.py - About 1 hr 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"

Further reading

Function remove_scalar_part has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def remove_scalar_part(self, A: _MaybeMv) -> Union[Expr, int]:
        """
        Return non-commutative part (sympy object) of ``A.obj``.
        """
        if isinstance(A, mv.Mv):
Severity: Minor
Found in galgebra/ga.py - About 1 hr 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"

Further reading

Function g_inv has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def g_inv(self) -> Matrix:
        """ inverse of metric tensor, g^{ij} """
        g_inv = eye(self.n)

        for i in self.n_range:
Severity: Minor
Found in galgebra/ga.py - About 1 hr 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"

Further reading

Function blade_coefs has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def blade_coefs(self, blade_lst: List['Mv'] = None) -> List[Expr]:
        """
        For a multivector, A, and a list of basis blades, blade_lst return
        a list (sympy expressions) of the coefficients of each basis blade
        in blade_lst
Severity: Minor
Found in galgebra/mv.py - About 1 hr 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"

Further reading

Function er_blade has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def er_blade(self, er, blade, mode='*', left=True):
        r"""
        Product (``*``, ``^``, ``|``, ``<``, ``>``) of reciprocal basis vector
        'er' and basis
        blade 'blade' needed for application of derivatives to
Severity: Minor
Found in galgebra/ga.py - About 1 hr 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"

Further reading

Function nc_subs has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

def nc_subs(expr, base_keys, base_values=None):
    """
    See if expr contains nc (non-commutative) keys in base_keys and substitute corresponding
    value in base_values for nc key.  This was written since standard
    sympy subs was very slow in performing this operation for non-commutative
Severity: Minor
Found in galgebra/ga.py - About 1 hr 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"

Further reading

Function _update_de_from_rbasis has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def _update_de_from_rbasis(self):
        # Replace reciprocal basis vectors with expansion in terms of
        # basis vectors in derivatives of basis vectors.
        de = self.de
        if de is not None:
Severity: Minor
Found in galgebra/ga.py - About 1 hr 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"

Further reading

Function mv has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def mv(self, root=None, *args, **kwargs) -> Union[_mv.Mv, Tuple[_mv.Mv, ...]]:
        """
        Instanciate and return a multivector for this, 'self',
        geometric algebra.
        """
Severity: Minor
Found in galgebra/ga.py - About 1 hr 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"

Further reading

Function _add_paren has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def _add_paren(line, re_exprs):
    paren_flg = False
    if (line[0] == '(') and (line[-1] == ')'):
        paren_flg = True
        line = line[1:-1]
Severity: Minor
Found in galgebra/_utils/parser.py - About 1 hr 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"

Further reading

Function __init__ has 10 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __init__(
Severity: Major
Found in galgebra/metric.py - About 1 hr to fix

    Function dot_orthogonal has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def dot_orthogonal(V1, V2, g=None):
            """
            Returns the dot product of two vectors in an orthogonal coordinate
            system.  V1 and V2 are lists of sympy expressions.  g is
            a list of constants that gives the signature of the vector space to
    Severity: Minor
    Found in galgebra/metric.py - About 1 hr 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"

    Further reading

    Function printeigen has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def printeigen(M):    # Print eigenvalues, multiplicities, eigenvectors of M.
        evects = M.eigenvects()
        for i in range(len(evects)):                   # i iterates over eigenvalues
            print(('Eigenvalue =', evects[i][0], '  Multiplicity =', evects[i][1], ' Eigenvectors:'))
            for j in range(len(evects[i][2])):         # j iterates over eigenvectors of a given eigenvalue
    Severity: Minor
    Found in galgebra/mv.py - About 1 hr 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"

    Further reading

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

        def _sympystr(self, print_obj):
            if len(self.terms) == 0:
                return ZERO_STR
    
            self = self._with_sorted_terms()
    Severity: Minor
    Found in galgebra/dop.py - About 1 hr 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"

    Further reading

    Function __mul__ has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def __mul__(self, LT):
    
            if isinstance(LT, Lt):
    
                if self.Ga != LT.Ga:
    Severity: Minor
    Found in galgebra/lt.py - About 1 hr 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"

    Further reading

    Function __init__ has 8 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(self, __u, __coords, *, ga, norm=False, name=None, root='e', debug=False):
    Severity: Major
    Found in galgebra/ga.py - About 1 hr to fix

      Consider simplifying this complex logical expression.
      Open

              if expr.exp.is_Rational and abs(expr.exp.p) == 1 and expr.exp.q != 1:
                  #base = self._print(expr.base)
                  expq = expr.exp.q
      
                  if expq == 2:
      Severity: Major
      Found in galgebra/printer.py - About 1 hr to fix

        Function xpdf has 8 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def xpdf(filename=None, paper=(14, 11), crop=False, png=False, prog=False, debug=False, pt='10pt', pdfprog='pdflatex'):
        Severity: Major
        Found in galgebra/printer.py - About 1 hr to fix

          Function collect has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              def collect(self, deep=False) -> 'Mv':
                  """
                  group coeffients of blades of multivector
                  so there is only one coefficient per grade
                  """
          Severity: Minor
          Found in galgebra/mv.py - About 55 mins 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"

          Further reading

          Function is_blade has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              def is_blade(self) -> bool:
                  """
                  True is self is blade, otherwise False
                  sets self.blade_flg and returns value
                  """
          Severity: Minor
          Found in galgebra/mv.py - About 55 mins 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"

          Further reading

          Severity
          Category
          Status
          Source
          Language