Appease Mypy a bit
authorJakob Cornell <jakob+gpg@jcornell.net>
Fri, 4 Feb 2022 01:17:57 +0000 (19:17 -0600)
committerJakob Cornell <jakob+gpg@jcornell.net>
Fri, 4 Feb 2022 01:17:57 +0000 (19:17 -0600)
disk_jumble/src/disk_jumble/tests/test_verify.py

index eea5007fa6cdf4500db396636b877ff73e6f8ce7..75f166d6f49508ca7baf46c3ec6edb7567967d02 100644 (file)
@@ -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