From fa45a9bbba0469355dc50d2e0068f6c11f6ced69 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: Thu, 15 Sep 2022 14:42:11 +0545 Subject: [PATCH] dvcfs: default open to binary mode --- dvc/fs/dvc.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/dvc/fs/dvc.py b/dvc/fs/dvc.py index 3c114d7f2..5b17e5b33 100644 --- a/dvc/fs/dvc.py +++ b/dvc/fs/dvc.py @@ -218,23 +218,20 @@ class _DvcFileSystem(AbstractFileSystem): # pylint:disable=abstract-method dvc_fs = self._datafss.get(repo_key) return repo, dvc_fs, subkey - def open( - self, path, mode="r", encoding="utf-8", **kwargs + def _open( + self, path, mode="rb", **kwargs ): # pylint: disable=arguments-renamed, arguments-differ - if "b" in mode: - encoding = None - key = self._get_key_from_relative(path) fs_path = self._from_key(key) try: - return self.repo.fs.open(fs_path, mode=mode, encoding=encoding) + return self.repo.fs.open(fs_path, mode=mode) except FileNotFoundError: _, dvc_fs, subkey = self._get_subrepo_info(key) if not dvc_fs: raise dvc_path = _get_dvc_path(dvc_fs, subkey) - return dvc_fs.open(dvc_path, mode=mode, encoding=encoding, **kwargs) + return dvc_fs.open(dvc_path, mode=mode) def isdvc(self, path, **kwargs): key = self._get_key_from_relative(path)