MCPcopy Index your code
hub / github.com/python/mypy / encode_bytes_as_c_string

Function encode_bytes_as_c_string

mypyc/codegen/cstring.py:43–46  ·  view source on GitHub ↗

Produce contents of a C string literal for a byte string, without quotes.

(b: bytes)

Source from the content-addressed store, hash-verified

41
42
43def encode_bytes_as_c_string(b: bytes) -> str:
44 """Produce contents of a C string literal for a byte string, without quotes."""
45 escaped = "".join([CHAR_MAP[i] for i in b])
46 return escaped
47
48
49def c_string_initializer(value: bytes) -> str:

Callers 1

c_string_initializerFunction · 0.85

Calls 1

joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…