(
cls, seed: int | str, body: str, sanitize_key: bool = False
)
| 5989 | |
| 5990 | @classmethod |
| 5991 | def safe_construct( |
| 5992 | cls, seed: int | str, body: str, sanitize_key: bool = False |
| 5993 | ) -> _anonymous_label: |
| 5994 | # need to escape chars that interfere with format |
| 5995 | # strings in any case, issue #8724 |
| 5996 | body = _anonymous_label_escape.sub("_", body) |
| 5997 | |
| 5998 | if sanitize_key: |
| 5999 | # sanitize_key is then an extra step used by BindParameter |
| 6000 | body = body.strip("_") |
| 6001 | |
| 6002 | return _anonymous_label(f"%({seed} {body.replace('%', '%%')})s") |
| 6003 | |
| 6004 | def __add__(self, other: str) -> _anonymous_label: |
| 6005 | if "%" in other and not isinstance(other, _anonymous_label): |
no test coverage detected