From 4e0f2e80e14234b6856979655d21948ca0597ab5 Mon Sep 17 00:00:00 2001 From: yogendra Date: Sat, 12 Oct 2019 03:02:12 +0530 Subject: [PATCH 1/7] fix #28926 pandas\api\test_api.py mypy errors --- pandas/tests/api/test_api.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/pandas/tests/api/test_api.py b/pandas/tests/api/test_api.py index 6c50159663574..8a5f6ac76236f 100644 --- a/pandas/tests/api/test_api.py +++ b/pandas/tests/api/test_api.py @@ -1,7 +1,7 @@ import pandas as pd from pandas import api, compat from pandas.util import testing as tm - +from typing import List class Base: def check(self, namespace, expected, ignored=None): @@ -41,7 +41,8 @@ class TestPDApi(Base): ] # these are already deprecated; awaiting removal - deprecated_modules = [] + # GH #28926 + deprecated_modules : List[str] = [] # misc misc = ["IndexSlice", "NaT"] @@ -92,10 +93,12 @@ class TestPDApi(Base): classes.extend(["Panel", "SparseSeries", "SparseDataFrame"]) # these are already deprecated; awaiting removal - deprecated_classes = [] + #GH #28926 + deprecated_classes : List[str] = [] # these should be deprecated in the future - deprecated_classes_in_future = [] + #GH #28926 + deprecated_classes_in_future : List[str] = [] # external modules exposed in pandas namespace modules = ["np", "datetime"] @@ -171,10 +174,12 @@ class TestPDApi(Base): funcs_to = ["to_datetime", "to_msgpack", "to_numeric", "to_pickle", "to_timedelta"] # top-level to deprecate in the future - deprecated_funcs_in_future = [] + #GH #28926 + deprecated_funcs_in_future : List[str] = [] # these are already deprecated; awaiting removal - deprecated_funcs = [] + #GH #28926 + deprecated_funcs : List[str] = [] # private modules in pandas namespace private_modules = [ From 8b93a95f93ad57859e90cf8fc3e16af08eeeeb29 Mon Sep 17 00:00:00 2001 From: yogendra Date: Sat, 12 Oct 2019 03:02:12 +0530 Subject: [PATCH 2/7] fix #28926 pandas\api\test_api.py mypy errors --- pandas/tests/api/test_api.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/pandas/tests/api/test_api.py b/pandas/tests/api/test_api.py index 6c50159663574..e949fd1b7f026 100644 --- a/pandas/tests/api/test_api.py +++ b/pandas/tests/api/test_api.py @@ -1,6 +1,7 @@ import pandas as pd from pandas import api, compat from pandas.util import testing as tm +from typing import List class Base: @@ -41,7 +42,8 @@ class TestPDApi(Base): ] # these are already deprecated; awaiting removal - deprecated_modules = [] + # GH #28926 + deprecated_modules: List[str] = [] # misc misc = ["IndexSlice", "NaT"] @@ -92,10 +94,12 @@ class TestPDApi(Base): classes.extend(["Panel", "SparseSeries", "SparseDataFrame"]) # these are already deprecated; awaiting removal - deprecated_classes = [] + # GH #28926 + deprecated_classes: List[str] = [] # these should be deprecated in the future - deprecated_classes_in_future = [] + # GH #28926 + deprecated_classes_in_future: List[str] = [] # external modules exposed in pandas namespace modules = ["np", "datetime"] @@ -171,10 +175,12 @@ class TestPDApi(Base): funcs_to = ["to_datetime", "to_msgpack", "to_numeric", "to_pickle", "to_timedelta"] # top-level to deprecate in the future - deprecated_funcs_in_future = [] + # GH #28926 + deprecated_funcs_in_future: List[str] = [] # these are already deprecated; awaiting removal - deprecated_funcs = [] + # GH #28926 + deprecated_funcs: List[str] = [] # private modules in pandas namespace private_modules = [ From 2833ce37d694e1a5af720c191e60d3d2afc91240 Mon Sep 17 00:00:00 2001 From: yogendra Date: Sat, 12 Oct 2019 04:16:45 +0530 Subject: [PATCH 3/7] changed to type comment to support v 3.5 --- pandas/tests/api/test_api.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pandas/tests/api/test_api.py b/pandas/tests/api/test_api.py index ea76fb879ad95..d02b4febdbeb8 100644 --- a/pandas/tests/api/test_api.py +++ b/pandas/tests/api/test_api.py @@ -42,7 +42,7 @@ class TestPDApi(Base): ] # these are already deprecated; awaiting removal - deprecated_modules: List[str] = [] + deprecated_modules = [] # type: List[int] # misc misc = ["IndexSlice", "NaT"] @@ -93,10 +93,10 @@ class TestPDApi(Base): classes.extend(["Panel", "SparseSeries", "SparseDataFrame"]) # these are already deprecated; awaiting removal - deprecated_classes: List[str] = [] + deprecated_classes = [] # type: List[int] # these should be deprecated in the future - deprecated_classes_in_future: List[str] = [] + deprecated_classes_in_future = [] # type: List[int] # external modules exposed in pandas namespace modules = ["np", "datetime"] @@ -172,10 +172,10 @@ class TestPDApi(Base): funcs_to = ["to_datetime", "to_msgpack", "to_numeric", "to_pickle", "to_timedelta"] # top-level to deprecate in the future - deprecated_funcs_in_future: List[str] = [] + deprecated_funcs_in_future = [] # type: List[int] # these are already deprecated; awaiting removal - deprecated_funcs: List[str] = [] + deprecated_funcs = [] # type: List[int] # private modules in pandas namespace private_modules = [ From c6aba1f02b222761c6612f1dccfbcd4c5e7e30ad Mon Sep 17 00:00:00 2001 From: yogendra Date: Sat, 12 Oct 2019 04:30:25 +0530 Subject: [PATCH 4/7] removed section mypy-pandas.tests.api.test_api --- setup.cfg | 1 - 1 file changed, 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index ba6e6bb137faa..8df9a0cc47143 100644 --- a/setup.cfg +++ b/setup.cfg @@ -131,7 +131,6 @@ ignore_missing_imports=True no_implicit_optional=True [mypy-pandas.conftest] -ignore_errors=True [mypy-pandas.tests.api.test_api] ignore_errors=False From f0c096c9670e6b2ff1a3d15f6c1b8269cc515124 Mon Sep 17 00:00:00 2001 From: yogendra Date: Sat, 12 Oct 2019 05:03:59 +0530 Subject: [PATCH 5/7] fix annotation and revert delete --- pandas/tests/api/test_api.py | 10 +++++----- setup.cfg | 4 +--- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/pandas/tests/api/test_api.py b/pandas/tests/api/test_api.py index d02b4febdbeb8..de2095ecad6b6 100644 --- a/pandas/tests/api/test_api.py +++ b/pandas/tests/api/test_api.py @@ -42,7 +42,7 @@ class TestPDApi(Base): ] # these are already deprecated; awaiting removal - deprecated_modules = [] # type: List[int] + deprecated_modules = [] # type: List[str] # misc misc = ["IndexSlice", "NaT"] @@ -93,10 +93,10 @@ class TestPDApi(Base): classes.extend(["Panel", "SparseSeries", "SparseDataFrame"]) # these are already deprecated; awaiting removal - deprecated_classes = [] # type: List[int] + deprecated_classes = [] # type: List[str] # these should be deprecated in the future - deprecated_classes_in_future = [] # type: List[int] + deprecated_classes_in_future = [] # type: List[str] # external modules exposed in pandas namespace modules = ["np", "datetime"] @@ -172,10 +172,10 @@ class TestPDApi(Base): funcs_to = ["to_datetime", "to_msgpack", "to_numeric", "to_pickle", "to_timedelta"] # top-level to deprecate in the future - deprecated_funcs_in_future = [] # type: List[int] + deprecated_funcs_in_future = [] # type: List[str] # these are already deprecated; awaiting removal - deprecated_funcs = [] # type: List[int] + deprecated_funcs = [] # type: List[str] # private modules in pandas namespace private_modules = [ diff --git a/setup.cfg b/setup.cfg index 8df9a0cc47143..69b67c82a1e9f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -131,9 +131,7 @@ ignore_missing_imports=True no_implicit_optional=True [mypy-pandas.conftest] - -[mypy-pandas.tests.api.test_api] -ignore_errors=False +ignore_errors=True [mypy-pandas.tests.arithmetic.test_datetime64] ignore_errors=True From f5e66fc8c204b88dcbaff1555e6e654ff51756db Mon Sep 17 00:00:00 2001 From: yogendra Date: Sat, 12 Oct 2019 05:21:32 +0530 Subject: [PATCH 6/7] fix import sorting --- pandas/tests/api/test_api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tests/api/test_api.py b/pandas/tests/api/test_api.py index de2095ecad6b6..ccc65a5933f8e 100644 --- a/pandas/tests/api/test_api.py +++ b/pandas/tests/api/test_api.py @@ -1,7 +1,7 @@ +from typing import List import pandas as pd from pandas import api, compat from pandas.util import testing as tm -from typing import List class Base: From 1613e93adc1eb59abcdd0e08964f27c81a9ea5b4 Mon Sep 17 00:00:00 2001 From: yogendra Date: Sat, 12 Oct 2019 05:21:32 +0530 Subject: [PATCH 7/7] fix import sorting --- pandas/tests/api/test_api.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pandas/tests/api/test_api.py b/pandas/tests/api/test_api.py index de2095ecad6b6..0af8ed0ebf8d5 100644 --- a/pandas/tests/api/test_api.py +++ b/pandas/tests/api/test_api.py @@ -1,7 +1,8 @@ +from typing import List + import pandas as pd from pandas import api, compat from pandas.util import testing as tm -from typing import List class Base: