-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deprecate measure_distance_spherical, fixes #251
- Loading branch information
1 parent
e157868
commit 81e312c
Showing
2 changed files
with
22 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import warnings | ||
import functools | ||
|
||
# source: https://stackoverflow.com/a/30253848 | ||
|
||
def deprecated(func): | ||
"""This is a decorator which can be used to mark functions | ||
as deprecated. It will result in a warning being emitted | ||
when the function is used.""" | ||
@functools.wraps(func) | ||
def new_func(*args, **kwargs): | ||
warnings.simplefilter('always', DeprecationWarning) # turn off filter | ||
warnings.warn("Call to deprecated function {}.".format(func.__name__), | ||
category=DeprecationWarning, | ||
stacklevel=2) | ||
warnings.simplefilter('default', DeprecationWarning) # reset filter | ||
return func(*args, **kwargs) | ||
return new_func |