Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
value = kwargs['filler'](self)
else:
for result in xsd_type.iter_decode(text, validation, **kwargs):
if isinstance(result, XMLSchemaValidationError):
yield self.validation_error(validation, result, elem, **kwargs)
elif result is None and 'filler' in kwargs:
value = kwargs['filler'](self)
else:
value = result
if isinstance(value, Decimal):
try:
value = kwargs['decimal_type'](value)
except (KeyError, TypeError):
pass
elif isinstance(value, (AbstractDateTime, Duration)):
try:
if kwargs['datetime_types'] is not True:
value = elem.text
except KeyError:
value = elem.text
if converter is not None:
element_data = ElementData(elem.tag, value, content, attributes)
yield converter.element_decode(element_data, self, level)
if content is not None:
del content
if validation != 'skip':
if 'max_depth' in kwargs:
# Don't check key references with lazy or shallow validation
for constraint in filter(lambda x: not isinstance(x, XsdKeyref), self.identities.values()):
elif text == self.fixed or validation == 'skip':
pass
elif self.type.text_decode(text) != self.type.text_decode(self.fixed):
msg = "attribute {!r} has a fixed value {!r}".format(self.name, self.fixed)
yield self.validation_error(validation, msg, text, **kwargs)
for result in self.type.iter_decode(text, validation, **kwargs):
if isinstance(result, XMLSchemaValidationError):
yield result
elif isinstance(result, Decimal):
try:
yield kwargs['decimal_type'](result)
except (KeyError, TypeError):
yield result
break
elif isinstance(result, (AbstractDateTime, Duration)):
try:
yield result if kwargs['datetime_types'] is True else text
except KeyError:
yield text
else:
yield result
break