Skip to content

Commit

Permalink
sort imports for all libraries starting with dvc_ as a first party
Browse files Browse the repository at this point in the history
dvc_studio_client, dvc_ssh, etc. were not properly sorted.
  • Loading branch information
skshetry committed Mar 23, 2024
1 parent e223f51 commit 0801ecc
Show file tree
Hide file tree
Showing 14 changed files with 17 additions and 19 deletions.
3 changes: 1 addition & 2 deletions dvc/commands/studio.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@

class CmdStudioLogin(CmdConfig):
def run(self):
from dvc_studio_client.auth import StudioAuthError, get_access_token

from dvc.env import DVC_STUDIO_URL
from dvc.ui import ui
from dvc.utils.studio import STUDIO_URL
from dvc_studio_client.auth import StudioAuthError, get_access_token

name = self.args.name
hostname = self.args.hostname or os.environ.get(DVC_STUDIO_URL) or STUDIO_URL
Expand Down
3 changes: 1 addition & 2 deletions dvc/fs/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
from typing import Optional
from urllib.parse import urlparse

from dvc_http import HTTPFileSystem, HTTPSFileSystem # noqa: F401

from dvc.config import ConfigError as RepoConfigError
from dvc.config_schema import SCHEMA, Invalid
from dvc_http import HTTPFileSystem, HTTPSFileSystem # noqa: F401

# pylint: disable=unused-import
from dvc_objects.fs import ( # noqa: F401
Expand Down
3 changes: 1 addition & 2 deletions dvc/repo/artifacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,9 @@ def _download_studio(
dvc_studio_config: Optional[dict[str, Any]] = None,
**kwargs,
) -> tuple[int, str]:
from dvc_studio_client.model_registry import get_download_uris

from dvc.fs import HTTPFileSystem, generic, localfs
from dvc.fs.callbacks import TqdmCallback
from dvc_studio_client.model_registry import get_download_uris

logger.debug("Trying to download artifact '%s' via studio", name)
out = out or os.getcwd()
Expand Down
3 changes: 1 addition & 2 deletions dvc/repo/experiments/executor/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,9 +585,8 @@ def _repro_dvc(
message: Optional[str] = None,
**kwargs,
) -> Iterator["Repo"]:
from dvc_studio_client.post_live_metrics import post_live_metrics

from dvc.repo import Repo
from dvc_studio_client.post_live_metrics import post_live_metrics

with Repo(os.path.join(info.root_dir, info.dvc_dir)) as dvc:
info.status = TaskStatus.RUNNING
Expand Down
2 changes: 1 addition & 1 deletion dvc/repo/experiments/queue/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from dataclasses import asdict, dataclass
from typing import TYPE_CHECKING, Any, NamedTuple, Optional, Union

from dvc_studio_client.post_live_metrics import get_studio_config
from funcy import retry

from dvc.dependency import ParamsDependency
Expand All @@ -24,6 +23,7 @@
)
from dvc.utils.objects import cached_property
from dvc.utils.studio import config_to_env
from dvc_studio_client.post_live_metrics import get_studio_config

from .utils import get_remote_executor_refs

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ strict = true
ignore-variadic-names = true

[tool.ruff.lint.isort]
known-first-party = ["dvc", "dvc_data", "dvc_objects", "dvc_render", "dvc_task", "tests"]
known-first-party = ["dvc", "dvc_*", "tests"]

[tool.ruff.lint.pep8-naming]
extend-ignore-names = ["M", "SCM"]
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_studio_live_experiments.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import pytest
from dvc_studio_client import env, post_live_metrics
from funcy import first

from dvc.env import (
Expand All @@ -12,6 +11,7 @@
from dvc.repo import Repo
from dvc.testing.scripts import COPY_SCRIPT
from dvc.utils.studio import get_subrepo_relpath
from dvc_studio_client import env, post_live_metrics


@pytest.mark.studio
Expand Down
1 change: 1 addition & 0 deletions tests/remotes/git_server.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pytest

from dvc_ssh.tests.cloud import SSH, TEST_SSH_KEY_PATH, TEST_SSH_USER


Expand Down
2 changes: 1 addition & 1 deletion tests/unit/command/test_studio.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import pytest
from dvc_studio_client.auth import AuthorizationExpiredError

from dvc import env
from dvc.cli import main
from dvc.utils.studio import STUDIO_URL
from dvc_studio_client.auth import AuthorizationExpiredError


@pytest.fixture(autouse=True)
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/fs/test_fs.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import pytest
from dvc_http import HTTPFileSystem, HTTPSFileSystem
from dvc_s3 import S3FileSystem
from dvc_ssh import SSHFileSystem

from dvc.config import RemoteNotFoundError
from dvc.fs import LocalFileSystem, get_cloud_fs, get_fs_cls, get_fs_config
from dvc_http import HTTPFileSystem, HTTPSFileSystem
from dvc_s3 import S3FileSystem
from dvc_ssh import SSHFileSystem

url_cls_pairs = [
("s3://bucket/path", S3FileSystem),
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/output/test_load.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import pytest
from dvc_s3 import S3FileSystem

from dvc import output
from dvc.fs import LocalFileSystem
from dvc.output import Output
from dvc.stage import Stage
from dvc_s3 import S3FileSystem


@pytest.mark.parametrize(
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/remote/test_remote.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import pytest
from dvc_gs import GSFileSystem
from dvc_s3 import S3FileSystem

from dvc.fs import get_cloud_fs
from dvc_gs import GSFileSystem
from dvc_s3 import S3FileSystem


def test_remote_with_hash_jobs(dvc):
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/remote/test_webdav.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest
from dvc_webdav import WebDAVFileSystem, WebDAVSFileSystem

from dvc.fs import get_cloud_fs
from dvc_webdav import WebDAVFileSystem, WebDAVSFileSystem
from tests.utils.asserts import issubset

url_fmt = "{scheme}://{user}@example.com/public.php/webdav"
Expand Down
1 change: 1 addition & 0 deletions tests/unit/remote/test_webhdfs.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import pytest
import requests

from dvc_webhdfs import WebHDFSFileSystem

host = "host"
Expand Down

0 comments on commit 0801ecc

Please sign in to comment.