From d2c8708b6f04c4e0e146522452c903e87866bbe0 Mon Sep 17 00:00:00 2001 From: Jakob Cornell Date: Thu, 3 Feb 2022 19:17:57 -0600 Subject: [PATCH] Appease Mypy a bit --- disk_jumble/src/disk_jumble/tests/test_verify.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/disk_jumble/src/disk_jumble/tests/test_verify.py b/disk_jumble/src/disk_jumble/tests/test_verify.py index eea5007..75f166d 100644 --- a/disk_jumble/src/disk_jumble/tests/test_verify.py +++ b/disk_jumble/src/disk_jumble/tests/test_verify.py @@ -414,7 +414,7 @@ class _Torrent: self.info_hash = hashlib.sha1(self.info).digest() -def _random_file(size: int, rand_src: Random, on_disk: bool) -> tempfile.NamedTemporaryFile: +def _random_file(size: int, rand_src: Random, on_disk: bool) -> io.BufferedIOBase: f = tempfile.NamedTemporaryFile(buffering = _BUF_SIZE) if on_disk else io.BytesIO() try: while f.tell() < size: @@ -436,7 +436,7 @@ class _ReadErrorProxy(io.BufferedIOBase): def __post_init__(self): self.triggered = 0 - def read(self, size: int = -1) -> bytes: + def read(self, size: Optional[int] = None) -> bytes: pre_pos = self.wrapped.tell() data = self.wrapped.read(size) erroring = self.error_count is None or self.triggered < self.error_count -- 2.30.2