MCPcopy
hub / github.com/authlib/authlib / to_bytes

Function to_bytes

authlib/common/encoding.py:6–15  ·  view source on GitHub ↗
(x, charset="utf-8", errors="strict")

Source from the content-addressed store, hash-verified

4
5
6def to_bytes(x, charset="utf-8", errors="strict"):
7 if x is None:
8 return None
9 if isinstance(x, bytes):
10 return x
11 if isinstance(x, str):
12 return x.encode(charset, errors)
13 if isinstance(x, (int, float)):
14 return str(x).encode(charset, errors)
15 return bytes(x)
16
17
18def to_unicode(x, charset="utf-8", errors="strict"):

Callers 15

unwrapMethod · 0.90
u32be_len_inputFunction · 0.90
load_raw_keyMethod · 0.90
import_keyMethod · 0.90
serialize_compactMethod · 0.90
deserialize_compactMethod · 0.90
deserialize_jsonMethod · 0.90
deserializeMethod · 0.90
_validate_json_jwsMethod · 0.90
thumbprintMethod · 0.90

Calls 1

encodeMethod · 0.80

Used in the wild real call sites across dependent graphs

searching dependent graphs…