From 045d1f5e3e150fca5af697125ca1767c9c0de421 Mon Sep 17 00:00:00 2001 From: Ruslan Kuprieiev Date: Wed, 10 Nov 2021 17:04:04 +0200 Subject: [PATCH] localfs: remove LocalPath fs.path is meant to be lightweight, and we should try to avoid using os.path. Leftover from #6946 --- dvc/fs/local.py | 15 --------------- dvc/utils/__init__.py | 2 +- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/dvc/fs/local.py b/dvc/fs/local.py index 58d6fa3e2..2e191fb0c 100644 --- a/dvc/fs/local.py +++ b/dvc/fs/local.py @@ -1,8 +1,6 @@ import logging import os -from funcy import cached_property - from dvc.scheme import Schemes from dvc.system import System from dvc.utils import is_exec, tmp_fname @@ -10,19 +8,10 @@ from dvc.utils.fs import copy_fobj_to_file, copyfile, makedirs, move, remove from ..progress import DEFAULT_CALLBACK from .base import BaseFileSystem -from .path import Path logger = logging.getLogger(__name__) -class LocalPath(Path): - def parent(self, path): - return os.path.dirname(path) - - def drive(self, path): - return os.path.splitdrive(path)[0] - - class LocalFileSystem(BaseFileSystem): sep = os.sep @@ -37,10 +26,6 @@ class LocalFileSystem(BaseFileSystem): super().__init__(**config) self.fs = LocalFS() - @cached_property - def path(self): - return LocalPath(os.sep) - @staticmethod def open(path, mode="r", encoding=None, **kwargs): return open(path, mode=mode, encoding=encoding) diff --git a/dvc/utils/__init__.py b/dvc/utils/__init__.py index 41338e98d..409f0eab9 100644 --- a/dvc/utils/__init__.py +++ b/dvc/utils/__init__.py @@ -376,7 +376,7 @@ def resolve_paths(repo, out, always_local=False): scheme = urlparse(out).scheme - if os.name == "nt" and scheme == localfs.path.drive(abspath)[0].lower(): + if os.name == "nt" and scheme == os.path.splitdrive(abspath)[0][0].lower(): # urlparse interprets windows drive letters as URL scheme scheme = ""