From 410a0dcc866b928e8a780b4e13d8bf2e69a46eee Mon Sep 17 00:00:00 2001 From: Vaibhav Vishal Date: Fri, 19 Apr 2019 13:17:34 +0530 Subject: [PATCH 1/6] remove the module from mypy.ini and add type annotation --- mypy.ini | 3 --- pandas/core/accessor.py | 6 ++++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/mypy.ini b/mypy.ini index abec13b76cc21..bcf7795e04af5 100644 --- a/mypy.ini +++ b/mypy.ini @@ -11,9 +11,6 @@ ignore_errors=True [mypy-pandas.compat.numpy.function] ignore_errors=True -[mypy-pandas.core.accessor] -ignore_errors=True - [mypy-pandas.core.api] ignore_errors=True diff --git a/pandas/core/accessor.py b/pandas/core/accessor.py index 050749741e7bd..d415bfd6473e8 100644 --- a/pandas/core/accessor.py +++ b/pandas/core/accessor.py @@ -5,15 +5,17 @@ that can be mixed into or pinned onto other pandas classes. """ +from typing import FrozenSet import warnings from pandas.util._decorators import Appender class DirNamesMixin(object): - _accessors = frozenset() + _accessors = frozenset() # type: FrozenSet[str] _deprecations = frozenset( - ['asobject', 'base', 'data', 'flags', 'itemsize', 'strides']) + ['asobject', 'base', 'data', 'flags', 'itemsize', 'strides'] + ) # type: FrozenSet[str] def _dir_deletions(self): """ From 5fd05ae86113de01110f150baab6a41690eb34ea Mon Sep 17 00:00:00 2001 From: Vaibhav Vishal Date: Fri, 19 Apr 2019 14:35:15 +0530 Subject: [PATCH 2/6] consistently use `set` for `_accessors` instead of `frozenset` --- pandas/core/accessor.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/core/accessor.py b/pandas/core/accessor.py index c559092f8ad96..0d34e6b37b4f4 100644 --- a/pandas/core/accessor.py +++ b/pandas/core/accessor.py @@ -5,14 +5,14 @@ that can be mixed into or pinned onto other pandas classes. """ -from typing import FrozenSet +from typing import FrozenSet, Set import warnings from pandas.util._decorators import Appender class DirNamesMixin: - _accessors = frozenset() # type: FrozenSet[str] + _accessors = set() # type: Set[str] _deprecations = frozenset( ['asobject', 'base', 'data', 'flags', 'itemsize', 'strides'] ) # type: FrozenSet[str] From 3952bc8ca04d083d580b01db864f77924c29bed6 Mon Sep 17 00:00:00 2001 From: Vaibhav Vishal Date: Fri, 19 Apr 2019 18:25:10 +0530 Subject: [PATCH 3/6] remove pandas.core.apply from mypy.ini as well because it didn't actually had any errors --- mypy.ini | 3 --- 1 file changed, 3 deletions(-) diff --git a/mypy.ini b/mypy.ini index 9d136860a9533..8d24de07f731f 100644 --- a/mypy.ini +++ b/mypy.ini @@ -14,9 +14,6 @@ ignore_errors=True [mypy-pandas.core.api] ignore_errors=True -[mypy-pandas.core.apply] -ignore_errors=True - [mypy-pandas.core.arrays.array_] ignore_errors=True From 8c2be3c781b207ea714a1ebb253894129e2c51a7 Mon Sep 17 00:00:00 2001 From: Vaibhav Vishal Date: Sat, 20 Apr 2019 21:43:32 +0530 Subject: [PATCH 4/6] remove unnecessary type annotation --- pandas/core/accessor.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pandas/core/accessor.py b/pandas/core/accessor.py index 0d34e6b37b4f4..b979554372c55 100644 --- a/pandas/core/accessor.py +++ b/pandas/core/accessor.py @@ -14,8 +14,7 @@ class DirNamesMixin: _accessors = set() # type: Set[str] _deprecations = frozenset( - ['asobject', 'base', 'data', 'flags', 'itemsize', 'strides'] - ) # type: FrozenSet[str] + ['asobject', 'base', 'data', 'flags', 'itemsize', 'strides']) def _dir_deletions(self): """ From bcb44fcdf17f965d4e81048b046cfcbc790b808b Mon Sep 17 00:00:00 2001 From: Vaibhav Vishal Date: Sun, 21 Apr 2019 03:26:35 +0530 Subject: [PATCH 5/6] comment out all unnecessary modules from mypy.ini for testing --- mypy.ini | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mypy.ini b/mypy.ini index 8d24de07f731f..7ff7a886848a0 100644 --- a/mypy.ini +++ b/mypy.ini @@ -26,14 +26,14 @@ ignore_errors=True [mypy-pandas.core.arrays.interval] ignore_errors=True -[mypy-pandas.core.arrays.numpy_] -ignore_errors=True +; [mypy-pandas.core.arrays.numpy_] +; ignore_errors=True [mypy-pandas.core.arrays.period] ignore_errors=True -[mypy-pandas.core.arrays.sparse] -ignore_errors=True +; [mypy-pandas.core.arrays.sparse] +; ignore_errors=True [mypy-pandas.core.arrays.timedeltas] ignore_errors=True @@ -92,8 +92,8 @@ ignore_errors=True [mypy-pandas.core.series] ignore_errors=True -[mypy-pandas.core.sparse.frame] -ignore_errors=True +; [mypy-pandas.core.sparse.frame] +; ignore_errors=True [mypy-pandas.core.util.hashing] ignore_errors=True From dbadecb6660f7c1c16d44aaddd435d621c8a738b Mon Sep 17 00:00:00 2001 From: Vaibhav Vishal Date: Sun, 21 Apr 2019 16:59:59 +0530 Subject: [PATCH 6/6] remove unnecessary modules from mypy.ini and remove an unused import --- mypy.ini | 9 --------- pandas/core/accessor.py | 2 +- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/mypy.ini b/mypy.ini index 7ff7a886848a0..9d7262213413e 100644 --- a/mypy.ini +++ b/mypy.ini @@ -26,15 +26,9 @@ ignore_errors=True [mypy-pandas.core.arrays.interval] ignore_errors=True -; [mypy-pandas.core.arrays.numpy_] -; ignore_errors=True - [mypy-pandas.core.arrays.period] ignore_errors=True -; [mypy-pandas.core.arrays.sparse] -; ignore_errors=True - [mypy-pandas.core.arrays.timedeltas] ignore_errors=True @@ -92,9 +86,6 @@ ignore_errors=True [mypy-pandas.core.series] ignore_errors=True -; [mypy-pandas.core.sparse.frame] -; ignore_errors=True - [mypy-pandas.core.util.hashing] ignore_errors=True diff --git a/pandas/core/accessor.py b/pandas/core/accessor.py index b979554372c55..aeebe686c63cb 100644 --- a/pandas/core/accessor.py +++ b/pandas/core/accessor.py @@ -5,7 +5,7 @@ that can be mixed into or pinned onto other pandas classes. """ -from typing import FrozenSet, Set +from typing import Set import warnings from pandas.util._decorators import Appender