From c0580c740b224b6508ae26e0620ebf9c9912e20c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Saugat=20Pachhai=20=28=E0=A4=B8=E0=A5=8C=E0=A4=97=E0=A4=BE?= =?UTF-8?q?=E0=A4=A4=29?= Date: Tue, 19 Apr 2022 11:38:20 +0545 Subject: [PATCH] fs: move NoDirectoriesMixin to http filesystem --- dvc/fs/fsspec_wrapper.py | 18 ------------------ dvc/fs/http.py | 23 +++++++++++++++++++++-- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/dvc/fs/fsspec_wrapper.py b/dvc/fs/fsspec_wrapper.py index cb1793d71..09a43fbd2 100644 --- a/dvc/fs/fsspec_wrapper.py +++ b/dvc/fs/fsspec_wrapper.py @@ -198,21 +198,3 @@ class ObjectFSWrapper(FSSpecWrapper): return None yield from files - - -# pylint: disable=arguments-differ -class NoDirectoriesMixin: - def isdir(self, *args, **kwargs): - return False - - def isfile(self, *args, **kwargs): - return True - - def find(self, *args, **kwargs): - raise NotImplementedError - - def walk(self, *args, **kwargs): - raise NotImplementedError - - def ls(self, *args, **kwargs): - raise NotImplementedError diff --git a/dvc/fs/http.py b/dvc/fs/http.py index 934cc6ee6..f44a7c5d5 100644 --- a/dvc/fs/http.py +++ b/dvc/fs/http.py @@ -7,7 +7,7 @@ from dvc import prompt from dvc.scheme import Schemes from ._callback import DEFAULT_CALLBACK -from .fsspec_wrapper import AnyFSPath, FSSpecWrapper, NoDirectoriesMixin +from .fsspec_wrapper import AnyFSPath, FSSpecWrapper @wrap_with(threading.Lock()) @@ -33,7 +33,7 @@ def make_context(ssl_verify): # pylint: disable=abstract-method -class HTTPFileSystem(NoDirectoriesMixin, FSSpecWrapper): +class HTTPFileSystem(FSSpecWrapper): scheme = Schemes.HTTP PARAM_CHECKSUM = "checksum" REQUIRES = {"aiohttp": "aiohttp", "aiohttp-retry": "aiohttp_retry"} @@ -148,3 +148,22 @@ class HTTPFileSystem(NoDirectoriesMixin, FSSpecWrapper): ) -> None: kwargs.setdefault("method", self.upload_method) super().put_file(from_file, to_info, callback=callback, **kwargs) + + # pylint: disable=arguments-differ + + def find(self, *args, **kwargs): + raise NotImplementedError + + def isdir(self, *args, **kwargs): + return False + + def isfile(self, *args, **kwargs): + return True + + def ls(self, *args, **kwargs): + raise NotImplementedError + + def walk(self, *args, **kwargs): + raise NotImplementedError + + # pylint: enable=arguments-differ