Skip to content

Commit

Permalink
re-order
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrockmendel committed Sep 6, 2024
1 parent 2bbf515 commit 7f891c7
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions pandas/core/arrays/_arrow_string_mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,20 @@ def _str_contains(
result = result.fill_null(na)
return self._convert_bool_result(result)

def _str_match(
self, pat: str, case: bool = True, flags: int = 0, na: Scalar | None = None
):
if not pat.startswith("^"):
pat = f"^{pat}"
return self._str_contains(pat, case, flags, na, regex=True)

def _str_fullmatch(
self, pat, case: bool = True, flags: int = 0, na: Scalar | None = None
):
if not pat.endswith("$") or pat.endswith("\\$"):
pat = f"{pat}$"
return self._str_match(pat, case, flags, na)

def _str_find(self, sub: str, start: int = 0, end: int | None = None):
if (
pa_version_under13p0
Expand Down Expand Up @@ -278,17 +292,3 @@ def _str_find(self, sub: str, start: int = 0, end: int | None = None):
offset_result = pc.add(result, start_offset)
result = pc.if_else(found, offset_result, -1)
return self._convert_int_result(result)

def _str_match(
self, pat: str, case: bool = True, flags: int = 0, na: Scalar | None = None
):
if not pat.startswith("^"):
pat = f"^{pat}"
return self._str_contains(pat, case, flags, na, regex=True)

def _str_fullmatch(
self, pat, case: bool = True, flags: int = 0, na: Scalar | None = None
):
if not pat.endswith("$") or pat.endswith("\\$"):
pat = f"{pat}$"
return self._str_match(pat, case, flags, na)

0 comments on commit 7f891c7

Please sign in to comment.