Skip to content

DEPR: correct locations to access public json/parser objects in depr message #15909

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions pandas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,15 @@
# extension module deprecations
from pandas.util.depr_module import _DeprecatedModule

json = _DeprecatedModule(deprmod='pandas.json', deprmodto='pandas.io.json.libjson')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you might be able to remove the deprmodto argument entirely (which I added to handle moving modules).

parser = _DeprecatedModule(deprmod='pandas.parser', deprmodto='pandas.io.libparsers')
json = _DeprecatedModule(deprmod='pandas.json',
moved={'dumps': 'pandas.io.json.dumps',
'loads': 'pandas.io.json.loads'})
parser = _DeprecatedModule(deprmod='pandas.parser',
removals=['na_values'],
moved={'CParserError': 'pandas.errors.ParserError'})
lib = _DeprecatedModule(deprmod='pandas.lib', deprmodto='pandas._libs.lib',
moved={'infer_dtype': 'pandas.api.lib.infer_dtype'})
tslib = _DeprecatedModule(deprmod='pandas.tslib', deprmodto='pandas._libs.tslib',
tslib = _DeprecatedModule(deprmod='pandas.tslib',
moved={'Timestamp': 'pandas.Timestamp',
'Timedelta': 'pandas.Timedelta',
'NaT': 'pandas.NaT',
Expand Down
3 changes: 1 addition & 2 deletions pandas/tslib.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import warnings
warnings.warn("The pandas.tslib module is deprecated and will be "
"removed in a future version. Please import from "
"the pandas or pandas.errors instead", FutureWarning, stacklevel=2)
"removed in a future version.", FutureWarning, stacklevel=2)
from pandas._libs.tslib import (Timestamp, Timedelta,
NaT, OutOfBoundsDatetime)
2 changes: 1 addition & 1 deletion pandas/util/depr_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def __getattr__(self, name):
elif self.moved is not None and name in self.moved:
warnings.warn(
"{deprmod} is deprecated and will be removed in "
"a future version.\nYou can access {name} in {moved}".format(
"a future version.\nYou can access {name} as {moved}".format(
deprmod=self.deprmod,
name=name,
moved=self.moved[name]),
Expand Down