Skip to content

CLN: Remove compat.re_type #26279

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions pandas/compat/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import platform
import struct
import sys
from typing import Pattern

PY36 = sys.version_info >= (3, 6)
PY37 = sys.version_info >= (3, 7)
Expand Down Expand Up @@ -74,9 +73,6 @@ def raise_with_traceback(exc, traceback=Ellipsis):
raise exc.with_traceback(traceback)


re_type = Pattern


# https://github.com/pandas-dev/pandas/pull/9123
def is_platform_little_endian():
""" am I little endian """
Expand Down
5 changes: 2 additions & 3 deletions pandas/core/dtypes/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
from collections import abc
from numbers import Number
import re
from typing import Pattern

import numpy as np

from pandas._libs import lib
from pandas.compat import re_type

is_bool = lib.is_bool

Expand Down Expand Up @@ -209,8 +209,7 @@ def is_re(obj):
>>> is_re("foo")
False
"""

return isinstance(obj, re_type)
return isinstance(obj, Pattern)


def is_re_compilable(obj):
Expand Down
7 changes: 1 addition & 6 deletions pandas/tests/test_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
Testing that functions from compat work as expected
"""
import builtins
import re

from pandas.compat import lmap, lrange, lzip, re_type
from pandas.compat import lmap, lrange, lzip


class TestBuiltinIterators:
Expand Down Expand Up @@ -40,7 +39,3 @@ def test_lzip(self):
expecteds = list(builtins.zip(*lst)),
lengths = 10,
self.check_results(results, expecteds, lengths)


def test_re_type():
assert isinstance(re.compile(''), re_type)