MCPcopy Create free account
hub / github.com/Textualize/textual / encode_dict

Function encode_dict

src/textual/_binary_encode.py:123–135  ·  view source on GitHub ↗

Encode a dictionary value. Args: datum: The dictionary value to encode. Returns: The encoded bytes.

(datum: dict)

Source from the content-addressed store, hash-verified

121 return b"t%se" % b"".join(encode(element) for element in datum)
122
123 def encode_dict(datum: dict) -> bytes:
124 """
125 Encode a dictionary value.
126
127 Args:
128 datum: The dictionary value to encode.
129
130 Returns:
131 The encoded bytes.
132 """
133 return b"d%se" % b"".join(
134 b"%s%s" % (encode(key), encode(value)) for key, value in datum.items()
135 )
136
137 ENCODERS: dict[type, Callable[[Any], Any]] = {
138 type(None): encode_none,

Callers

nothing calls this directly

Calls 3

encodeFunction · 0.85
itemsMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…