MCPcopy Index your code
hub / github.com/zzzeek/sqlalchemy / safe_construct_with_key

Method safe_construct_with_key

lib/sqlalchemy/sql/elements.py:5975–5988  ·  view source on GitHub ↗
(
        cls, seed: int | str, body: str, sanitize_key: bool = False
    )

Source from the content-addressed store, hash-verified

5973
5974 @classmethod
5975 def safe_construct_with_key(
5976 cls, seed: int | str, body: str, sanitize_key: bool = False
5977 ) -> typing_Tuple[_anonymous_label, str]:
5978 # need to escape chars that interfere with format
5979 # strings in any case, issue #8724
5980 body = _anonymous_label_escape.sub("_", body)
5981
5982 if sanitize_key:
5983 # sanitize_key is then an extra step used by BindParameter
5984 body = body.strip("_")
5985
5986 key = f"{seed} {body.replace('%', '%%')}"
5987 label = _anonymous_label(f"%({key})s")
5988 return label, key
5989
5990 @classmethod
5991 def safe_construct(

Callers 4

__init__Method · 0.80
_cloneMethod · 0.80
_convert_to_uniqueMethod · 0.80
__setstate__Method · 0.80

Calls 4

_anonymous_labelClass · 0.85
subMethod · 0.80
stripMethod · 0.80
replaceMethod · 0.45

Tested by

no test coverage detected