diff --git a/backend/data_export/celery_tasks.py b/backend/data_export/celery_tasks.py index 5ad93e42..d5f0b8cc 100644 --- a/backend/data_export/celery_tasks.py +++ b/backend/data_export/celery_tasks.py @@ -8,9 +8,14 @@ from django.conf import settings from django.shortcuts import get_object_or_404 from .pipeline.dataset import Dataset -from .pipeline.factories import create_formatter, create_labels, create_writer, create_comment +from .pipeline.factories import ( + create_comment, + create_formatter, + create_labels, + create_writer, +) from .pipeline.services import ExportApplicationService -from data_export.models import ExportedExample, ExportedComment +from data_export.models import ExportedExample from projects.models import Member, Project logger = get_task_logger(__name__) diff --git a/backend/data_export/models.py b/backend/data_export/models.py index b4248699..ae6dd201 100644 --- a/backend/data_export/models.py +++ b/backend/data_export/models.py @@ -2,7 +2,7 @@ from typing import Any, Dict, Protocol, Tuple from django.db import models -from examples.models import Example, Comment +from examples.models import Comment, Example from labels.models import Category, Relation, Span, TextLabel from projects.models import Project @@ -87,4 +87,3 @@ class ExportedComment(Comment): class Meta: proxy = True - diff --git a/backend/data_export/pipeline/comments.py b/backend/data_export/pipeline/comments.py index 4aeb6bab..1e42428e 100644 --- a/backend/data_export/pipeline/comments.py +++ b/backend/data_export/pipeline/comments.py @@ -4,10 +4,8 @@ from typing import Dict, List, Tuple from django.db.models import QuerySet -from data_export.models import ( - ExportedExample, - ExportedComment, -) +from data_export.models import ExportedComment, ExportedExample + class Comments(abc.ABC): comment_class = ExportedComment diff --git a/backend/data_export/pipeline/dataset.py b/backend/data_export/pipeline/dataset.py index 0bee9179..c2c85c84 100644 --- a/backend/data_export/pipeline/dataset.py +++ b/backend/data_export/pipeline/dataset.py @@ -3,14 +3,15 @@ from typing import Any, Dict, Iterator, List import pandas as pd from django.db.models.query import QuerySet -from .labels import Labels from .comments import Comments -from data_export.models import ExportedExample, ExportedComment +from .labels import Labels +from data_export.models import ExportedExample class Dataset: - def __init__(self, examples: QuerySet[ExportedExample], labels: List[Labels], comments: List[Comments], - is_text_project=True): + def __init__( + self, examples: QuerySet[ExportedExample], labels: List[Labels], comments: List[Comments], is_text_project=True + ): self.examples = examples self.labels = labels self.is_text_project = is_text_project diff --git a/backend/data_export/pipeline/factories.py b/backend/data_export/pipeline/factories.py index 12e4afce..be139819 100644 --- a/backend/data_export/pipeline/factories.py +++ b/backend/data_export/pipeline/factories.py @@ -4,6 +4,7 @@ from django.db.models import QuerySet from . import writers from .catalog import CSV, JSON, JSONL, FastText +from .comments import Comments from .formatters import ( DictFormatter, FastTextCategoryFormatter, @@ -14,8 +15,7 @@ from .formatters import ( TupledSpanFormatter, ) from .labels import Categories, Labels, Relations, Spans, Texts -from .comments import Comments -from data_export.models import DATA, ExportedExample, ExportedComment +from data_export.models import DATA, ExportedExample from projects.models import ( DOCUMENT_CLASSIFICATION, IMAGE_CLASSIFICATION,