pygae/galgebra

View on GitHub

Showing 157 of 843 total issues

Function diff has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    def diff(self, coord) -> 'Mv':
        if self.Ga.coords is None:
            obj = diff(self.obj, coord)
        elif coord not in self.Ga.coords:
            if self.Ga.par_coords is None:
Severity: Minor
Found in galgebra/mv.py - About 2 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"

Further reading

Function normalize_metric has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    def normalize_metric(self):

        # normalize derivatives
        if self.de is not None:
            # Generate mapping for renormalizing reciprocal basis vectors
Severity: Minor
Found in galgebra/metric.py - About 2 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"

Further reading

Function oprint has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

def oprint(*args, dict_mode=False):
    """
    Debug printing for iterated (list/tuple/dict/set) objects. args is
    of form ``(title1, object1, title2, object2, ...)`` and prints::

Severity: Minor
Found in galgebra/printer.py - About 2 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"

Further reading

Function reduce_basis_loop has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    def reduce_basis_loop(g, blst):
        r"""
        blst is a list of integers :math:`[i_{1},\ldots,i_{r}]` representing the geometric
        product of r basis vectors :math:`a_{{i_1}}\cdots a_{{i_r}}`. :meth:`reduce_basis_loop`
        searches along the list :math:`[i_{1},\ldots,i_{r}]` untill it finds :math:`i_{j} = i_{j+1}`
Severity: Minor
Found in galgebra/ga.py - About 2 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"

Further reading

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

    def _latex(self, print_obj):
        if len(self.terms) == 0:
            return ZERO_STR

        self = self._with_sorted_terms()
Severity: Minor
Found in galgebra/dop.py - About 2 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"

Further reading

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

def square_root_of_expr(expr):
    """
    If expression is product of even powers then every power is divided
    by two and the product is returned.  If some terms in product are
    not even powers the sqrt of the absolute value of the expression is
Severity: Minor
Found in galgebra/metric.py - About 2 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"

Further reading

Function reduce_basis has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    def reduce_basis(self, blst):
        r"""
        Repetitively applies :meth:`reduce_basis_loop` to `blst`
        product representation until normal form is
        realized for non-orthogonal basis
Severity: Minor
Found in galgebra/ga.py - About 2 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"

Further reading

Function grade_decomposition has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    def grade_decomposition(self, A: _MaybeMv) -> Dict[int, _MaybeMv]:
        """
        Returns dictionary with grades as keys of grades of A.  For example
        if A is a rotor the dictionary keys would be 0 and 2. For a vector
        the single key would be 1.  Note A can be input as a multivector or
Severity: Minor
Found in galgebra/ga.py - About 2 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"

Further reading

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

    def __init__(self, f, Ga, nargs=None, fct=False):
        #  f is a function, a multivector, a string, or a component expression
        #  self.f is a function or None such as T | a_1 where T and a_1 are vectors
        #  self.fvalue is a component expression such as
        #  T_x*a_1__x+T_y*a_1__y+T_z*a_1__z for a rank 1 tensor in 3 space and all
Severity: Minor
Found in galgebra/lt.py - About 2 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"

Further reading

Sdop has 21 functions (exceeds 20 allowed). Consider refactoring.
Open

class Sdop(_BaseDop):
    """
    Scalar differential operator is of the form (Einstein summation)

    .. math:: D = c_{i}*D_{i}
Severity: Minor
Found in galgebra/dop.py - About 2 hrs to fix

    Mlt has 21 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Mlt(printer.GaPrintable):
        r"""
        A multilinear transformation (mlt) is a multilinear multivector function of
        a list of vectors (``*args``) :math:`F(v_1,...,v_r)` where for any argument slot
        :math:`j` we have (:math:`a` is a scalar and :math:`u_j` a vector)
    Severity: Minor
    Found in galgebra/lt.py - About 2 hrs to fix

      Function Add has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          def Add(dop1, dop2):
      
              if isinstance(dop1, Dop) and isinstance(dop2, Dop):
                  if dop1.Ga != dop2.Ga:
                      raise ValueError('In Dop.Add Dop arguments are not from same geometric algebra')
      Severity: Minor
      Found in galgebra/mv.py - About 2 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"

      Further reading

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

          def __init__(self, bases, *, wedge=True, **kwargs):
              """
              Parameters
              ----------
              bases :
      Severity: Minor
      Found in galgebra/ga.py - About 2 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"

      Further reading

      Function r_basis has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          def r_basis(self) -> List[Expr]:
              r"""
              Reciprocal basis vectors :math:`e^{j}` as linear combination of basis vector symbols.
      
              These satisfy
      Severity: Minor
      Found in galgebra/ga.py - About 2 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"

      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 _make_grade has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          def _make_grade(ga: 'Ga', __name_or_coeffs: Union[str, list, tuple], __grade: int, **kwargs) -> Expr:
              """ Make a pure grade multivector. """
              def add_superscript(root, s):
                  if not s:
                      return root
      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 expand_expr has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          def expand_expr(expr, ga):
              lst_expr = []
              expr = expand(expr)
              for term in expr.args:
                  coef = S.One
      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 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 xpdf has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

      def xpdf(filename=None, paper=(14, 11), crop=False, png=False, prog=False, debug=False, pt='10pt', pdfprog='pdflatex'):
      
          """
          Post processes LaTeX output (see comments below), adds preamble and
          postscript, generates tex file, inputs file to latex, displays resulting
      Severity: Minor
      Found in galgebra/printer.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 of_basis_blades has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          def of_basis_blades(self, blade1: Symbol, blade2: Symbol) -> Expr:
              # geometric (*) product for orthogonal basis
              if self._ga.is_ortho:
                  index1 = self._ga.indexes_to_blades_dict.inverse[blade1]
                  index2 = self._ga.indexes_to_blades_dict.inverse[blade2]
      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

      Severity
      Category
      Status
      Source
      Language