Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def echo_nested(request):
argmap = {"name": fields.Nested({"first": fields.Str(), "last": fields.Str()})}
return json_response(parser.parse(argmap, request))
async def echo_nested_many_data_key(request):
data_key_kwarg = {
"load_from" if (MARSHMALLOW_VERSION_INFO[0] < 3) else "data_key": "X-Field"
}
args = {"x_field": fields.Nested({"id": fields.Int()}, many=True, **data_key_kwarg)}
parsed = await parser.parse(args, request)
return json_response(parsed)
def echo_nested():
args = {"name": fields.Nested({"first": fields.Str(), "last": fields.Str()})}
return J(parser.parse(args))
def on_post(self, req, resp):
args = {"name": fields.Nested({"first": fields.Str(), "last": fields.Str()})}
resp.body = json.dumps(parser.parse(args, req))
@use_args({'dataset_definition': wfields.Nested(_DatasetDefinitionShort,
many=True, required=True)})
@marshal_with(EmptySchema())
def post(self, dsid, **args):
fe = FeatureVectorizer(self._cache_dir, dsid=dsid, mode='r')
fe.remove(args['dataset_definition'])
return {}
'nonbookable_periods': fields.Nested({'start_dt': fields.Date(),
'end_dt': fields.Date()}, many=True)})
def _process(self, args):
if 'bookable_hours' in args:
self._check_invalid_times(args)
update_room_availability(self.room, args)
return jsonify(
nonbookable_periods=nonbookable_periods_schema.dump(self.room.nonbookable_periods, many=True),
bookable_hours=bookable_hours_schema.dump(self.room.bookable_hours, many=True)
)
@use_args({'data': wfields.Nested(DocumentIndexFullSchema, many=True),
'return_file_path': wfields.Bool(missing=True)})
@marshal_with(DocumentIndexNestedSchema())
def post(self, dsid, **args):
fe = FeatureVectorizer(self._cache_dir, dsid=dsid)
if 'data' in args and args['data']:
query = pd.DataFrame(args['data'])
fe.db_.filenames_ = fe.filenames_
res = fe.db_.search(query, return_file_path=args['return_file_path'])
else:
res = None
if args['return_file_path']:
fe.db_.filenames_ = fe.filenames_
res_repr = fe.db_.render_dict(res, return_file_path=args['return_file_path'])
return {'data': res_repr}
"dataset_definition": wfields.Nested(_DatasetDefinition, many=True),
"vectorize": wfields.Bool(missing=True),
"document_id_generator": wfields.Str(missing="indexed_file_path")})
@marshal_with(IDSchema())
def post(self, dsid, **args):
fe = FeatureVectorizer(self._cache_dir, dsid=dsid, mode='r')
fe.ingest(**args)
if fe.pars_['parse_email_headers']:
fe.parse_email_headers()
return {'id': fe.dsid}