MCPcopy
hub / github.com/pika/pika / as_bytes

Function as_bytes

pika/compat.py:66–72  ·  view source on GitHub ↗

Returns value as bytes

(value: Union[str, bytes])

Source from the content-addressed store, hash-verified

64
65
66def as_bytes(value: Union[str, bytes]) -> bytes:
67 """
68 Returns value as bytes
69 """
70 if not isinstance(value, bytes):
71 return value.encode('UTF-8')
72 return value
73
74
75def to_digit(value: str) -> int:

Callers 15

encodeMethod · 0.90
encodeMethod · 0.90
encodeMethod · 0.90
encodeMethod · 0.90
encodeMethod · 0.90
encodeMethod · 0.90
encode_short_stringFunction · 0.90
encode_valueFunction · 0.90
basic_publishMethod · 0.90
on_messageMethod · 0.90
on_messageMethod · 0.90
on_getMethod · 0.90

Calls 1

encodeMethod · 0.45

Tested by 15

on_messageMethod · 0.72
on_messageMethod · 0.72
on_getMethod · 0.72
testMethod · 0.72
testMethod · 0.72
testMethod · 0.72
testMethod · 0.72
testMethod · 0.72
testMethod · 0.72
testMethod · 0.72
testMethod · 0.72
testMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…