538a32457740b46992ebc648f0e2aa54b7a4009a,external_api/api.py,,transfer_entities,#Any#,51
Before Change
status, error = datastore_object.transfer_entities(entity_list=entity_list)
result = {"status": status, "error": error}
if not status:
HttpResponse(json.dumps({"data": result}), content_type="application/json", status=500)
return HttpResponse(json.dumps({"data": result}), content_type="application/json", status=200)
After Change
HttpResponse : HttpResponse with appropriate status.
response = {"success": False, "error": ""}
try:
entity_list_dict = json.loads(request.GET.get("word_info"))
entity_list = entity_list_dict.get("entity_list")
datastore_object = DataStore()
datastore_object.transfer_entities(entity_list=entity_list)
response["success"] = True
except (ValueError, IndexNotFoundException, InvalidESURLException,
SourceDestinationSimilarException, InternalBackupException, AliasNotFoundException,
PointIndexToAliasException, FetchIndexForAliasException, DeleteIndexFromAliasException,
AliasForTransferException, IndexForTransferException) as error_message:
response["error"] = error_message
return HttpResponse(json.dumps(response), content_type="application/json", status=500)
except BaseException:
response["error"] = "Base exception occured"
return HttpResponse(json.dumps(response), content_type="application/json", status=500)
return HttpResponse(json.dumps(response), content_type="application/json", status=200)
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 5
Instances
Project Name: hellohaptik/chatbot_ner
Commit Name: 538a32457740b46992ebc648f0e2aa54b7a4009a
Time: 2018-08-20
Author: pratik.jayarao@haptik.co
File Name: external_api/api.py
Class Name:
Method Name: transfer_entities
Project Name: merenlab/anvio
Commit Name: 7246172861ef035dec5ffe7343a0315ce000ab7b
Time: 2019-10-02
Author: ozcanesen@gmail.com
File Name: anvio/bottleroutes.py
Class Name: BottleApplication
Method Name: get_taxonomy
Project Name: deepmipt/DeepPavlov
Commit Name: 48373446ecf9ef563b02c360be347da02df09ce9
Time: 2019-08-05
Author: ignatov.fedor@gmail.com
File Name: deeppavlov/utils/socket/socket.py
Class Name:
Method Name: handle_connection