[+] improve typing
This commit is contained in:
parent
5e6b2b2e63
commit
d30cdc7d70
@ -11,7 +11,7 @@ import unittest.mock
|
||||
import logging
|
||||
import typing
|
||||
|
||||
from typing_extensions import (cast,)
|
||||
from typing_extensions import (cast, Protocol,)
|
||||
|
||||
if typing.TYPE_CHECKING:
|
||||
import pip._internal.commands.show
|
||||
@ -24,6 +24,7 @@ if typing.TYPE_CHECKING:
|
||||
import pip._internal.resolution.base
|
||||
import pip._internal.resolution.resolvelib.resolver
|
||||
import pip._internal.operations.prepare
|
||||
import pip._internal.index.package_finder
|
||||
|
||||
from typing import (
|
||||
Literal, Optional, Iterable, Any,
|
||||
@ -55,6 +56,15 @@ def pip_show(
|
||||
|
||||
|
||||
class pip_resolve_t:
|
||||
class build_package_finder_t(Protocol):
|
||||
def __call__(
|
||||
self,
|
||||
options: Any,
|
||||
session: Any,
|
||||
target_python: Any,
|
||||
ignore_requires_python: Any,
|
||||
) -> 'pip._internal.index.package_finder.PackageFinder': ...
|
||||
|
||||
class kwargs_t:
|
||||
class mode_t(enum.StrEnum):
|
||||
copy_paste = "copy_paste"
|
||||
@ -152,17 +162,18 @@ def pip_resolve(
|
||||
session = t1.get_default_session(options)
|
||||
target_python = pip._internal.cli.cmdoptions.make_target_python(options)
|
||||
finder = cast(
|
||||
pip_resolve_t.build_package_finder_t,
|
||||
getattr(
|
||||
t1,
|
||||
'_build_package_finder'
|
||||
)
|
||||
)
|
||||
t1._build_package_finder(
|
||||
)(
|
||||
options=options,
|
||||
session=session,
|
||||
target_python=target_python,
|
||||
ignore_requires_python=options.ignore_requires_python,
|
||||
)
|
||||
|
||||
build_tracker = t1.enter_context(
|
||||
pip._internal.operations.build.build_tracker.get_build_tracker()
|
||||
)
|
||||
|
@ -205,7 +205,8 @@ reportUnnecessaryIsInstance = "warning"
|
||||
reportUnusedClass = "error"
|
||||
#reportUnusedImport = "error"
|
||||
reportUnusedImport = "none"
|
||||
reportUnusedFunction = "error"
|
||||
# reportUnusedFunction = "error"
|
||||
reportUnusedFunction = "warning"
|
||||
#reportUnusedVariable = "error"
|
||||
reportUnusedVariable = "warning"
|
||||
reportUntypedBaseClass = "error"
|
||||
|
Loading…
Reference in New Issue
Block a user