MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / _escaped_like_impl

Function _escaped_like_impl

lib/sqlalchemy/sql/operators.py:2347–2366  ·  view source on GitHub ↗
(
    fn: Callable[..., Any], other: Any, escape: Optional[str], autoescape: bool
)

Source from the content-addressed store, hash-verified

2345
2346
2347def _escaped_like_impl(
2348 fn: Callable[..., Any], other: Any, escape: Optional[str], autoescape: bool
2349) -> Any:
2350 if autoescape:
2351 if autoescape is not True:
2352 util.warn(
2353 "The autoescape parameter is now a simple boolean True/False"
2354 )
2355 if escape is None:
2356 escape = "/"
2357
2358 if not isinstance(other, str):
2359 raise TypeError("String value expected when autoescape=True")
2360
2361 if escape not in ("%", "_"):
2362 other = other.replace(escape, escape + escape)
2363
2364 other = other.replace("%", escape + "%").replace("_", escape + "_")
2365
2366 return fn(other, escape=escape)
2367
2368
2369@comparison_op

Callers 12

startswith_opFunction · 0.85
not_startswith_opFunction · 0.85
istartswith_opFunction · 0.85
not_istartswith_opFunction · 0.85
endswith_opFunction · 0.85
not_endswith_opFunction · 0.85
iendswith_opFunction · 0.85
not_iendswith_opFunction · 0.85
contains_opFunction · 0.85
not_contains_opFunction · 0.85
icontains_opFunction · 0.85
not_icontains_opFunction · 0.85

Calls 2

warnMethod · 0.45
replaceMethod · 0.45

Tested by

no test coverage detected