Skip to content

Commit a9c0576

Browse files
committed
Additional minor typing issues in _internal.[exceptions|locations|self_outdated_check]
1 parent 75f484d commit a9c0576

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

src/pip/_internal/exceptions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
if TYPE_CHECKING:
2828
from hashlib import _Hash
2929

30-
from pip._vendor.requests.models import Request, Response
30+
from pip._vendor.requests.models import PreparedRequest, Request, Response
3131

3232
from pip._internal.metadata import BaseDistribution
3333
from pip._internal.network.download import _FileDownload
@@ -314,7 +314,7 @@ def __init__(
314314
self,
315315
error_msg: str,
316316
response: Response | None = None,
317-
request: Request | None = None,
317+
request: Request | PreparedRequest | None = None,
318318
) -> None:
319319
"""
320320
Initialize NetworkConnectionError with `request` and `response`

src/pip/_internal/locations/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import pathlib
77
import sys
88
import sysconfig
9-
from typing import Any
109

1110
from pip._internal.models.scheme import SCHEME_KEYS, Scheme
1211
from pip._internal.utils.compat import WINDOWS
@@ -134,7 +133,7 @@ def _looks_like_red_hat_scheme() -> bool:
134133
from distutils.command.install import install
135134
from distutils.dist import Distribution
136135

137-
cmd: Any = install(Distribution())
136+
cmd: install = install(Distribution())
138137
cmd.finalize_options()
139138
return (
140139
cmd.exec_prefix == f"{os.path.normpath(sys.exec_prefix)}/local"

src/pip/_internal/locations/_sysconfig.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import os
55
import sys
66
import sysconfig
7+
from typing import Callable
78

89
from pip._internal.exceptions import InvalidSchemeCombination, UserInstallationInvalid
910
from pip._internal.models.scheme import SCHEME_KEYS, Scheme
@@ -24,7 +25,9 @@
2425

2526
_AVAILABLE_SCHEMES = set(sysconfig.get_scheme_names())
2627

27-
_PREFERRED_SCHEME_API = getattr(sysconfig, "get_preferred_scheme", None)
28+
_PREFERRED_SCHEME_API: Callable[[str], str] | None = getattr(
29+
sysconfig, "get_preferred_scheme", None
30+
)
2831

2932

3033
def _should_use_osx_framework_prefix() -> bool:

src/pip/_internal/self_outdated_check.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import os.path
1010
import sys
1111
from dataclasses import dataclass
12-
from typing import Any, Callable
12+
from typing import Callable
1313

1414
from pip._vendor.packaging.version import Version
1515
from pip._vendor.packaging.version import parse as parse_version
@@ -61,7 +61,7 @@ def _convert_date(isodate: str) -> datetime.datetime:
6161

6262
class SelfCheckState:
6363
def __init__(self, cache_dir: str) -> None:
64-
self._state: dict[str, Any] = {}
64+
self._state: dict[str, str] = {}
6565
self._statefile_path = None
6666

6767
# Try to load the existing state

0 commit comments

Comments
 (0)