pbrod/numdifftools

View on GitHub

Showing 591 of 591 total issues

Formatting a regular string which could be a f-string
Open

        print('n={}, scale={:.2f}'.format(n, default_scale(method, n, order)))

Used when we detect a string that is being formatted with format() or % which could potentially be a f-string. The use of f-strings is preferred. Requires Python 3.6 and py-version >= 3.6.

Formatting a regular string which could be a f-string
Open

        print('n={}, mean scale={:.2f}, median scale={:.2f}'.format(n,

Used when we detect a string that is being formatted with format() or % which could potentially be a f-string. The use of f-strings is preferred. Requires Python 3.6 and py-version >= 3.6.

Unused MaxStepGenerator imported from numdifftools.step_generators
Open

from numdifftools.step_generators import default_scale, MinStepGenerator, MaxStepGenerator

Used when an imported module or variable is not used.

Consider using Python 3 style super() without arguments
Open

        return super(Gradient, self).__call__(np.atleast_1d(x).ravel(),
Severity: Info
Found in src/numdifftools/nd_scipy.py by pylint

Emitted when calling the super() builtin with the current class and instance. On Python 3 these arguments are the default and they can be omitted.

Too few public methods (1/2)
Open

class Gradient(Jacobian):
Severity: Info
Found in src/numdifftools/nd_scipy.py by pylint

Used when class has too few public methods, so be sure it's really worth it.

Import outside toplevel (sphinx.application.Sphinx)
Open

        from sphinx.application import Sphinx
Severity: Info
Found in setup.py by pylint

Used when an import statement is used anywhere other than the module toplevel. Move this import to the top of the file.

Similar lines in 2 files
Open

#!/usr/bin/env python
Severity: Info
Found in setup.py by pylint

Indicates that a set of similar lines has been detected among multiple file. This usually means that the code should be refactored to avoid this duplication. ==numdifftools.finitedifference:[562:582] ==numdifftools.limits:[210:219] originalshape = np.shape(sequence[0]) fdel = np.vstack([np.ravel(r) for r in sequence]) one = np.ones(originalshape) h = np.vstack([np.ravel(one * step) for step in steps]) assert(fdel.size == h.size, 'fun did not return data of correct ' 'size (it must be vectorized)') return fdel, h, originalshape

def apply(self, sequence, steps, step_ratio=2.0): ``` Apply finite difference rule along the first axis.

Return derivative estimates of fun at x0 for a sequence of stepsizes h

Parameters


sequence: finite differences steps: steps

TODO found
Open

notes=FIXME,XXX,TODO
Severity: Minor
Found in .pylintrc by fixme

BUG found
Open

      * BUG: added missing derivative order, n to Gradient, Hessian, Jacobian.
Severity: Minor
Found in CHANGELOG.rst by fixme

XXX found
Open

notes=FIXME,XXX,TODO
Severity: Minor
Found in .pylintrc by fixme

Catching too general exception Exception
Open

        except Exception:

If you use a naked except Exception: clause, you might end up catching exceptions other than the ones you expect to catch. This can hide bugs or make it harder to debug programs when unrelated errors are hidden.

Missing function or method docstring
Open

def run_all_benchmarks(method='forward', order=4, x_values=(0.1, 0.5, 1.0, 5), n_max=11,

Used when a function or method has no docstring. Some special methods like init do not require a docstring.

Too many arguments (6/5)
Open

def benchmark(x=0.0001, dfun=None, fd=None, name='', scales=None, show_plot=True):

Used when a function or method takes too many arguments.

Unused argument 'order'
Open

    def __init__(self, fun, step=None, method='central', order=2,
Severity: Minor
Found in src/numdifftools/nd_scipy.py by pylint

Used when a function or method argument is not used.

Consider using '{n: n, order: order, method: method, fun: name, error: np.nan, ... }' instead of a call to 'dict'.
Open

        return dict(n=n, order=order, method=method, fun=name,

Emitted when using dict() to create a dictionary instead of a literal '{ ... }'. The literal is faster as it avoids an additional function call.

Refactor this function to reduce its Cognitive Complexity from 16 to the 15 allowed.
Open

    def _dea(self,  epstab, n):
Severity: Critical
Found in src/numdifftools/extrapolation.py by sonar-python

Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

See

Too many local variables (16/15)
Open

def run_all_benchmarks(method='forward', order=4, x_values=(0.1, 0.5, 1.0, 5), n_max=11,

Used when a function or method has too many local variables.

Unused approx_fprime imported from scipy.optimize
Open

from scipy.optimize import approx_fprime
Severity: Minor
Found in src/numdifftools/nd_scipy.py by pylint

Used when an imported module or variable is not used.

TODO found
Open

    TODO: The following does not work:
Severity: Minor
Found in src/numdifftools/nd_scipy.py by fixme

Formatting a regular string which could be a f-string
Open

    error = float('{:.3g}'.format(relativ_errors[i]))

Used when we detect a string that is being formatted with format() or % which could potentially be a f-string. The use of f-strings is preferred. Requires Python 3.6 and py-version >= 3.6.

Severity
Category
Status
Source
Language