Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def resolver(schema):
schema_instance = common.resolve_schema_instance(schema)
prefix = "Partial-" if schema_instance.partial else ""
schema_cls = common.resolve_schema_cls(schema)
name = prefix + schema_cls.__name__
if name.endswith("Schema"):
return name[:-6] or name
return name
def load(self, data, many=None, partial=None):
if not isinstance(data, dict):
return UnmarshalResult({}, {'_schema': 'Invalid data type: %s' % data})
schema = common.resolve_schema_instance(self.value_type)
res = []
for key, value in data.items():
payload = value.copy()
payload[self.key_name] = key
result = schema.load(payload)
res.append(result.data)
return UnmarshalResult(res, [])