Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def create_view():
"""Example endpoint return create a color
"""
current_app.logger.info("Create color")
if connexion.request.is_json:
data = connexion.request.get_json()
color = Color(name=data["name"])
db.session.add(color)
db.session.commit()
return jsonify(ColorSchema().dump(color))
return jsonify({})
def create_users_with_list_input(body): # noqa: E501
"""Creates list of users with given input array
# noqa: E501
:param body: List of user object
:type body: list | bytes
:rtype: None
"""
if connexion.request.is_json:
body = [User.from_dict(d) for d in connexion.request.get_json()] # noqa: E501
return 'do some magic!'
def data_context_topology_context_post(tapi_topology_topology_context=None): # noqa: E501
"""data_context_topology_context_post
creates tapi.topology.TopologyContext # noqa: E501
:param tapi_topology_topology_context: tapi.topology.TopologyContext to be added to list
:type tapi_topology_topology_context: dict | bytes
:rtype: None
"""
if connexion.request.is_json:
tapi_topology_topology_context = TapiTopologyTopologyContext.from_dict(connexion.request.get_json()) # noqa: E501
return 'do some magic!'
def add_pet(pet): # noqa: E501
"""Add a new pet to the store
# noqa: E501
:param pet: Pet object that needs to be added to the store
:type pet: dict | bytes
:rtype: None
"""
if connexion.request.is_json:
pet = Pet.from_dict(connexion.request.get_json()) # noqa: E501
return 'do some magic!'
def create_users_with_list_input(user): # noqa: E501
"""Creates list of users with given input array
# noqa: E501
:param user: List of user object
:type user: list | bytes
:rtype: None
"""
if connexion.request.is_json:
user = [User.from_dict(d) for d in connexion.request.get_json()] # noqa: E501
return 'do some magic!'
def translate(body): # noqa: E501
"""Translate natural language question into a standardized query
# noqa: E501
:param body: Question object that needs to be translated
:type body: dict | bytes
:rtype: List[Query]
"""
if connexion.request.is_json:
question = connexion.request.get_json()
txltr = ParseQuestion()
query = txltr.format_response(question)
return query
"""pipelines_name_version_post
Start new instance of pipeline. Specify the source and destination parameters as URIs # noqa: E501
:param name:
:type name: str
:param version:
:type version: int
:param pipeline_request:
:type pipeline_request: dict | bytes
:rtype: None
"""
logger.debug("POST on /pipelines/{name}/{version}".format(name=name, version=version))
if connexion.request.is_json:
try:
pipeline_id, err = PipelineManager.create_instance(name, version, connexion.request.get_json())
if pipeline_id is not None:
return pipeline_id
return (err, HTTPStatus.BAD_REQUEST)
except Exception as e:
logger.error('pipelines_name_version_post ' +e)
return ('Unexpected error', HTTPStatus.INTERNAL_SERVER_ERROR)
def update_pet(pet): # noqa: E501
"""Update an existing pet
# noqa: E501
:param pet: Pet object that needs to be added to the store
:type pet: dict | bytes
:rtype: None
"""
if connexion.request.is_json:
pet = Pet.from_dict(connexion.request.get_json()) # noqa: E501
return 'do some magic!'
def create_users_with_array_input(user): # noqa: E501
"""Creates list of users with given input array
# noqa: E501
:param user: List of user object
:type user: list | bytes
:rtype: None
"""
if connexion.request.is_json:
user = [User.from_dict(d) for d in connexion.request.get_json()] # noqa: E501
return 'do some magic!'
def add_a_summary_post(summary): # noqa: E501
"""Add a summary to meta server.
# noqa: E501
:param summary: A summary of the specialist server.
:type summary: dict | bytes
:rtype: InlineResponse200
"""
if connexion.request.is_json:
summary = Summary.from_dict(connexion.request.get_json()) # noqa: E501
engine_name = summary.engine_name()
sp_host = summary.sp_host()
dump = summary.dump()
res = meta_gateway.add_new_sp_server(sp_host, engine_name, dump)
return res