Skip to content

Commit c4dca36

Browse files
jorisvandenbosschejreback
authored andcommitted
DEPR: correct locations to access public json/parser objects in depr message (#15909)
* DEPR: correct locations to access public json objects in depr message * Additional corrections
1 parent 88bed54 commit c4dca36

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

pandas/__init__.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,15 @@
6060
# extension module deprecations
6161
from pandas.util.depr_module import _DeprecatedModule
6262

63-
json = _DeprecatedModule(deprmod='pandas.json', deprmodto='pandas.io.json.libjson')
64-
parser = _DeprecatedModule(deprmod='pandas.parser', deprmodto='pandas.io.libparsers')
63+
json = _DeprecatedModule(deprmod='pandas.json',
64+
moved={'dumps': 'pandas.io.json.dumps',
65+
'loads': 'pandas.io.json.loads'})
66+
parser = _DeprecatedModule(deprmod='pandas.parser',
67+
removals=['na_values'],
68+
moved={'CParserError': 'pandas.errors.ParserError'})
6569
lib = _DeprecatedModule(deprmod='pandas.lib', deprmodto='pandas._libs.lib',
6670
moved={'infer_dtype': 'pandas.api.lib.infer_dtype'})
67-
tslib = _DeprecatedModule(deprmod='pandas.tslib', deprmodto='pandas._libs.tslib',
71+
tslib = _DeprecatedModule(deprmod='pandas.tslib',
6872
moved={'Timestamp': 'pandas.Timestamp',
6973
'Timedelta': 'pandas.Timedelta',
7074
'NaT': 'pandas.NaT',

pandas/tslib.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import warnings
44
warnings.warn("The pandas.tslib module is deprecated and will be "
5-
"removed in a future version. Please import from "
6-
"the pandas or pandas.errors instead", FutureWarning, stacklevel=2)
5+
"removed in a future version.", FutureWarning, stacklevel=2)
76
from pandas._libs.tslib import (Timestamp, Timedelta,
87
NaT, OutOfBoundsDatetime)

pandas/util/depr_module.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def __getattr__(self, name):
6868
elif self.moved is not None and name in self.moved:
6969
warnings.warn(
7070
"{deprmod} is deprecated and will be removed in "
71-
"a future version.\nYou can access {name} in {moved}".format(
71+
"a future version.\nYou can access {name} as {moved}".format(
7272
deprmod=self.deprmod,
7373
name=name,
7474
moved=self.moved[name]),

0 commit comments

Comments
 (0)