Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@post_load
def to_tuple(self, params, **kwargs):
return params["lower_bound"], params["upper_bound"]
@post_load
def make_pagination(self, data):
return Pagination(**data)
@post_load
def make_request(self, data):
"""Parse the outgoing schema"""
callname = self.context.get("callname")
try:
payload = REQUEST_MAP[callname].dump(data) # type: ignore
except AttributeError:
payload = None
request = {
"callname": callname,
"payload": payload
}
return Request(**request)
@marshmallow.post_load
def post_load(self, data, **kwargs):
del data["action"]
return types.StagedOrderSetDeliveryItemsAction(**data)
@post_load
def remove_envelope(self, data):
"""Post process data."""
# Remove envelope
if 'metadata' in data:
data = data['metadata']
# Artificially insert our schema because invenio-deposit wants it.
# TODO: Replace cd2hrepo... by configuration variable
data['$schema'] = (
'https://cd2hrepo.galter.northwestern.edu/'
'schemas/records/record-v0.1.0.json'
)
return data
@post_load
def make_user(self, data):
return User(**data)
@post_load
def make_experiment_run(self, data):
return ExperimentRun(**data)
@post_load
def add_tenant_info(self, data):
return data
@post_load
def make_credentials(self, data):
return Credentials(**data)
@post_load
def make_resource(self, data):
return Resource(**data)