Browse Source

Codacy code quality improvements

pull/217/head
erikamenezes 5 years ago
parent
commit
2ada3e6248
3 changed files with 2 additions and 3 deletions
  1. 1
      app/server/api.py
  2. 2
      app/server/tests/test_api.py
  3. 2
      app/server/utils.py

1
app/server/api.py

@ -209,7 +209,6 @@ class TextDownloadAPI(APIView):
project = get_object_or_404(Project, pk=self.kwargs['project_id'])
documents = project.documents.all()
painter = self.select_painter(format)
# json1 format prints text labels while json format prints annotations with label ids
# json1 format - "labels": [[0, 15, "PERSON"], ..]
# json format - "annotations": [{"label": 5, "start_offset": 0, "end_offset": 2, "user": 1},..]

2
app/server/tests/test_api.py

@ -907,7 +907,7 @@ class TestDownloader(APITestCase):
def test_can_download_labelling_json1(self):
self.download_test_helper(url=self.labeling_url,
format='json1',
expected_status=status.HTTP_200_OK)
expected_status=status.HTTP_200_OK)
def test_can_download_plain_text(self):
self.download_test_helper(url=self.classification_url,

2
app/server/utils.py

@ -392,6 +392,7 @@ class JSONPainter(object):
data.append(d)
return data
@staticmethod
def paint_labels(self, documents, labels):
serializer_labels = LabelSerializer(labels, many=True)
serializer = DocumentSerializer(documents, many=True)
@ -410,7 +411,6 @@ class JSONPainter(object):
data.append(d)
return data
class CSVPainter(JSONPainter):
def paint(self, documents):

Loading…
Cancel
Save