|
1 | 1 | import errno |
2 | 2 | import getpass |
3 | 3 | import hashlib |
4 | | -import io |
5 | 4 | import logging |
6 | 5 | import os |
7 | 6 | import posixpath |
|
70 | 69 | OnExc = Callable[[FunctionType, Path, BaseException], Any] |
71 | 70 | OnErr = Callable[[FunctionType, Path, ExcInfo], Any] |
72 | 71 |
|
| 72 | +FILE_CHUNK_SIZE = 1024 * 1024 |
| 73 | + |
73 | 74 |
|
74 | 75 | def get_pip_version() -> str: |
75 | 76 | pip_pkg_dir = os.path.join(os.path.dirname(__file__), "..", "..") |
@@ -122,9 +123,7 @@ def get_prog() -> str: |
122 | 123 | # Retry every half second for up to 3 seconds |
123 | 124 | @retry(stop_after_delay=3, wait=0.5) |
124 | 125 | def rmtree( |
125 | | - dir: str, |
126 | | - ignore_errors: bool = False, |
127 | | - onexc: Optional[OnExc] = None, |
| 126 | + dir: str, ignore_errors: bool = False, onexc: Optional[OnExc] = None |
128 | 127 | ) -> None: |
129 | 128 | if ignore_errors: |
130 | 129 | onexc = _onerror_ignore |
@@ -313,7 +312,7 @@ def is_installable_dir(path: str) -> bool: |
313 | 312 |
|
314 | 313 |
|
315 | 314 | def read_chunks( |
316 | | - file: BinaryIO, size: int = io.DEFAULT_BUFFER_SIZE |
| 315 | + file: BinaryIO, size: int = FILE_CHUNK_SIZE |
317 | 316 | ) -> Generator[bytes, None, None]: |
318 | 317 | """Yield pieces of data from a file-like object until EOF.""" |
319 | 318 | while True: |
@@ -643,8 +642,7 @@ def pairwise(iterable: Iterable[Any]) -> Iterator[Tuple[Any, Any]]: |
643 | 642 |
|
644 | 643 |
|
645 | 644 | def partition( |
646 | | - pred: Callable[[T], bool], |
647 | | - iterable: Iterable[T], |
| 645 | + pred: Callable[[T], bool], iterable: Iterable[T] |
648 | 646 | ) -> Tuple[Iterable[T], Iterable[T]]: |
649 | 647 | """ |
650 | 648 | Use a predicate to partition entries into false entries and true entries, |
|
0 commit comments