File tree 2 files changed +11
-3
lines changed
2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change 26
26
# pylint disable=W0611
27
27
# flake8: noqa
28
28
29
+ import re
29
30
import functools
30
31
import itertools
31
32
from distutils .version import LooseVersion
@@ -136,7 +137,6 @@ def lfilter(*args, **kwargs):
136
137
137
138
else :
138
139
# Python 2
139
- import re
140
140
_name_re = re .compile (r"[a-zA-Z_][a-zA-Z0-9_]*$" )
141
141
142
142
FileNotFoundError = IOError
@@ -423,6 +423,14 @@ def raise_with_traceback(exc, traceback=Ellipsis):
423
423
parse_date = _date_parser .parse
424
424
425
425
426
+ # In Python 3.7, the private re._pattern_type is removed.
427
+ # Python 3.5+ have typing.re.Pattern
428
+ if PY35 :
429
+ import typing
430
+ re_type = typing .re .Pattern
431
+ else :
432
+ re_type = type (re .compile ('' ))
433
+
426
434
# https://github.com/pandas-dev/pandas/pull/9123
427
435
def is_platform_little_endian ():
428
436
""" am I little endian """
Original file line number Diff line number Diff line change 6
6
from collections import Iterable
7
7
from numbers import Number
8
8
from pandas .compat import (PY2 , string_types , text_type ,
9
- string_and_binary_types )
9
+ string_and_binary_types , re_type )
10
10
from pandas ._libs import lib
11
11
12
12
is_bool = lib .is_bool
@@ -216,7 +216,7 @@ def is_re(obj):
216
216
False
217
217
"""
218
218
219
- return isinstance (obj , re . _pattern_type )
219
+ return isinstance (obj , re_type )
220
220
221
221
222
222
def is_re_compilable (obj ):
You can’t perform that action at this time.
0 commit comments