e3fp.util module

Utility classes/methods.

Author: Seth Axen E-mail: seth.axen@gmail.com

exception E3FPDeprecationWarning[source]

Bases: E3FPWarning, DeprecationWarning

A warning class for a deprecated method or class.

exception E3FPEfficiencyWarning[source]

Bases: E3FPWarning, RuntimeWarning

A warning class for a potentially inefficient process.

exception E3FPError[source]

Bases: Exception

Base class for E3FP-specific errors.

This class is provided for future E3FP-specific functionality.

exception E3FPWarning[source]

Bases: Warning

Base E3FP warning class.

Unlike normal warnings, these are by default always set to on.

class deprecated(deprecated_version, remove_version=None, msg=None)[source]

Bases: object

Decorator to mark a function as deprecated.

Issue a deprecation warning when a function is called, and update the documentation. A deprecation version must be provided.

Examples

>>> from e3fp.util import deprecated
>>> @deprecated("1.1", remove_version="1.3",
...             msg="Function no longer needed")
... def my_function():
...     pass

Notes

Adapted from https://wiki.python.org/moin/PythonDecoratorLibrary

deprecate_function(f)[source]

Return the decorated function.

update_docstring(obj)[source]

Add deprecation note to docstring.

maybe_jit(*args, **kwargs)[source]

Decorator to jit a function using Numba if available.

Usage is identical to numba.jit.