pygae/galgebra

View on GitHub

Showing 155 of 899 total issues

Function square_root_of_expr has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

def square_root_of_expr(expr, hint='0'):
    """
    If expression is product of even powers then every power is divided by two
    and the absolute value of product is returned.
    If some terms in product are not even powers the sqrt of the absolute value of
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 run has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    def run(self):
        """Include a file as part of the content of this reST file."""

        # copied from docutils.parsers.rst.directives.misc.Include
        if not self.state.document.settings.file_insertion_enabled:
Severity: Minor
Found in doc/_sphinxext/md_include.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 even_odd has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    def even_odd(self, A: Expr, even: bool = True) -> Expr:  # Return even or odd part of A
        A = expand(A)
        if A.is_commutative and even:
            return A
        if isinstance(A, Add):
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 scalar_part has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def scalar_part(self, A: _MaybeMv) -> Union[Expr, int]:

        if isinstance(A, mv.Mv):
            return self.scalar_part(A.obj)
        else:
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 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 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 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 gxpdf has 12 arguments (exceeds 4 allowed). Consider refactoring.
Open

def gxpdf(filename=None, paper=(14, 11), crop=False, png=False, prog=False, debug=False, pt='10pt', pdfprog='pdflatex', evince=True, rm=True, null=True, documentclass='book'):
Severity: Major
Found in galgebra/gprinter.py - About 1 hr to fix

    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 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 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 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 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 _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 __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 _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 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 __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 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 _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

      Severity
      Category
      Status
      Source
      Language