From 18aee44e851daafa4e6934c28c9c64c54f49e15b Mon Sep 17 00:00:00 2001 From: gfyoung Date: Sat, 27 Oct 2018 19:33:57 -0700 Subject: [PATCH] CLN: Remove pd.parser, lib, and tslib (#23378) xref gh-15537. Need to bumpy xarray version for Travis 2.7 because 0.8.0 becomes incompatible with this change. --- ci/travis-27.yaml | 2 +- doc/source/whatsnew/v0.24.0.txt | 1 + pandas/__init__.py | 18 ------------------ pandas/lib.py | 8 -------- pandas/parser.py | 8 -------- pandas/tests/api/test_api.py | 23 +---------------------- pandas/tests/api/test_types.py | 14 -------------- pandas/tests/test_errors.py | 8 -------- pandas/tslib.py | 7 ------- 9 files changed, 3 insertions(+), 86 deletions(-) delete mode 100644 pandas/lib.py delete mode 100644 pandas/parser.py delete mode 100644 pandas/tslib.py diff --git a/ci/travis-27.yaml b/ci/travis-27.yaml index f079ac309b97c2..8955bea1fc0106 100644 --- a/ci/travis-27.yaml +++ b/ci/travis-27.yaml @@ -35,7 +35,7 @@ dependencies: - s3fs - scipy - sqlalchemy=0.9.6 - - xarray=0.8.0 + - xarray=0.9.6 - xlrd=0.9.2 - xlsxwriter=0.5.2 - xlwt=0.7.5 diff --git a/doc/source/whatsnew/v0.24.0.txt b/doc/source/whatsnew/v0.24.0.txt index 9a781eda0e3974..8460ddae1447cb 100644 --- a/doc/source/whatsnew/v0.24.0.txt +++ b/doc/source/whatsnew/v0.24.0.txt @@ -945,6 +945,7 @@ Removal of prior version deprecations/changes - Removal of the previously deprecated ``as_indexer`` keyword completely from ``str.match()`` (:issue:`22356`, :issue:`6581`) - Removed the ``pandas.formats.style`` shim for :class:`pandas.io.formats.style.Styler` (:issue:`16059`) - :meth:`Categorical.searchsorted` and :meth:`Series.searchsorted` have renamed the ``v`` argument to ``value`` (:issue:`14645`) +- ``pandas.parser``, ``pandas.lib``, and ``pandas.tslib`` have been removed (:issue:`15537`) - :meth:`TimedeltaIndex.searchsorted`, :meth:`DatetimeIndex.searchsorted`, and :meth:`PeriodIndex.searchsorted` have renamed the ``key`` argument to ``value`` (:issue:`14645`) - Removal of the previously deprecated module ``pandas.json`` (:issue:`19944`) - :meth:`SparseArray.get_values` and :meth:`SparseArray.to_dense` have dropped the ``fill`` parameter (:issue:`14686`) diff --git a/pandas/__init__.py b/pandas/__init__.py index e446782d9665e2..af14319419c420 100644 --- a/pandas/__init__.py +++ b/pandas/__init__.py @@ -58,24 +58,6 @@ from pandas.util._tester import test import pandas.testing -# extension module deprecations -from pandas.util._depr_module import _DeprecatedModule - -parser = _DeprecatedModule(deprmod='pandas.parser', - removals=['na_values'], - moved={'CParserError': 'pandas.errors.ParserError'}) -lib = _DeprecatedModule(deprmod='pandas.lib', deprmodto=False, - moved={'Timestamp': 'pandas.Timestamp', - 'Timedelta': 'pandas.Timedelta', - 'NaT': 'pandas.NaT', - 'infer_dtype': 'pandas.api.types.infer_dtype'}) -tslib = _DeprecatedModule(deprmod='pandas.tslib', - moved={'Timestamp': 'pandas.Timestamp', - 'Timedelta': 'pandas.Timedelta', - 'NaT': 'pandas.NaT', - 'NaTType': 'type(pandas.NaT)', - 'OutOfBoundsDatetime': 'pandas.errors.OutOfBoundsDatetime'}) - # use the closest tagged version if possible from ._version import get_versions v = get_versions() diff --git a/pandas/lib.py b/pandas/lib.py deleted file mode 100644 index 859a78060fcc16..00000000000000 --- a/pandas/lib.py +++ /dev/null @@ -1,8 +0,0 @@ -# flake8: noqa - -import warnings -warnings.warn("The pandas.lib module is deprecated and will be " - "removed in a future version. These are private functions " - "and can be accessed from pandas._libs.lib instead", - FutureWarning, stacklevel=2) -from pandas._libs.lib import * diff --git a/pandas/parser.py b/pandas/parser.py deleted file mode 100644 index f43a408c943d06..00000000000000 --- a/pandas/parser.py +++ /dev/null @@ -1,8 +0,0 @@ -# flake8: noqa - -import warnings -warnings.warn("The pandas.parser module is deprecated and will be " - "removed in a future version. Please import from " - "pandas.io.parser instead", FutureWarning, stacklevel=2) -from pandas._libs.parsers import na_values -from pandas.io.common import CParserError diff --git a/pandas/tests/api/test_api.py b/pandas/tests/api/test_api.py index 1a234cdfe3518c..0d46f7745d43c8 100644 --- a/pandas/tests/api/test_api.py +++ b/pandas/tests/api/test_api.py @@ -34,7 +34,7 @@ class TestPDApi(Base): 'util', 'options', 'io'] # these are already deprecated; awaiting removal - deprecated_modules = ['parser', 'lib', 'tslib'] + deprecated_modules = [] # misc misc = ['IndexSlice', 'NaT'] @@ -172,27 +172,6 @@ def test_get_store(self): s.close() -class TestParser(object): - - @pytest.mark.filterwarnings("ignore") - def test_deprecation_access_func(self): - pd.parser.na_values - - -class TestLib(object): - - @pytest.mark.filterwarnings("ignore") - def test_deprecation_access_func(self): - pd.lib.infer_dtype('foo') - - -class TestTSLib(object): - - @pytest.mark.filterwarnings("ignore") - def test_deprecation_access_func(self): - pd.tslib.Timestamp('20160101') - - class TestTypes(object): def test_deprecation_access_func(self): diff --git a/pandas/tests/api/test_types.py b/pandas/tests/api/test_types.py index ed80c1414dbaa6..4ea501dacddf38 100644 --- a/pandas/tests/api/test_types.py +++ b/pandas/tests/api/test_types.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- -import sys import pytest from pandas.api import types @@ -53,16 +52,3 @@ def test_deprecated_from_api_types(self): with tm.assert_produces_warning(FutureWarning, check_stacklevel=False): getattr(types, t)(1) - - -def test_moved_infer_dtype(): - # del from sys.modules to ensure we try to freshly load. - # if this was imported from another test previously, we would - # not see the warning, since the import is otherwise cached. - sys.modules.pop("pandas.lib", None) - - with tm.assert_produces_warning(FutureWarning): - import pandas.lib - - e = pandas.lib.infer_dtype('foo') - assert e is not None diff --git a/pandas/tests/test_errors.py b/pandas/tests/test_errors.py index 76e003c463e7d3..fbc0faa4c929aa 100644 --- a/pandas/tests/test_errors.py +++ b/pandas/tests/test_errors.py @@ -1,7 +1,6 @@ # -*- coding: utf-8 -*- import pytest -from warnings import catch_warnings, simplefilter import pandas # noqa import pandas as pd from pandas.errors import AbstractMethodError @@ -47,13 +46,6 @@ def test_error_rename(): except CParserError: pass - with catch_warnings(record=True): - simplefilter("ignore") - try: - raise ParserError() - except pd.parser.CParserError: - pass - class Foo(object): @classmethod diff --git a/pandas/tslib.py b/pandas/tslib.py deleted file mode 100644 index fc4a1ccb5da00a..00000000000000 --- a/pandas/tslib.py +++ /dev/null @@ -1,7 +0,0 @@ -# flake8: noqa - -import warnings -warnings.warn("The pandas.tslib module is deprecated and will be " - "removed in a future version.", FutureWarning, stacklevel=2) -from pandas._libs.tslibs import Timestamp, Timedelta, OutOfBoundsDatetime -from pandas._libs.tslibs.nattype import NaT, NaTType