Browse Source

Format codes according to flake8, black, and isort

pull/1897/head
Hironsan 2 years ago
parent
commit
1537d51531
5 changed files with 17 additions and 14 deletions
  1. 9
      backend/data_export/celery_tasks.py
  2. 3
      backend/data_export/models.py
  3. 6
      backend/data_export/pipeline/comments.py
  4. 9
      backend/data_export/pipeline/dataset.py
  5. 4
      backend/data_export/pipeline/factories.py

9
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__)

3
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

6
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

9
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

4
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,

Loading…
Cancel
Save