You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"""Requires string input. Returns namespace and local tag name as a pair. I could've sworn this was a basic implementation gimme, but ET.QName ain't it."""
This function is a utility function for the two whole-object serialization methods, print_dfxml (to string) and to_Element (to ET.Element).
2424
2425
2425
2426
This function will mutate the input argument volume_element, removing the 'poststream' elements. volume_element is expected to be the element created by self.to_partial_Element.
2426
2427
2427
2428
Returns a list of child elements in DFXML Schema order. List might be empty.
2428
2429
2429
-
This subroutine implements a re-serialization implementation decision: elements in extension namespaces can appear at the beginning or end of the volume XML child list, per the DFXML Schema. All of the externals are put into the beginning of the element in to_partial_Element. Hence, error will be the last child.
2430
+
This subroutine implements a re-serialization implementation decision: elements in extension namespaces can appear only at the end of the volume XML child list, per the DFXML Schema. All of the externals are put into the end of the element in to_partial_Element.
2430
2431
"""
2431
-
retval= []
2432
+
retval: typing.List[ET.Element] = []
2433
+
2434
+
# Find all non-DFXML-namespaced elements by working from back of list of child elements, stopping when list is empty, or when a DFXML-namespaced element is encountered.
2435
+
whilelen(volume_element) >0:
2436
+
if_qsplit(volume_element[-1].tag)[0] in [None, dfxml.XMLNS_DFXML, ""]:
# This branch of code should only be reached in unit testing, as it depends on the output of self.to_partial_Element.
2443
-
ifvolume_element.find("error"):
2444
-
raiseValueError("Inconsistent serialization state: Partial volume XML element has an immediate child named 'error', but not as the last child as expected from the schema.")
# Output the error property (which will be popped and re-appended after the file list in to_Element).
2592
-
# The error should come last because of the two spots extended elements can be placed; this is to simplify the file-listing VolumeObject.to_Element() method.
2593
2595
_append_str("error")
2594
2596
2597
+
foreinself.externals:
2598
+
outel.append(e)
2599
+
2595
2600
iflen(diffs_whittle_set) >0:
2596
2601
_logger.warning("Did not annotate all of the differing properties of this volume. Remaining properties: %r."%diffs_whittle_set)
2597
2602
@@ -2649,12 +2654,12 @@ def error(self, val):
2649
2654
self._error=_strcast(val)
2650
2655
2651
2656
@property
2652
-
defexternals(self):
2657
+
defexternals(self)->OtherNSElementList:
2653
2658
"""(This property behaves the same as FileObject.externals.)"""
0 commit comments