mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-10 07:18:27 +01:00
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:
@@ -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)
|
||||
|
||||
@@ -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 = ""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user