MCPcopy Index your code
hub / github.com/python/cpython / serialize

Function serialize

Lib/test/test_xml_etree.py:167–178  ·  view source on GitHub ↗
(elem, to_string=True, encoding='unicode', **options)

Source from the content-addressed store, hash-verified

165
166
167def serialize(elem, to_string=True, encoding='unicode', **options):
168 if encoding != 'unicode':
169 file = io.BytesIO()
170 else:
171 file = io.StringIO()
172 tree = ET.ElementTree(elem)
173 tree.write(file, encoding=encoding, **options)
174 if to_string:
175 return file.getvalue()
176 else:
177 file.seek(0)
178 return file
179
180def summarize_list(seq):
181 return [elem.tag for elem in seq]

Callers 15

serialize_checkMethod · 0.85
test_methodsMethod · 0.85
test_issue18347Method · 0.85
test_entityMethod · 0.85
test_xinclude_defaultMethod · 0.85
test_xincludeMethod · 0.85
checkMethod · 0.85
test_bug_xmltoolkit54Method · 0.85
test_bug_1534630Method · 0.85

Calls 3

writeMethod · 0.95
getvalueMethod · 0.95
seekMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…