f8a72a0a60658d462753fe39a2119932358ccca5,app/server/views.py,DataUpload,post,#DataUpload#Any#,58
Before Change
elif import_format == "json":
form_data = request.FILES["file"].file
Document.objects.bulk_create([
Document(text=json.loads(entry)["text"], project=project)
for entry in form_data
])
return HttpResponseRedirect(reverse("dataset", args=[project.id]))
After Change
// TODO: Move to the configuration
batch_size = 500
while True:
batch = list(it.islice(documents, batch_size))
if not batch:
break
Document.objects.bulk_create(batch, batch_size=batch_size)
return HttpResponseRedirect(reverse("dataset", args=[project.id]))
except DataUpload.ImportFileError as e:
messages.add_message(request, messages.ERROR, e.message)
return HttpResponseRedirect(reverse("upload", args=[project.id]))
except Exception as e:
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 3
Instances
Project Name: chakki-works/doccano
Commit Name: f8a72a0a60658d462753fe39a2119932358ccca5
Time: 2018-12-26
Author: sergiy.n@attendify.com
File Name: app/server/views.py
Class Name: DataUpload
Method Name: post
Project Name: home-assistant/home-assistant
Commit Name: 09d531b3b95e7943df53233d1abcb40d7e87de94
Time: 2016-08-18
Author: nkgilley@gmail.com
File Name: homeassistant/components/media_player/gpmdp.py
Class Name: GPMDP
Method Name: update
Project Name: chakki-works/doccano
Commit Name: 49d41416e440926f0a9a8243b4d77f6f5468efe9
Time: 2019-03-12
Author: light.tree.1.13@gmail.com
File Name: app/server/utils.py
Class Name: JsonHandler
Method Name: parse