MCPcopy
hub / github.com/psycopg/psycopg / no_e

Function no_e

tests/test_sql.py:691–701  ·  view source on GitHub ↗

Drop an eventual E from E'' quotes

(s)

Source from the content-addressed store, hash-verified

689
690
691def no_e(s):
692 """Drop an eventual E from E'' quotes"""
693 if isinstance(s, (memoryview, bytearray)):
694 s = bytes(s)
695
696 if isinstance(s, str):
697 return re.sub(r"\bE'", "'", s)
698 elif isinstance(s, bytes):
699 return re.sub(rb"\bE'", b"'", s)
700 else:
701 raise TypeError(f"not dealing with {type(s).__name__}: {s}")

Callers 15

test_as_stringMethod · 0.85
test_as_bytesMethod · 0.85
test_as_bytes_no_connMethod · 0.85
test_joinMethod · 0.85
test_auto_literalMethod · 0.85
test_sumMethod · 0.85
test_sum_inplaceMethod · 0.85
test_as_stringFunction · 0.85
test_as_string_contextFunction · 0.85
test_as_string_literalFunction · 0.85
test_as_bytesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…