mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-13 23:10:15 +01:00
The code are wrapped due to us using line-length=79 before, but now some of the code can easily fit in 88 chars. The formatter did not change this automatically when we changed line-length, because of magic trailing commas that gets added when they turn into multiple lines. Black/ruff wrapping them in parens and splitting them into multiple lines was making it difficult to read.
41 lines
904 B
Python
41 lines
904 B
Python
import functools
|
|
import os
|
|
from typing import TYPE_CHECKING
|
|
|
|
from dvc.log import logger
|
|
from dvc.utils import as_posix
|
|
from dvc_objects.fs.base import FileSystem
|
|
|
|
if TYPE_CHECKING:
|
|
from dvc_data.fs import DataFileSystem as _DataFileSystem
|
|
|
|
|
|
logger = logger.getChild(__name__)
|
|
|
|
|
|
class DataFileSystem(FileSystem):
|
|
protocol = "local"
|
|
|
|
PARAM_CHECKSUM = "md5"
|
|
|
|
def _prepare_credentials(self, **config):
|
|
return config
|
|
|
|
@functools.cached_property
|
|
def fs(self) -> "_DataFileSystem":
|
|
from dvc_data.fs import DataFileSystem as _DataFileSystem
|
|
|
|
return _DataFileSystem(**self.fs_args)
|
|
|
|
def getcwd(self):
|
|
return self.fs.getcwd()
|
|
|
|
def isdvc(self, path, **kwargs):
|
|
return self.fs.isdvc(path, **kwargs)
|
|
|
|
def from_os_path(self, path):
|
|
if os.path.isabs(path):
|
|
path = os.path.splitdrive(path)[1]
|
|
|
|
return as_posix(path)
|