Skip to content

Commit

Permalink
Replace DeprecationWarning for FutureWarning (#305)
Browse files Browse the repository at this point in the history
`DeprecationWarning`s are intended for developers, while the warnings 
we want to raise are to let users know that a feature will be deprecated 
is the `FutureWarning`. Remove the override of `warning.simplefilter`.
Following the comments in #293

Fixes #290
  • Loading branch information
santisoler committed Mar 16, 2021
1 parent 375af25 commit 4cabc4a
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 20 deletions.
7 changes: 2 additions & 5 deletions verde/datasets/sample_data.py
Expand Up @@ -17,9 +17,6 @@
from ..version import full_version


# Otherwise, DeprecationWarning won't be shown, kind of defeating the purpose.
warnings.simplefilter("default")

REGISTRY = pooch.create(
path=pooch.os_cache("verde"),
base_url="https://github.com/fatiando/verde/raw/{version}/data/",
Expand Down Expand Up @@ -183,7 +180,7 @@ def fetch_rio_magnetic():
warnings.warn(
"The Rio magnetic anomaly dataset is deprecated and will be removed "
"in Verde v2.0.0. Use a different dataset instead.",
DeprecationWarning,
FutureWarning,
)
data_file = REGISTRY.fetch("rio-magnetic.csv.xz")
data = pd.read_csv(data_file, compression="xz")
Expand Down Expand Up @@ -216,7 +213,7 @@ def setup_rio_magnetic_map(ax, region=(-42.6, -42, -22.5, -22)):
warnings.warn(
"The Rio magnetic anomaly dataset is deprecated and will be removed "
"in Verde v2.0.0. Use a different dataset instead.",
DeprecationWarning,
FutureWarning,
)
_setup_map(
ax,
Expand Down
6 changes: 1 addition & 5 deletions verde/model_selection.py
Expand Up @@ -14,10 +14,6 @@
from .utils import dispatch, partition_by_sum


# Otherwise, DeprecationWarning won't be shown, kind of defeating the purpose.
warnings.simplefilter("default")


# Pylint doesn't like X, y scikit-learn argument names.
# pylint: disable=invalid-name,unused-argument

Expand Down Expand Up @@ -758,7 +754,7 @@ def cross_val_score(
"The 'client' parameter of 'verde.cross_val_score' is deprecated "
"and will be removed in Verde 2.0.0. "
"Use the 'delayed' parameter instead.",
DeprecationWarning,
FutureWarning,
)
coordinates, data, weights = check_fit_input(
coordinates, data, weights, unpack=False
Expand Down
6 changes: 1 addition & 5 deletions verde/spline.py
Expand Up @@ -20,10 +20,6 @@
from .utils import dummy_jit as jit


# Otherwise, DeprecationWarning won't be shown, kind of defeating the purpose.
warnings.simplefilter("default")


class SplineCV(BaseGridder):
r"""
Cross-validated biharmonic spline interpolation.
Expand Down Expand Up @@ -145,7 +141,7 @@ def __init__(
"The 'client' parameter of 'verde.SplineCV' is "
"deprecated and will be removed in Verde 2.0.0. "
"Use the 'delayed' parameter instead.",
DeprecationWarning,
FutureWarning,
)

def fit(self, coordinates, data, weights=None):
Expand Down
6 changes: 1 addition & 5 deletions verde/vector.py
Expand Up @@ -19,10 +19,6 @@
from .utils import dummy_jit as jit


# Otherwise, DeprecationWarning won't be shown, kind of defeating the purpose.
warnings.simplefilter("default")


class Vector(BaseGridder):
"""
Fit an estimator to each component of multi-component vector data.
Expand Down Expand Up @@ -234,7 +230,7 @@ def __init__(
"VectorSpline2D is deprecated and will be removed in Verde v2.0.0."
" Please use the implementation in the Erizo package instead "
"(https://github.com/fatiando/erizo).",
DeprecationWarning,
FutureWarning,
)

def fit(self, coordinates, data, weights=None):
Expand Down

0 comments on commit 4cabc4a

Please sign in to comment.