Skip to content

Commit

Permalink
Sort imports
Browse files Browse the repository at this point in the history
  • Loading branch information
Marishka17 committed Jan 7, 2025
1 parent bdadb6c commit 820f63d
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 24 deletions.
7 changes: 4 additions & 3 deletions cvat/apps/dataset_manager/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
#
# SPDX-License-Identifier: MIT

from contextlib import nullcontext
import io
from collections.abc import Mapping
from contextlib import nullcontext
from typing import Any, Callable
import io

import rq
from datumaro.components.errors import DatasetError, DatasetImportError, DatasetNotFoundError
from django.conf import settings
from django.utils import timezone
from django.db import transaction
from django.utils import timezone

from cvat.apps.dataset_manager.task import TaskAnnotation
from cvat.apps.dataset_manager.util import TmpDirManager
Expand Down
9 changes: 4 additions & 5 deletions cvat/apps/dataset_manager/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,16 @@
import io
import itertools
from collections import OrderedDict
from contextlib import nullcontext
from copy import deepcopy
from enum import Enum
from typing import Optional, Union, Callable

from contextlib import nullcontext
from django.utils import timezone
from typing import Callable, Optional, Union

from datumaro.components.errors import DatasetError, DatasetImportError, DatasetNotFoundError
from django.conf import settings
from django.db import transaction
from django.db.models.query import Prefetch, QuerySet
from django.utils import timezone
from rest_framework.exceptions import ValidationError

from cvat.apps.dataset_manager.annotation import AnnotationIR, AnnotationManager
Expand All @@ -28,11 +27,11 @@
)
from cvat.apps.dataset_manager.formats.registry import make_exporter, make_importer
from cvat.apps.dataset_manager.util import (
TmpDirManager,
add_prefetch_fields,
bulk_create,
faster_deepcopy,
get_cached,
TmpDirManager,
)
from cvat.apps.engine import models, serializers
from cvat.apps.engine.log import DatasetLogManager
Expand Down
2 changes: 1 addition & 1 deletion cvat/apps/dataset_manager/tests/test_rest_api_formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
from rest_framework import status

import cvat.apps.dataset_manager as dm
from cvat.apps.dataset_manager.cron import clear_export_cache
from cvat.apps.dataset_manager.bindings import CvatTaskOrJobDataExtractor, TaskData
from cvat.apps.dataset_manager.cron import clear_export_cache
from cvat.apps.dataset_manager.task import TaskAnnotation
from cvat.apps.dataset_manager.tests.utils import TestDir
from cvat.apps.dataset_manager.util import get_export_cache_lock
Expand Down
4 changes: 2 additions & 2 deletions cvat/apps/dataset_manager/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
import os
import os.path as osp
import re
import zipfile
import tempfile
import zipfile
from collections.abc import Generator, Sequence
from contextlib import contextmanager
from copy import deepcopy
from datetime import timedelta
from enum import Enum
from pathlib import Path
from threading import Lock
from typing import Any
from pathlib import Path

import attrs
import django_rq
Expand Down
6 changes: 2 additions & 4 deletions cvat/apps/dataset_manager/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,15 @@
from cvat.apps.engine.utils import get_rq_lock_by_user

from .formats.registry import EXPORT_FORMATS, IMPORT_FORMATS
from .util import EXPORT_CACHE_DIR_NAME # pylint: disable=unused-import
from .util import (
ExportCacheManager,
LockNotAvailableError,
TmpDirManager,
current_function_name,
extend_export_file_lifetime,
get_export_cache_lock,
ExportCacheManager,
TmpDirManager,
)


slogger = ServerLogManager(__name__)

_MODULE_NAME = __package__ + '.' + osp.splitext(osp.basename(__file__))[0]
Expand Down
7 changes: 3 additions & 4 deletions cvat/apps/engine/backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,15 @@
import os
import re
import shutil
import tempfile
import uuid
from abc import ABCMeta, abstractmethod
from collections.abc import Collection, Iterable
from datetime import timedelta
from enum import Enum
from logging import Logger
from tempfile import NamedTemporaryFile
from typing import Any, Optional, Union, Type
from typing import Any, Optional, Type, Union
from zipfile import ZipFile
from datetime import timedelta

import django_rq
from django.conf import settings
Expand All @@ -31,8 +30,8 @@

import cvat.apps.dataset_manager as dm
from cvat.apps.dataset_manager.bindings import CvatImportError
from cvat.apps.dataset_manager.views import log_exception
from cvat.apps.dataset_manager.util import ExportCacheManager, TmpDirManager
from cvat.apps.dataset_manager.views import log_exception
from cvat.apps.engine import models
from cvat.apps.engine.cloud_provider import import_resource_from_cloud_storage
from cvat.apps.engine.location import StorageType, get_location_configuration
Expand Down
2 changes: 1 addition & 1 deletion cvat/apps/engine/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
from django.core.files.storage import FileSystemStorage
from django.db import IntegrityError, models, transaction
from django.db.models import Q, TextChoices
from django.db.models.fields import FloatField
from django.db.models.base import ModelBase
from django.db.models.fields import FloatField
from django.utils.translation import gettext_lazy as _
from drf_spectacular.types import OpenApiTypes
from drf_spectacular.utils import extend_schema_field
Expand Down
4 changes: 2 additions & 2 deletions cvat/apps/engine/tests/test_rest_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
# SPDX-License-Identifier: MIT


import django_rq
import copy
import io
import json
Expand All @@ -27,6 +26,7 @@
from unittest import mock

import av
import django_rq
import numpy as np
from django.conf import settings
from django.contrib.auth.models import Group, User
Expand Down Expand Up @@ -3108,7 +3108,7 @@ def test_api_v2_tasks_id_export_no_auth(self):
self._run_api_v2_tasks_id_export_import(None)

def test_can_remove_export_cache_automatically_after_successful_export(self):
from cvat.apps.dataset_manager.cron import cron_export_cache_cleanup, clear_export_cache
from cvat.apps.dataset_manager.cron import clear_export_cache, cron_export_cache_cleanup
self._create_tasks()
task_id = self.tasks[0]["id"]
user = self.admin
Expand Down
5 changes: 3 additions & 2 deletions cvat/apps/engine/tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,20 @@
import itertools
import logging
import os
import shutil
from collections.abc import Iterator, Sequence
from contextlib import contextmanager
from io import BytesIO
from pathlib import Path
from typing import Any, Callable, TypeVar
import shutil

import av
import django_rq
import numpy as np
from django.conf import settings
from django.core.cache import caches
from django.http.response import HttpResponse
from PIL import Image
from pathlib import Path
from rest_framework.test import APITestCase

T = TypeVar('T')
Expand Down

0 comments on commit 820f63d

Please sign in to comment.