MCPcopy Create free account
hub / github.com/sissaschool/xmlschema / raw_encode_value

Function raw_encode_value

xmlschema/utils/decoding.py:72–81  ·  view source on GitHub ↗

Encodes a simple value to XML.

(value: DecodedValueType)

Source from the content-addressed store, hash-verified

70
71
72def raw_encode_value(value: DecodedValueType) -> Optional[str]:
73 """Encodes a simple value to XML."""
74 if isinstance(value, bool):
75 return 'true' if value else 'false'
76 elif isinstance(value, (list, tuple)):
77 return ' '.join(e for e in (raw_encode_value(v) for v in value) if e is not None)
78 elif isinstance(value, bytes):
79 return value.decode()
80 else:
81 return str(value) if value is not None else None
82
83
84def raw_encode_attributes(attributes: DecodedAttributesType = None) \

Callers 12

textMethod · 0.90
raw_encodeMethod · 0.90
raw_encodeMethod · 0.90
raw_decodeMethod · 0.90
raw_encodeMethod · 0.90
raw_decodeMethod · 0.90
raw_encodeMethod · 0.90
raise_or_collectMethod · 0.90
raw_encodeMethod · 0.90
raw_encode_attributesFunction · 0.85

Calls 1

decodeMethod · 0.45

Tested by 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…