From cb2d061572ff7433e5a1b8f24ae590ee1f58b5a8 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: Fri, 31 Jan 2025 14:38:26 +0545 Subject: [PATCH 1/2] fs: remove unnecessary get_file method This method was a temporary workaround. The issue was fixed and released in 2023.3.0, and we are currently requiring 2024.2.0. --- src/scmrepo/fs.py | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/src/scmrepo/fs.py b/src/scmrepo/fs.py index 55428e40..52f0162b 100644 --- a/src/scmrepo/fs.py +++ b/src/scmrepo/fs.py @@ -242,32 +242,3 @@ def ls(self, path, detail=True, **kwargs): return paths return [self.info(_path) for _path in paths] - - def get_file( - self, rpath, lpath, callback=_DEFAULT_CALLBACK, outfile=None, **kwargs - ): - # NOTE: temporary workaround while waiting for - # https://github.com/fsspec/filesystem_spec/pull/1191 - - if isfilelike(lpath): - outfile = lpath - elif self.isdir(rpath): - os.makedirs(lpath, exist_ok=True) - return None - - with self.open(rpath, "rb", **kwargs) as f1: - if outfile is None: - outfile = open(lpath, "wb") # noqa: SIM115 - - try: - callback.set_size(getattr(f1, "size", None)) - data = True - while data: - data = f1.read(self.blocksize) - segment_len = outfile.write(data) - if segment_len is None: - segment_len = len(data) - callback.relative_update(segment_len) - finally: - if not isfilelike(lpath): - outfile.close() From 122b13f7461392f5871534fdcdaeaad91c166fb1 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 31 Jan 2025 08:56:45 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/scmrepo/fs.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/scmrepo/fs.py b/src/scmrepo/fs.py index 52f0162b..86d5b38b 100644 --- a/src/scmrepo/fs.py +++ b/src/scmrepo/fs.py @@ -3,9 +3,7 @@ import posixpath from typing import TYPE_CHECKING, Any, BinaryIO, Callable, Optional -from fsspec.callbacks import _DEFAULT_CALLBACK from fsspec.spec import AbstractFileSystem -from fsspec.utils import isfilelike if TYPE_CHECKING: from io import BytesIO