localfs: remove LocalPath

fs.path is meant to be lightweight, and we should try to avoid using os.path.

Leftover from #6946
This commit is contained in:
Ruslan Kuprieiev
2021-11-10 20:10:48 +02:00
parent 5214aec1bb
commit 045d1f5e3e
2 changed files with 1 additions and 16 deletions
-15
View File
@@ -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)
+1 -1
View File
@@ -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 = ""