From: Jakob Cornell Date: Fri, 4 Feb 2022 01:17:57 +0000 (-0600) Subject: Appease Mypy a bit X-Git-Url: https://jcornell.net/gitweb/gitweb.cgi?a=commitdiff_plain;h=d2c8708b6f04c4e0e146522452c903e87866bbe0;p=eros.git Appease Mypy a bit --- 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