MCPcopy
hub / github.com/psycopg/psycopg / as_bytes

Method as_bytes

psycopg/psycopg/sql.py:215–218  ·  view source on GitHub ↗
(self, context: AdaptContext | None = None)

Source from the content-addressed store, hash-verified

213 return self._obj
214
215 def as_bytes(self, context: AdaptContext | None = None) -> bytes:
216 conn = context.connection if context else None
217 enc = conn_encoding(conn)
218 return self._obj.encode(enc)
219
220 def format(self, *args: Any, **kwargs: Any) -> Composed:
221 """

Callers 15

test_as_bytesMethod · 0.45
test_as_bytes_no_connMethod · 0.45
test_escape_no_connMethod · 0.45
test_as_bytesMethod · 0.45
test_as_bytes_no_connMethod · 0.45
test_as_bytesMethod · 0.45
test_no_connMethod · 0.45
test_as_bytesFunction · 0.45
test_as_bytes_contextFunction · 0.45
test_as_bytes_literalFunction · 0.45
test_as_bytesFunction · 0.45

Calls 1

conn_encodingFunction · 0.85

Tested by 13

test_as_bytesMethod · 0.36
test_as_bytes_no_connMethod · 0.36
test_escape_no_connMethod · 0.36
test_as_bytesMethod · 0.36
test_as_bytes_no_connMethod · 0.36
test_as_bytesMethod · 0.36
test_no_connMethod · 0.36
test_as_bytesFunction · 0.36
test_as_bytes_contextFunction · 0.36
test_as_bytes_literalFunction · 0.36
test_as_bytesFunction · 0.36