[+] improve typing
This commit is contained in:
parent
21326dd222
commit
5e6b2b2e63
@ -2,6 +2,7 @@ import base64
|
||||
import os
|
||||
|
||||
import cryptography.hazmat.primitives.kdf.scrypt
|
||||
import cryptography.exceptions
|
||||
|
||||
from typing import (Literal, overload, Optional,)
|
||||
|
||||
|
@ -67,7 +67,7 @@ def run(
|
||||
argv = []
|
||||
|
||||
if settings is None:
|
||||
settings = MypySettings()
|
||||
settings = MypySettings.model_validate(dict())
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument(
|
||||
|
@ -11,6 +11,8 @@ import unittest.mock
|
||||
import logging
|
||||
import typing
|
||||
|
||||
from typing_extensions import (cast,)
|
||||
|
||||
if typing.TYPE_CHECKING:
|
||||
import pip._internal.commands.show
|
||||
import pip._internal.commands.download
|
||||
@ -30,15 +32,26 @@ from typing import (
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class pip_show_t:
|
||||
class res_t:
|
||||
class package_info_t:
|
||||
pass
|
||||
|
||||
def pip_show(
|
||||
argv: list[str],
|
||||
) -> list['pip._internal.commands.show._PackageInfo']:
|
||||
) -> list[
|
||||
# 'pip._internal.commands.show._PackageInfo'
|
||||
pip_show_t.res_t.package_info_t,
|
||||
]:
|
||||
import pip._internal.commands.show
|
||||
return list(
|
||||
return cast(
|
||||
list[pip_show_t.res_t.package_info_t],
|
||||
list(
|
||||
pip._internal.commands.show.search_packages_info(
|
||||
argv,
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
class pip_resolve_t:
|
||||
@ -138,7 +151,13 @@ def pip_resolve(
|
||||
# t1._in_main_context = True
|
||||
session = t1.get_default_session(options)
|
||||
target_python = pip._internal.cli.cmdoptions.make_target_python(options)
|
||||
finder = t1._build_package_finder(
|
||||
finder = cast(
|
||||
getattr(
|
||||
t1,
|
||||
'_build_package_finder'
|
||||
)
|
||||
)
|
||||
t1._build_package_finder(
|
||||
options=options,
|
||||
session=session,
|
||||
target_python=target_python,
|
||||
|
@ -121,6 +121,7 @@ extraPaths = [
|
||||
'.',
|
||||
'../mypy-stubs',
|
||||
'../mypy-stubs/types-debugpy',
|
||||
'../mypy-stubs/marisa-trie-types',
|
||||
# '../../../../../',
|
||||
]
|
||||
#strict = ["src"]
|
||||
|
Loading…
Reference in New Issue
Block a user