pygae/galgebra

View on GitHub

Showing 281 of 843 total issues

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

def _eval_derivative_n_times_terms(terms, x, n):
    for i in range(n):
        new_terms = []
        for k, term in enumerate(terms):
            dc = _basic_diff(term[0], x)
Severity: Minor
Found in galgebra/dop.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 _arithmetic_op has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def _arithmetic_op(self, A, op, name: str):
        """ Common implementation for + and - """
        if isinstance(A, dop._BaseDop):
            return NotImplemented

Severity: Minor
Found in galgebra/mv.py - About 45 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 __call__ has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def __call__(self, *args):
        """
        Evaluate the multilinear function for the given vector arguments.
        Note that a sympy scalar is returned, *not* a multilinear function.
        """
Severity: Minor
Found in galgebra/lt.py - About 45 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

Avoid deeply nested control flow statements.
Open

                        if index in terms:
                            c_tmp, base, g_keys = terms[index]
                            terms[index] = (c_tmp + c, base, g_keys)
                        else:
                            terms[index] = (c, base, grade_keys[base])
Severity: Major
Found in galgebra/mv.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                        if row == col:
                            sign = S.Zero
                        if not f:
    Severity: Major
    Found in galgebra/lt.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              if self.cmpflg:
                                  s += str_sdop + '*' + str_base
                              else:
                                  s += str_base + '*' + str_sdop
                  s += ' + '
      Severity: Major
      Found in galgebra/mv.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            if not f:
                                mat[row, col] = sign * Symbol(element, real=True)
                            else:
                                mat[row, col] = sign * Function(element)(*coords)
                else:
        Severity: Major
        Found in galgebra/lt.py - About 45 mins to fix

          Function reflect_in_blade has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def reflect_in_blade(self, blade: 'Mv') -> 'Mv':  # Reflect mv in blade
                  # See Mv class functions documentation
                  if blade.is_blade():
                      self.characterise_Mv()
                      blade.characterise_Mv()
          Severity: Minor
          Found in galgebra/mv.py - About 45 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 __mul__ has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def __mul__(self, A):
                  if isinstance(A, dop._BaseDop):
                      return NotImplemented
          
                  if not isinstance(A, Mv):
          Severity: Minor
          Found in galgebra/mv.py - About 45 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

          Avoid deeply nested control flow statements.
          Open

                                  for l in ga.n_range:
                                      s += dxdu[k][i] * dxdu[l][j] * g_base[k, l].subs(sub_pairs)
                              g[i, j] = trigsimp(s)
          Severity: Major
          Found in galgebra/ga.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if str_sdop[0] == '-' and not isinstance(sdop.terms[0][0], Add):
                                        if self.cmpflg:
                                            s += str_sdop + str_base
                                        else:
                                            s += '-' + str_base + ' ' + str_sdop[1:]
            Severity: Major
            Found in galgebra/mv.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                  if not f:
                                      mat[row, col] = Symbol(element, real=True)
                                  else:
                                      mat[row, col] = Function(element)(*coords)
              
              
              Severity: Major
              Found in galgebra/lt.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                    if row <= col:
                                        sign = S.One
                                        element = root + pos + row_index + col_index
                                    else:
                                        sign = -S.One
                Severity: Major
                Found in galgebra/lt.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          if self.cmpflg:
                                              s += str_sdop + '*' + str_base
                                          else:
                                              s += '-' + str_base + '*' + str_sdop[1:]
                                      else:
                  Severity: Major
                  Found in galgebra/mv.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                        if row <= col:
                                            element = root + pos + row_index + col_index
                                        else:
                                            element = root + pos + col_index + row_index
                                        if not f:
                    Severity: Major
                    Found in galgebra/lt.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                              for i in range(len(g)):
                                                  m[i, i] = g[i]
                                              self.g = m
                      Severity: Major
                      Found in galgebra/metric.py - About 45 mins to fix

                        Function matrix has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def matrix(self) -> Matrix:
                                r"""
                                Returns the matrix representation of the linear transformation,
                                :math:`L`, defined by :math:`{{L}\lp {{{\eb}}_{i}} \rp } = L_{ij}{{\eb}}_{j}`
                                where :math:`L_{ij}` is the matrix representation.
                        Severity: Minor
                        Found in galgebra/lt.py - About 45 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

                        Avoid deeply nested control flow statements.
                        Open

                                            if _contains_interval(group, group_down):
                                                level_lst[ilevel][igroup].append(igroup_down)
                                            igroup_down += 1
                        Severity: Major
                        Found in galgebra/_utils/parser.py - About 45 mins to fix

                          Function Mul has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def Mul(A: 'Mv', B: 'Mv', op: str) -> 'Mv':
                                  """
                                  Function for all types of geometric multiplications called by
                                  overloaded operators for ``*``, ``^``, ``|``, ``<``, and ``>``.
                                  """
                          Severity: Minor
                          Found in galgebra/mv.py - About 45 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

                          Avoid deeply nested control flow statements.
                          Open

                                              if not f:
                                                  mat[row, col] = Symbol(element, real=True)
                                              else:
                                                  mat[row, col] = Function(element)(*coords)
                          
                          
                          Severity: Major
                          Found in galgebra/lt.py - About 45 mins to fix
                            Severity
                            Category
                            Status
                            Source
                            Language