chebpy/chebpy

View on GitHub

Showing 26 of 32 total issues

Chebfun has 48 functions (exceeds 20 allowed). Consider refactoring.
Open

class Chebfun:
    def __init__(self, funs):
        self.funs = check_funs(funs)
        self.breakdata = compute_breakdata(self.funs)
        self.transposed = False
Severity: Minor
Found in chebpy/core/chebfun.py - About 6 hrs to fix

    Chebtech has 43 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Chebtech(Smoothfun, ABC):
        """Abstract base class serving as the template for Chebtech1 and
        Chebtech2 subclasses.
    
        Chebtech objects always work with first-kind coefficients, so much
    Severity: Minor
    Found in chebpy/core/chebtech.py - About 5 hrs to fix

      File chebtech.py has 349 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      from abc import ABC, abstractmethod
      
      import numpy as np
      
      from .smoothfun import Smoothfun
      Severity: Minor
      Found in chebpy/core/chebtech.py - About 4 hrs to fix

        Onefun has 34 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class Onefun(ABC):
            # --------------------------
            #  alternative constructors
            # --------------------------
            @abstractclassmethod
        Severity: Minor
        Found in chebpy/core/onefun.py - About 4 hrs to fix

          Fun has 34 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class Fun(ABC):
              # --------------------------
              #  alternative constructors
              # --------------------------
              @abstractclassmethod
          Severity: Minor
          Found in chebpy/core/fun.py - About 4 hrs to fix

            File chebfun.py has 343 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import operator
            
            import numpy as np
            
            from .bndfun import Bndfun
            Severity: Minor
            Found in chebpy/core/chebfun.py - About 4 hrs to fix

              Classicfun has 25 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class Classicfun(Fun, ABC):
                  # --------------------------
                  #  alternative constructors
                  # --------------------------
                  @classmethod
              Severity: Minor
              Found in chebpy/core/classicfun.py - About 2 hrs to fix

                File algorithms.py has 258 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import warnings
                
                import numpy as np
                
                from .ffts import fft, ifft
                Severity: Minor
                Found in chebpy/core/algorithms.py - About 2 hrs to fix

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

                  def preandpostprocess(f):
                      """Pre- and post-processing tasks common to bary and clenshaw"""
                  
                      @wraps(f)
                      def thewrapper(*args, **kwargs):
                  Severity: Minor
                  Found in chebpy/core/decorators.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 standard_chop has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def standard_chop(coeffs, tol=None):
                      """Chop a Chebyshev series to a given tolerance. This is a Python
                      transcription of the algorithm described in:
                  
                      J. Aurentz and L.N. Trefethen, Chopping a Chebyshev series (2015)
                  Severity: Minor
                  Found in chebpy/core/algorithms.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__ has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def __add__(self, f):
                          cls = self.__class__
                          if np.isscalar(f):
                              if np.iscomplexobj(f):
                                  dtype = complex
                  Severity: Minor
                  Found in chebpy/core/chebtech.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 float_argument has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def float_argument(f):
                      """Chebfun classmethod wrapper for __call__: ensure that we provide
                      float output for float input and array output otherwise"""
                  
                      @wraps(f)
                  Severity: Minor
                  Found in chebpy/core/decorators.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 addBinaryOp has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def addBinaryOp(methodname):
                      @self_empty()
                      def method(self, f, *args, **kwds):
                          cls = self.__class__
                          if isinstance(f, cls):
                  Severity: Minor
                  Found in chebpy/core/classicfun.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 chebfun has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def chebfun(f=None, domain=None, n=None):
                      """Chebfun constructor"""
                      # chebfun()
                      if f is None:
                          return Chebfun.initempty()
                  Severity: Minor
                  Found in chebpy/api.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 bary has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def bary(xx, fk, xk, vk):
                      """Barycentric interpolation formula. See:
                  
                      J.P. Berrut, L.N. Trefethen, Barycentric Lagrange Interpolation, SIAM
                      Review (2004)
                  Severity: Minor
                  Found in chebpy/core/algorithms.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 initfun_fixedlen has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def initfun_fixedlen(cls, f, n, domain=None):
                          nn = np.array(n)
                          if nn.size < 2:
                              funs = generate_funs(domain, Bndfun.initfun_fixedlen, {"f": f, "n": n})
                          else:
                  Severity: Minor
                  Found in chebpy/core/chebfun.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 self_empty has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def self_empty(resultif=None):
                      """Factory method to produce a decorator that checks whether the object
                      whose classmethod is being wrapped is empty, returning the object if
                      so, but returning the supplied resultif if not. (Used in chebtech.py)"""
                  
                  
                  Severity: Minor
                  Found in chebpy/core/decorators.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 rootsunit has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def rootsunit(ak, htol=None):
                      """Compute the roots of a funciton on [-1,1] using the coefficeints
                      in the associated Chebyshev series representation.
                  
                      References
                  Severity: Minor
                  Found in chebpy/core/algorithms.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 plotfun has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  def plotfun(fun, support, ax=None, N=None, **kwds):
                  Severity: Minor
                  Found in chebpy/core/plotting.py - About 35 mins to fix

                    Function roots has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def roots(self, merge=None):
                            """Compute the roots of a Chebfun, i.e., the set of values x for which
                            f(x) = 0.
                            """
                            merge = merge if merge is not None else prefs.mergeroots
                    Severity: Minor
                    Found in chebpy/core/chebfun.py - About 35 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