Skip to content

CLN: update pandas.lib deprecation messages (GH15936) #16021

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 1 commit into from
Apr 16, 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
7 changes: 5 additions & 2 deletions pandas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,11 @@
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'})
lib = _DeprecatedModule(deprmod='pandas.lib', deprmodto=False,
moved={'Timestamp': 'pandas.Timestamp',
'Timedelta': 'pandas.Timedelta',
'NaT': 'pandas.NaT',
Copy link
Contributor

Choose a reason for hiding this comment

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

this is in .types now (i removed .lib)

Copy link
Member Author

Choose a reason for hiding this comment

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

Well, I first thought that as well, but it is not the case in master: https://github.com/pandas-dev/pandas/blob/master/pandas/api/lib/__init__.py

Copy link
Contributor

Choose a reason for hiding this comment

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

i didn't remove that file which is not distributed - look in types

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't follow ..

It is also not in types: https://github.com/pandas-dev/pandas/blob/master/pandas/api/types/__init__.py

and why shouldn't the file be removed if we don't use it?

'infer_dtype': 'pandas.api.lib.infer_dtype'})
tslib = _DeprecatedModule(deprmod='pandas.tslib',
moved={'Timestamp': 'pandas.Timestamp',
'Timedelta': 'pandas.Timedelta',
Expand Down
25 changes: 16 additions & 9 deletions pandas/util/depr_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,22 @@ def __getattr__(self, name):
FutureWarning, stacklevel=2)
else:
deprmodto = self.deprmodto
if deprmodto is None:
deprmodto = "{modname}.{name}".format(
modname=obj.__module__, name=name)
# The object is actually located in another module.
warnings.warn(
"{deprmod}.{name} is deprecated. Please use "
"{deprmodto}.{name} instead.".format(
deprmod=self.deprmod, name=name, deprmodto=deprmodto),
FutureWarning, stacklevel=2)
if deprmodto is False:
warnings.warn(
"{deprmod}.{name} is deprecated and will be removed in "
"a future version.".format(
deprmod=self.deprmod, name=name),
FutureWarning, stacklevel=2)
else:
if deprmodto is None:
deprmodto = "{modname}.{name}".format(
modname=obj.__module__, name=name)
# The object is actually located in another module.
warnings.warn(
"{deprmod}.{name} is deprecated. Please use "
"{deprmodto}.{name} instead.".format(
deprmod=self.deprmod, name=name, deprmodto=deprmodto),
FutureWarning, stacklevel=2)

return obj

Expand Down