|
22 | 22 | from collections import OrderedDict |
23 | 23 | from datetime import datetime, timedelta |
24 | 24 | from typing import ( |
| 25 | + IO, |
25 | 26 | Any, |
26 | | - BinaryIO, |
27 | 27 | ClassVar, |
28 | 28 | Dict, |
29 | 29 | List, |
@@ -730,7 +730,7 @@ class BaseFile: |
730 | 730 |
|
731 | 731 | @staticmethod |
732 | 732 | def _verify_hashes( |
733 | | - data: Union[bytes, BinaryIO], expected_hashes: Dict[str, str] |
| 733 | + data: Union[bytes, IO[bytes]], expected_hashes: Dict[str, str] |
734 | 734 | ) -> None: |
735 | 735 | """Verifies that the hash of 'data' matches 'expected_hashes'""" |
736 | 736 | is_bytes = isinstance(data, bytes) |
@@ -759,7 +759,7 @@ def _verify_hashes( |
759 | 759 |
|
760 | 760 | @staticmethod |
761 | 761 | def _verify_length( |
762 | | - data: Union[bytes, BinaryIO], expected_length: int |
| 762 | + data: Union[bytes, IO[bytes]], expected_length: int |
763 | 763 | ) -> None: |
764 | 764 | """Verifies that the length of 'data' matches 'expected_length'""" |
765 | 765 | if isinstance(data, bytes): |
@@ -844,7 +844,7 @@ def to_dict(self) -> Dict[str, Any]: |
844 | 844 |
|
845 | 845 | return res_dict |
846 | 846 |
|
847 | | - def verify_length_and_hashes(self, data: Union[bytes, BinaryIO]) -> None: |
| 847 | + def verify_length_and_hashes(self, data: Union[bytes, IO[bytes]]) -> None: |
848 | 848 | """Verifies that the length and hashes of "data" match expected values. |
849 | 849 |
|
850 | 850 | Args: |
@@ -1123,7 +1123,7 @@ def to_dict(self) -> Dict[str, Any]: |
1123 | 1123 | **self.unrecognized_fields, |
1124 | 1124 | } |
1125 | 1125 |
|
1126 | | - def verify_length_and_hashes(self, data: Union[bytes, BinaryIO]) -> None: |
| 1126 | + def verify_length_and_hashes(self, data: Union[bytes, IO[bytes]]) -> None: |
1127 | 1127 | """Verifies that length and hashes of "data" match expected values. |
1128 | 1128 |
|
1129 | 1129 | Args: |
|
0 commit comments