95f5c79a1d97630f9afbcbe2d3906ed4e0f24777,app/server/views.py,DataUpload,post,#DataUpload#Any#,53
Before Change
project = get_object_or_404(Project, pk=kwargs.get("project_id"))
try:
form_data = TextIOWrapper(request.FILES["csv_file"].file, encoding="utf-8")
reader = csv.reader(form_data)
for line in reader:
text = line[0]
Document(text=text, project=project).save()
return HttpResponseRedirect(reverse("dataset", args=[project.id]))
except:
return HttpResponseRedirect(reverse("dataset-upload", args=[project.id]))
After Change
project = get_object_or_404(Project, pk=kwargs.get("project_id"))
try:
form_data = TextIOWrapper(request.FILES["csv_file"].file, encoding="utf-8")
Document.objects.bulk_create([Document(
text=line.strip(),
project=project) for line in form_data])
return HttpResponseRedirect(reverse("dataset", args=[project.id]))
except:
return HttpResponseRedirect(reverse("dataset-upload", args=[project.id]))
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 4
Instances
Project Name: chakki-works/doccano
Commit Name: 95f5c79a1d97630f9afbcbe2d3906ed4e0f24777
Time: 2018-08-14
Author: light.tree.1.13@gmail.com
File Name: app/server/views.py
Class Name: DataUpload
Method Name: post
Project Name: okfn-brasil/serenata-de-amor
Commit Name: 6a75ec12d58d45bc939cc249630fa476c8c95231
Time: 2016-09-08
Author: cuducos@gmail.com
File Name: jarbas/core/management/commands/loaddatasets.py
Class Name: Command
Method Name: handle
Project Name: UFAL-DSG/tgen
Commit Name: cfe0c6d61b595d3bc23cf424c2799c96ca733e41
Time: 2014-08-22
Author: odusek@ufal.mff.cuni.cz
File Name: tgen/tgen.py
Class Name:
Method Name: asearch_gen