File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed
Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change 2626# pylint disable=W0611
2727# flake8: noqa
2828
29+ import re
2930import functools
3031import itertools
3132from distutils .version import LooseVersion
@@ -136,7 +137,6 @@ def lfilter(*args, **kwargs):
136137
137138else :
138139 # Python 2
139- import re
140140 _name_re = re .compile (r"[a-zA-Z_][a-zA-Z0-9_]*$" )
141141
142142 FileNotFoundError = IOError
@@ -423,6 +423,14 @@ def raise_with_traceback(exc, traceback=Ellipsis):
423423parse_date = _date_parser .parse
424424
425425
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+
426434# https://github.com/pandas-dev/pandas/pull/9123
427435def is_platform_little_endian ():
428436 """ am I little endian """
Original file line number Diff line number Diff line change 66from collections import Iterable
77from numbers import Number
88from pandas .compat import (PY2 , string_types , text_type ,
9- string_and_binary_types )
9+ string_and_binary_types , re_type )
1010from pandas ._libs import lib
1111
1212is_bool = lib .is_bool
@@ -216,7 +216,7 @@ def is_re(obj):
216216 False
217217 """
218218
219- return isinstance (obj , re . _pattern_type )
219+ return isinstance (obj , re_type )
220220
221221
222222def is_re_compilable (obj ):
You can’t perform that action at this time.
0 commit comments