Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dvcfs: rename DvcFileSystem to DVCFileSystem #8307

Merged
merged 1 commit into from
Sep 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dvc/api/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from dvc.fs.dvc import _DvcFileSystem as DvcFileSystem
from dvc.fs.dvc import _DVCFileSystem as DVCFileSystem

from .data import open # pylint: disable=redefined-builtin
from .data import get_url, read
Expand All @@ -11,5 +11,5 @@
"open",
"params_show",
"read",
"DvcFileSystem",
"DVCFileSystem",
]
4 changes: 2 additions & 2 deletions dvc/dependency/repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def _get_used_and_obj(

def _check_circular_import(self, odb, obj_ids):
from dvc.exceptions import CircularImportError
from dvc.fs.dvc import DvcFileSystem
from dvc.fs.dvc import DVCFileSystem
from dvc_data.hashfile.db.reference import ReferenceHashFileDB
from dvc_data.hashfile.tree import Tree

Expand All @@ -169,7 +169,7 @@ def iter_objs():

checked_urls = set()
for obj in iter_objs():
if not isinstance(obj.fs, DvcFileSystem):
if not isinstance(obj.fs, DVCFileSystem):
continue
if (
obj.fs.repo_url in checked_urls
Expand Down
4 changes: 2 additions & 2 deletions dvc/fs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@
from dvc_objects.fs.path import Path # noqa: F401

from .data import DataFileSystem # noqa: F401
from .dvc import DvcFileSystem # noqa: F401
from .dvc import DVCFileSystem # noqa: F401
from .git import GitFileSystem # noqa: F401

known_implementations.update(
{
"dvc": {
"class": "dvc.fs.dvc.DvcFileSystem",
"class": "dvc.fs.dvc.DVCFileSystem",
"err": "dvc is supported, but requires 'dvc' to be installed",
},
"git": {
Expand Down
6 changes: 3 additions & 3 deletions dvc/fs/dvc.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def _get_dvc_path(dvc_fs, subkey):
return dvc_fs.path.join(*subkey) if subkey else ""


class _DvcFileSystem(AbstractFileSystem): # pylint:disable=abstract-method
class _DVCFileSystem(AbstractFileSystem): # pylint:disable=abstract-method
"""DVC + git-tracked files fs.

Args:
Expand Down Expand Up @@ -361,7 +361,7 @@ def _info(self, key, path, ignore_subrepos=True, check_ignored=True):
return info


class DvcFileSystem(FileSystem):
class DVCFileSystem(FileSystem):
protocol = "local"
PARAM_CHECKSUM = "md5"

Expand All @@ -371,7 +371,7 @@ def _prepare_credentials(self, **config):
@wrap_prop(threading.Lock())
@cached_property
def fs(self):
return _DvcFileSystem(**self.fs_args)
return _DVCFileSystem(**self.fs_args)

def isdvc(self, path, **kwargs):
return self.fs.isdvc(path, **kwargs)
Expand Down
10 changes: 5 additions & 5 deletions dvc/repo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def __init__(
self.config = Config(self.dvc_dir, fs=self.fs, config=config)
self._uninitialized = uninitialized

# used by DvcFileSystem to determine if it should traverse subrepos
# used by DVCFileSystem to determine if it should traverse subrepos
self.subrepos = subrepos

self.cloud = DataCloud(self)
Expand Down Expand Up @@ -526,9 +526,9 @@ def datafs(self):

@cached_property
def dvcfs(self):
from dvc.fs.dvc import DvcFileSystem
from dvc.fs.dvc import DVCFileSystem

return DvcFileSystem(
return DVCFileSystem(
repo=self, subrepos=self.subrepos, **self._fs_conf
)

Expand All @@ -540,13 +540,13 @@ def index_db_dir(self):
def open_by_relpath(self, path, remote=None, mode="r", encoding=None):
"""Opens a specified resource as a file descriptor"""
from dvc.fs.data import DataFileSystem
from dvc.fs.dvc import DvcFileSystem
from dvc.fs.dvc import DVCFileSystem

if os.path.isabs(path):
fs = DataFileSystem(index=self.index.data["local"])
fs_path = path
else:
fs = DvcFileSystem(repo=self, subrepos=True)
fs = DVCFileSystem(repo=self, subrepos=True)
fs_path = fs.from_os_path(path)

try:
Expand Down
4 changes: 2 additions & 2 deletions dvc/repo/collect.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ def _collect_paths(
recursive: bool = False,
rev: str = None,
) -> StrPaths:
from dvc.fs.dvc import DvcFileSystem
from dvc.fs.dvc import DVCFileSystem

fs = DvcFileSystem(repo=repo)
fs = DVCFileSystem(repo=repo)
fs_paths = [fs.from_os_path(target) for target in targets]

target_paths: StrPaths = []
Expand Down
4 changes: 2 additions & 2 deletions dvc/repo/diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ def diff(self, a_rev="HEAD", b_rev=None, targets=None):
if self.scm.no_commits:
return {}

from dvc.fs.dvc import DvcFileSystem
from dvc.fs.dvc import DVCFileSystem

dvcfs = DvcFileSystem(repo=self)
dvcfs = DVCFileSystem(repo=self)
targets = ensure_list(targets)
targets = [dvcfs.from_os_path(target) for target in targets]

Expand Down
4 changes: 2 additions & 2 deletions dvc/repo/ls.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from dvc.exceptions import PathMissingError

if TYPE_CHECKING:
from dvc.fs.dvc import DvcFileSystem
from dvc.fs.dvc import DVCFileSystem

from . import Repo

Expand Down Expand Up @@ -55,7 +55,7 @@ def ls(
def _ls(
repo: "Repo", path: str, recursive: bool = None, dvc_only: bool = False
):
fs: "DvcFileSystem" = repo.dvcfs
fs: "DVCFileSystem" = repo.dvcfs
fs_path = fs.from_os_path(path)

try:
Expand Down
4 changes: 2 additions & 2 deletions dvc/repo/metrics/show.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from scmrepo.exceptions import SCMError

from dvc.fs.dvc import DvcFileSystem
from dvc.fs.dvc import DVCFileSystem
from dvc.output import Output
from dvc.repo import locked
from dvc.repo.collect import StrPaths, collect
Expand Down Expand Up @@ -77,7 +77,7 @@ def _read_metric(path, fs, rev, **kwargs):


def _read_metrics(repo, metrics, rev, onerror=None):
fs = DvcFileSystem(repo=repo)
fs = DVCFileSystem(repo=repo)

relpath = ""
if repo.root_dir != repo.fs.path.getcwd():
Expand Down
8 changes: 4 additions & 4 deletions dvc/repo/plots/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,9 @@ def _collect_data_sources(
props: Optional[Dict] = None,
onerror: Optional[Callable] = None,
):
from dvc.fs.dvc import DvcFileSystem
from dvc.fs.dvc import DVCFileSystem

fs = DvcFileSystem(repo=self.repo)
fs = DVCFileSystem(repo=self.repo)

props = props or {}

Expand Down Expand Up @@ -472,9 +472,9 @@ def _collect_definitions(
result: Dict = defaultdict(dict)
props = props or {}

from dvc.fs.dvc import DvcFileSystem
from dvc.fs.dvc import DVCFileSystem

fs = DvcFileSystem(repo=repo)
fs = DVCFileSystem(repo=repo)

if not config_files:
dpath.util.merge(
Expand Down
4 changes: 2 additions & 2 deletions dvc/testing/test_api.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest

from dvc import api
from dvc.api import DvcFileSystem
from dvc.api import DVCFileSystem
from dvc.utils.fs import remove


Expand Down Expand Up @@ -59,7 +59,7 @@ def test_filesystem(
path=tmp_dir, posixpath=tmp_dir.as_posix()
)

fs = DvcFileSystem(**fs_kwargs)
fs = DVCFileSystem(**fs_kwargs)

assert fs.ls("/", detail=False) == M.unordered(
"/.gitignore", "/scripts", "/data"
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ exclude =
console_scripts =
dvc = dvc.cli:main
fsspec.specs =
dvc = dvc.api:DvcFileSystem
dvc = dvc.api:DVCFileSystem

[flake8]
ignore=
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/fs/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def test_open_dirty_hash(tmp_dir, dvc):

fs = DataFileSystem(index=dvc.index.data["repo"])
with fs.open("file", "r") as fobj:
# NOTE: Unlike DvcFileSystem, DataFileSystem should not
# NOTE: Unlike DVCFileSystem, DataFileSystem should not
# be affected by a dirty workspace.
assert fobj.read() == "file"

Expand All @@ -71,7 +71,7 @@ def test_open_dirty_no_hash(tmp_dir, dvc):
(tmp_dir / "file.dvc").write_text("outs:\n- path: file\n")

fs = DataFileSystem(index=dvc.index.data["repo"])
# NOTE: Unlike DvcFileSystem, DataFileSystem should not
# NOTE: Unlike DVCFileSystem, DataFileSystem should not
# be affected by a dirty workspace.
with pytest.raises(FileNotFoundError):
with fs.open("file", "r"):
Expand Down
Loading