|
21 | 21 | from collections import OrderedDict |
22 | 22 | from datetime import datetime, timedelta |
23 | 23 | from typing import ( |
| 24 | + IO, |
24 | 25 | Any, |
25 | | - BinaryIO, |
26 | 26 | ClassVar, |
27 | 27 | Dict, |
28 | 28 | List, |
@@ -652,7 +652,7 @@ class BaseFile: |
652 | 652 |
|
653 | 653 | @staticmethod |
654 | 654 | def _verify_hashes( |
655 | | - data: Union[bytes, BinaryIO], expected_hashes: Dict[str, str] |
| 655 | + data: Union[bytes, IO[bytes]], expected_hashes: Dict[str, str] |
656 | 656 | ) -> None: |
657 | 657 | """Verifies that the hash of 'data' matches 'expected_hashes'""" |
658 | 658 | is_bytes = isinstance(data, bytes) |
@@ -681,7 +681,7 @@ def _verify_hashes( |
681 | 681 |
|
682 | 682 | @staticmethod |
683 | 683 | def _verify_length( |
684 | | - data: Union[bytes, BinaryIO], expected_length: int |
| 684 | + data: Union[bytes, IO[bytes]], expected_length: int |
685 | 685 | ) -> None: |
686 | 686 | """Verifies that the length of 'data' matches 'expected_length'""" |
687 | 687 | if isinstance(data, bytes): |
@@ -766,7 +766,7 @@ def to_dict(self) -> Dict[str, Any]: |
766 | 766 |
|
767 | 767 | return res_dict |
768 | 768 |
|
769 | | - def verify_length_and_hashes(self, data: Union[bytes, BinaryIO]) -> None: |
| 769 | + def verify_length_and_hashes(self, data: Union[bytes, IO[bytes]]) -> None: |
770 | 770 | """Verifies that the length and hashes of "data" match expected values. |
771 | 771 |
|
772 | 772 | Args: |
@@ -1045,7 +1045,7 @@ def to_dict(self) -> Dict[str, Any]: |
1045 | 1045 | **self.unrecognized_fields, |
1046 | 1046 | } |
1047 | 1047 |
|
1048 | | - def verify_length_and_hashes(self, data: Union[bytes, BinaryIO]) -> None: |
| 1048 | + def verify_length_and_hashes(self, data: Union[bytes, IO[bytes]]) -> None: |
1049 | 1049 | """Verifies that length and hashes of "data" match expected values. |
1050 | 1050 |
|
1051 | 1051 | Args: |
|
0 commit comments