Skip to content

Commit 6b40689

Browse files
committed
CLN: clean compat.re_type
1 parent f46ab96 commit 6b40689

File tree

3 files changed

+3
-12
lines changed

3 files changed

+3
-12
lines changed

pandas/compat/__init__.py

-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import platform
1414
import struct
1515
import sys
16-
from typing import Pattern
1716

1817
PY36 = sys.version_info >= (3, 6)
1918
PY37 = sys.version_info >= (3, 7)
@@ -74,9 +73,6 @@ def raise_with_traceback(exc, traceback=Ellipsis):
7473
raise exc.with_traceback(traceback)
7574

7675

77-
re_type = Pattern
78-
79-
8076
# https://github.com/pandas-dev/pandas/pull/9123
8177
def is_platform_little_endian():
8278
""" am I little endian """

pandas/core/dtypes/inference.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
from collections import abc
44
from numbers import Number
55
import re
6+
from typing import Pattern
67

78
import numpy as np
89

910
from pandas._libs import lib
10-
from pandas.compat import re_type
1111

1212
is_bool = lib.is_bool
1313

@@ -209,8 +209,7 @@ def is_re(obj):
209209
>>> is_re("foo")
210210
False
211211
"""
212-
213-
return isinstance(obj, re_type)
212+
return isinstance(obj, Pattern)
214213

215214

216215
def is_re_compilable(obj):

pandas/tests/test_compat.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import builtins
55
import re
66

7-
from pandas.compat import lmap, lrange, lzip, re_type
7+
from pandas.compat import lmap, lrange, lzip
88

99

1010
class TestBuiltinIterators:
@@ -40,7 +40,3 @@ def test_lzip(self):
4040
expecteds = list(builtins.zip(*lst)),
4141
lengths = 10,
4242
self.check_results(results, expecteds, lengths)
43-
44-
45-
def test_re_type():
46-
assert isinstance(re.compile(''), re_type)

0 commit comments

Comments
 (0)