pbrod/numdifftools

View on GitHub
src/numdifftools/nd_scipy.py

Summary

Maintainability
A
1 hr
Test Coverage

Class '_Common' inherits from object, can be safely removed from bases in python3
Open

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

Used when a class inherit from object, which under python3 is implicit, hence can be safely removed from bases.

Too many arguments (7/5)
Open

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

Used when a function or method takes too many arguments.

Too few public methods (1/2)
Open

class Jacobian(_Common):
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.

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.

Consider using '{complex: 'cs', central: '3-point', forward: '2-point', backward: '2-point', ... }' instead of a call to 'dict'.
Open

        method = dict(complex='cs', central='3-point', forward='2-point',
Severity: Info
Found in src/numdifftools/nd_scipy.py by pylint

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

Consider using '{method: method, rel_step: self.step, args: args, kwargs: kwds, ... }' instead of a call to 'dict'.
Open

        options = dict(method=method, rel_step=self.step, args=args,
Severity: Info
Found in src/numdifftools/nd_scipy.py by pylint

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

Too few public methods (0/2)
Open

class _Common(object):
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.

Unable to import 'scipy.optimize'
Open

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

Used when pylint has been unable to import a module.

Unable to import 'scipy.optimize._numdiff'
Open

from scipy.optimize._numdiff import approx_derivative
Severity: Critical
Found in src/numdifftools/nd_scipy.py by pylint

Used when pylint has been unable to import a module.

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.

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

Unable to import 'numpy'
Open

import numpy as np
Severity: Critical
Found in src/numdifftools/nd_scipy.py by pylint

Used when pylint has been unable to import a module.

Similar blocks of code found in 2 locations. Consider refactoring.
Open

class Gradient(Jacobian):
    """
    Calculate Gradient with finite difference approximation

    Parameters
Severity: Major
Found in src/numdifftools/nd_scipy.py and 1 other location - About 1 hr to fix
src/numdifftools/nd_statsmodels.py on lines 299..349

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 46.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Missing module docstring
Open

from __future__ import absolute_import, division, print_function
Severity: Info
Found in src/numdifftools/nd_scipy.py by pylint

Used when a module has no docstring. Empty modules do not require a docstring.

There are no issues that match your filters.

Category
Status