Skip to content

Commit 7fafb35

Browse files
gwromejreback
authored andcommitted
Fix type annotation in pandas.compat (#26252)
1 parent c2c7939 commit 7fafb35

File tree

2 files changed

+2
-11
lines changed

2 files changed

+2
-11
lines changed

mypy.ini

-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ follow_imports=silent
55
[mypy-pandas.conftest,pandas.tests.*]
66
ignore_errors=True
77

8-
[mypy-pandas.compat]
9-
ignore_errors=True
10-
118
[mypy-pandas.core.api]
129
ignore_errors=True
1310

pandas/compat/__init__.py

+2-8
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
* platform checker
1212
"""
1313
import platform
14-
import re
1514
import struct
1615
import sys
16+
from typing import Pattern
1717

1818
PY36 = sys.version_info >= (3, 6)
1919
PY37 = sys.version_info >= (3, 7)
@@ -74,13 +74,7 @@ def raise_with_traceback(exc, traceback=Ellipsis):
7474
raise exc.with_traceback(traceback)
7575

7676

77-
# In Python 3.7, the private re._pattern_type is removed.
78-
# Python 3.5+ have typing.re.Pattern
79-
if PY36:
80-
import typing
81-
re_type = typing.re.Pattern
82-
else:
83-
re_type = type(re.compile(''))
77+
re_type = Pattern
8478

8579

8680
# https://github.com/pandas-dev/pandas/pull/9123

0 commit comments

Comments
 (0)