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