From 01e5f9eaddf6cfdf4a7443c9f9c2a21c231e30e8 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, 17 May 2022 14:34:46 +0545 Subject: [PATCH] objects.hash: use fobj.read instead of read1 --- dvc/objects/hash.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/dvc/objects/hash.py b/dvc/objects/hash.py index 497c93632..b3e0eb959 100644 --- a/dvc/objects/hash.py +++ b/dvc/objects/hash.py @@ -3,8 +3,6 @@ import io import logging from typing import TYPE_CHECKING, Any, BinaryIO, Dict, Optional, Tuple -from funcy import cached_property - from .fs._callback import DEFAULT_CALLBACK, FsspecCallback, TqdmCallback from .fs.implementations.local import localfs from .fs.utils import is_exec @@ -50,14 +48,8 @@ class HashedStreamReader(io.IOBase): def tell(self) -> int: return self.fobj.tell() - @cached_property - def _reader(self): - if hasattr(self.fobj, "read1"): - return self.fobj.read1 - return self.fobj.read - def read(self, n=-1) -> bytes: - chunk = self._reader(n) + chunk = self.fobj.read(n) if self.is_text is None and chunk: # do we need to buffer till the DEFAULT_CHUNK_SIZE? self.is_text = istextblock(chunk[:DEFAULT_CHUNK_SIZE])