Repository: pandas-dev/pandas
File: pandas/core/strings/object_array.py (Python)

Code before:

            return self._str_map(scalar_rep, dtype=str)
        else:
            from pandas.core.arrays.string_ import BaseStringArray

            def rep(x, r):
                if x is libmissing.NA:
                    return x
                try:
                    return bytes.__mul__(x, r)
                except TypeError:
                    return str.__mul__(x, r)

            result = libops.vec_binop(
                np.asarray(self),
                np.asarray(repeats, dtype=object),
                rep,
            )
            if not isinstance(self, BaseStringArray):
                return result
            # Not going through map, so we have to do this here.
            return type(self)._from_sequence(result, dtype=self.dtype)

    def _str_match(
        self,
        pat,
        case: bool = True,
        flags: int = 0,
        na: Scalar | lib.NoDefault = lib.no_default,
    ):
        if not case:
            flags |= re.IGNORECASE
        if isinstance(pat, re.Pattern):
            pat = pat.pattern
        regex = re.compile(pat, flags=flags)

        f = lambda x: regex.match(x) is not None
        return self._str_map(f, na_value=na, dtype=np.dtype(bool))

    def _str_fullmatch(
        self,
        pat: str | re.Pattern,
        case: bool = True,
        flags: int = 0,
        na: Scalar | lib.NoDefault = lib.no_default,
    ):
        if not case:
            flags |= re.IGNORECASE
        if isinstance(pat, re.Pattern):
            pat = pat.pattern
        regex = re.compile(pat, flags=flags)

Review comment (suggestion):
```suggestion
        pat: str | re.Pattern,
```

Code after:

            return self._str_map(scalar_rep, dtype=str)
        else:
            from pandas.core.arrays.string_ import BaseStringArray

            def rep(x, r):
                if x is libmissing.NA:
                    return x
                try:
                    return bytes.__mul__(x, r)
                except TypeError:
                    return str.__mul__(x, r)

            result = libops.vec_binop(
                np.asarray(self),
                np.asarray(repeats, dtype=object),
                rep,
            )
            if not isinstance(self, BaseStringArray):
                return result
            # Not going through map, so we have to do this here.
            return type(self)._from_sequence(result, dtype=self.dtype)

    def _str_match(
        self,
        pat: str | re.Pattern,
        case: bool = True,
        flags: int = 0,
        na: Scalar | lib.NoDefault = lib.no_default,
    ):
        if not case:
            flags |= re.IGNORECASE
        if isinstance(pat, re.Pattern):
            pat = pat.pattern
        regex = re.compile(pat, flags=flags)

        f = lambda x: regex.match(x) is not None
        return self._str_map(f, na_value=na, dtype=np.dtype(bool))

    def _str_fullmatch(
        self,
        pat: str | re.Pattern,
        case: bool = True,
        flags: int = 0,
        na: Scalar | lib.NoDefault = lib.no_default,
    ):
        if not case:
            flags |= re.IGNORECASE
        if isinstance(pat, re.Pattern):
            pat = pat.pattern
        regex = re.compile(pat, flags=flags)