| 407 | |
| 408 | |
| 409 | class _AnyStrPlaceholder(_Placeholder[AnyStr]): |
| 410 | def __init__(self, match: AnyStr): |
| 411 | super().__init__(type(match)) |
| 412 | self._match = match |
| 413 | |
| 414 | def setdefault(self, value: AnyStr) -> AnyStr: |
| 415 | if self._obj is None: |
| 416 | super().setdefault(value) |
| 417 | if not re.search(self._match, self._obj, re.DOTALL): # type: ignore |
| 418 | raise ValueError(f"{self._obj!r} does not match {self._match!r}.") |
| 419 | return self._obj |
| 420 | |
| 421 | |
| 422 | # noinspection PyPep8Naming |
no outgoing calls
no test coverage detected
searching dependent graphs…