mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-10 05:51:52 +08:00
Remove type cycle in click (#2277)
This commit is contained in:
committed by
Jelle Zijlstra
parent
41e5fe4457
commit
de1755b263
42
third_party/2and3/click/core.pyi
vendored
42
third_party/2and3/click/core.pyi
vendored
@@ -17,8 +17,6 @@ from typing import (
|
||||
|
||||
from click.formatting import HelpFormatter
|
||||
from click.parser import OptionParser
|
||||
from click.types import ParamType, _ConvertibleType
|
||||
|
||||
|
||||
def invoke_param_callback(
|
||||
callback: Callable[['Context', 'Parameter', Optional[str]], Any],
|
||||
@@ -313,12 +311,50 @@ class CommandCollection(MultiCommand):
|
||||
...
|
||||
|
||||
|
||||
class _ParamType:
|
||||
name: str
|
||||
is_composite: bool
|
||||
envvar_list_splitter: Optional[str]
|
||||
|
||||
def __call__(
|
||||
self,
|
||||
value: Optional[str],
|
||||
param: Optional[Parameter] = ...,
|
||||
ctx: Optional[Context] = ...,
|
||||
) -> Any:
|
||||
...
|
||||
|
||||
def get_metavar(self, param: Parameter) -> str:
|
||||
...
|
||||
|
||||
def get_missing_message(self, param: Parameter) -> str:
|
||||
...
|
||||
|
||||
def convert(
|
||||
self,
|
||||
value: str,
|
||||
param: Optional[Parameter],
|
||||
ctx: Optional[Context],
|
||||
) -> Any:
|
||||
...
|
||||
|
||||
def split_envvar_value(self, rv: str) -> List[str]:
|
||||
...
|
||||
|
||||
def fail(self, message: str, param: Optional[Parameter] = ..., ctx: Optional[Context] = ...) -> None:
|
||||
...
|
||||
|
||||
|
||||
# This type is here to resolve https://github.com/python/mypy/issues/5275
|
||||
_ConvertibleType = Union[type, _ParamType, Tuple[type, ...], Callable[[str], Any], Callable[[Optional[str]], Any]]
|
||||
|
||||
|
||||
class Parameter:
|
||||
param_type_name: str
|
||||
name: str
|
||||
opts: List[str]
|
||||
secondary_opts: List[str]
|
||||
type: ParamType
|
||||
type: _ParamType
|
||||
required: bool
|
||||
callback: Optional[Callable[[Context, 'Parameter', str], Any]]
|
||||
nargs: int
|
||||
|
||||
3
third_party/2and3/click/decorators.pyi
vendored
3
third_party/2and3/click/decorators.pyi
vendored
@@ -1,8 +1,7 @@
|
||||
from distutils.version import Version
|
||||
from typing import Any, Callable, Dict, List, Optional, Type, TypeVar, Union, Text
|
||||
|
||||
from click.core import Command, Group, Argument, Option, Parameter, Context
|
||||
from click.types import _ConvertibleType
|
||||
from click.core import Command, Group, Argument, Option, Parameter, Context, _ConvertibleType
|
||||
|
||||
_T = TypeVar('_T')
|
||||
_Decorator = Callable[[_T], _T]
|
||||
|
||||
2
third_party/2and3/click/termui.pyi
vendored
2
third_party/2and3/click/termui.pyi
vendored
@@ -12,7 +12,7 @@ from typing import (
|
||||
TypeVar,
|
||||
)
|
||||
|
||||
from click.types import _ConvertibleType
|
||||
from click.core import _ConvertibleType
|
||||
from click._termui_impl import ProgressBar as _ProgressBar
|
||||
|
||||
|
||||
|
||||
39
third_party/2and3/click/types.pyi
vendored
39
third_party/2and3/click/types.pyi
vendored
@@ -1,42 +1,7 @@
|
||||
from typing import Any, Callable, IO, Iterable, List, Optional, TypeVar, Union, Tuple as _PyTuple, Type
|
||||
import uuid
|
||||
|
||||
from click.core import Context, Parameter
|
||||
|
||||
|
||||
class ParamType:
|
||||
name: str
|
||||
is_composite: bool
|
||||
envvar_list_splitter: Optional[str]
|
||||
|
||||
def __call__(
|
||||
self,
|
||||
value: Optional[str],
|
||||
param: Optional[Parameter] = ...,
|
||||
ctx: Optional[Context] = ...,
|
||||
) -> Any:
|
||||
...
|
||||
|
||||
def get_metavar(self, param: Parameter) -> str:
|
||||
...
|
||||
|
||||
def get_missing_message(self, param: Parameter) -> str:
|
||||
...
|
||||
|
||||
def convert(
|
||||
self,
|
||||
value: str,
|
||||
param: Optional[Parameter],
|
||||
ctx: Optional[Context],
|
||||
) -> Any:
|
||||
...
|
||||
|
||||
def split_envvar_value(self, rv: str) -> List[str]:
|
||||
...
|
||||
|
||||
def fail(self, message: str, param: Optional[Parameter] = ..., ctx: Optional[Context] = ...) -> None:
|
||||
...
|
||||
|
||||
from click.core import Context, Parameter, _ParamType as ParamType, _ConvertibleType
|
||||
|
||||
class BoolParamType(ParamType):
|
||||
def __call__(
|
||||
@@ -270,8 +235,6 @@ class UUIDParameterType(ParamType):
|
||||
...
|
||||
|
||||
|
||||
_ConvertibleType = Union[type, ParamType, _PyTuple[type, ...], Callable[[str], Any], Callable[[Optional[str]], Any]]
|
||||
|
||||
def convert_type(ty: Optional[_ConvertibleType], default: Optional[Any] = ...) -> ParamType:
|
||||
...
|
||||
|
||||
|
||||
Reference in New Issue
Block a user