@@ -626,24 +626,27 @@ def _encode_value(parent: ET.Element, name: str, value: Any) -> None:
626
626
the value to be encoded
627
627
628
628
"""
629
+ # note: the type: ignore annotations can be removed once
630
+ # https://github.com/python/typeshed/pull/11841 is merged or the underlying
631
+ # issue fixed
629
632
if isinstance (value , str ):
630
633
el = ET .SubElement (parent , name )
631
- el .set (f"{{{ XSI } }}type" , ET .QName (XSD , "string" ))
634
+ el .set (f"{{{ XSI } }}type" , ET .QName (XSD , "string" )) # type: ignore
632
635
el .text = str (value )
633
636
elif isinstance (value , int ):
634
637
# This includes booleans, as bool is a subtype of int
635
638
el = ET .SubElement (parent , name )
636
- el .set (f"{{{ XSI } }}type" , ET .QName (XSD , "int" ))
639
+ el .set (f"{{{ XSI } }}type" , ET .QName (XSD , "int" )) # type: ignore
637
640
el .text = str (int (value ))
638
641
elif isinstance (value , Iterable ):
639
642
if isinstance (value , Mapping ):
640
643
# Flatten the dictionary
641
644
value = [x for pair in value .items () for x in pair ]
642
645
el = ET .SubElement (parent , name )
643
- el .set (f"{{{ XSI } }}type" , ET .QName (SOAPENC , "Array" ))
646
+ el .set (f"{{{ XSI } }}type" , ET .QName (SOAPENC , "Array" )) # type: ignore
644
647
el .set (
645
648
f"{{{ SOAPENC } }}arrayType" ,
646
- ET .QName (XSD , "anyType[%d]" % len (value )),
649
+ ET .QName (XSD , "anyType[%d]" % len (value )), # type: ignore
647
650
)
648
651
for x in value :
649
652
_encode_value (el , "item" , x )
0 commit comments