diff --git a/mypy.ini b/mypy.ini index 596d71c77317e..63ccb6eb994ba 100644 --- a/mypy.ini +++ b/mypy.ini @@ -5,9 +5,6 @@ follow_imports=silent [mypy-pandas.conftest,pandas.tests.*] ignore_errors=True -[mypy-pandas.compat] -ignore_errors=True - [mypy-pandas.core.api] ignore_errors=True diff --git a/pandas/compat/__init__.py b/pandas/compat/__init__.py index 5c256a53b5036..32b3d318dd57c 100644 --- a/pandas/compat/__init__.py +++ b/pandas/compat/__init__.py @@ -11,9 +11,9 @@ * platform checker """ import platform -import re import struct import sys +from typing import Pattern PY36 = sys.version_info >= (3, 6) PY37 = sys.version_info >= (3, 7) @@ -74,13 +74,7 @@ def raise_with_traceback(exc, traceback=Ellipsis): raise exc.with_traceback(traceback) -# In Python 3.7, the private re._pattern_type is removed. -# Python 3.5+ have typing.re.Pattern -if PY36: - import typing - re_type = typing.re.Pattern -else: - re_type = type(re.compile('')) +re_type = Pattern # https://github.com/pandas-dev/pandas/pull/9123