massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-pyright / node_modules / pyright / dist / typeshed-fallback / stubs / click / click / types.pyi
1 import datetime
2 import uuid
3 from typing import IO, Any, Callable, Generic, Iterable, Optional, Sequence, Text, Tuple as _PyTuple, Type, TypeVar, Union
4
5 from click.core import Context, Parameter, _ConvertibleType, _ParamType
6
7 ParamType = _ParamType
8
9 class BoolParamType(ParamType):
10     def __call__(self, value: str | None, param: Parameter | None = ..., ctx: Context | None = ...) -> bool: ...
11     def convert(self, value: str, param: Parameter | None, ctx: Context | None) -> bool: ...
12
13 class CompositeParamType(ParamType):
14     arity: int
15
16 class Choice(ParamType):
17     choices: Iterable[str]
18     case_sensitive: bool
19     def __init__(self, choices: Iterable[str], case_sensitive: bool = ...) -> None: ...
20
21 class DateTime(ParamType):
22     formats: Sequence[str]
23     def __init__(self, formats: Sequence[str] | None = ...) -> None: ...
24     def convert(self, value: str, param: Parameter | None, ctx: Context | None) -> datetime.datetime: ...
25
26 class FloatParamType(ParamType):
27     def __call__(self, value: str | None, param: Parameter | None = ..., ctx: Context | None = ...) -> float: ...
28     def convert(self, value: str, param: Parameter | None, ctx: Context | None) -> float: ...
29
30 class FloatRange(FloatParamType):
31     min: float | None
32     max: float | None
33     clamp: bool
34     def __init__(self, min: float | None = ..., max: float | None = ..., clamp: bool = ...) -> None: ...
35
36 class File(ParamType):
37     mode: str
38     encoding: str | None
39     errors: str | None
40     lazy: bool | None
41     atomic: bool
42     def __init__(
43         self,
44         mode: Text = ...,
45         encoding: str | None = ...,
46         errors: str | None = ...,
47         lazy: bool | None = ...,
48         atomic: bool | None = ...,
49     ) -> None: ...
50     def __call__(self, value: str | None, param: Parameter | None = ..., ctx: Context | None = ...) -> IO[Any]: ...
51     def convert(self, value: str, param: Parameter | None, ctx: Context | None) -> IO[Any]: ...
52     def resolve_lazy_flag(self, value: str) -> bool: ...
53
54 _F = TypeVar("_F")  # result of the function
55 _Func = Callable[[Optional[str]], _F]
56
57 class FuncParamType(ParamType, Generic[_F]):
58     func: _Func[_F]
59     def __init__(self, func: _Func[_F]) -> None: ...
60     def __call__(self, value: str | None, param: Parameter | None = ..., ctx: Context | None = ...) -> _F: ...
61     def convert(self, value: str, param: Parameter | None, ctx: Context | None) -> _F: ...
62
63 class IntParamType(ParamType):
64     def __call__(self, value: str | None, param: Parameter | None = ..., ctx: Context | None = ...) -> int: ...
65     def convert(self, value: str, param: Parameter | None, ctx: Context | None) -> int: ...
66
67 class IntRange(IntParamType):
68     min: int | None
69     max: int | None
70     clamp: bool
71     def __init__(self, min: int | None = ..., max: int | None = ..., clamp: bool = ...) -> None: ...
72
73 _PathType = TypeVar("_PathType", str, bytes)
74 _PathTypeBound = Union[Type[str], Type[bytes]]
75
76 class Path(ParamType):
77     exists: bool
78     file_okay: bool
79     dir_okay: bool
80     writable: bool
81     readable: bool
82     resolve_path: bool
83     allow_dash: bool
84     type: _PathTypeBound | None
85     def __init__(
86         self,
87         exists: bool = ...,
88         file_okay: bool = ...,
89         dir_okay: bool = ...,
90         writable: bool = ...,
91         readable: bool = ...,
92         resolve_path: bool = ...,
93         allow_dash: bool = ...,
94         path_type: Type[_PathType] | None = ...,
95     ) -> None: ...
96     def coerce_path_result(self, rv: str | bytes) -> _PathType: ...
97     def __call__(self, value: str | None, param: Parameter | None = ..., ctx: Context | None = ...) -> _PathType: ...
98     def convert(self, value: str, param: Parameter | None, ctx: Context | None) -> _PathType: ...
99
100 class StringParamType(ParamType):
101     def __call__(self, value: str | None, param: Parameter | None = ..., ctx: Context | None = ...) -> str: ...
102     def convert(self, value: str, param: Parameter | None, ctx: Context | None) -> str: ...
103
104 class Tuple(CompositeParamType):
105     types: list[ParamType]
106     def __init__(self, types: Iterable[Any]) -> None: ...
107     def __call__(self, value: str | None, param: Parameter | None = ..., ctx: Context | None = ...) -> Tuple: ...
108     def convert(self, value: str, param: Parameter | None, ctx: Context | None) -> Tuple: ...
109
110 class UnprocessedParamType(ParamType): ...
111
112 class UUIDParameterType(ParamType):
113     def __call__(self, value: str | None, param: Parameter | None = ..., ctx: Context | None = ...) -> uuid.UUID: ...
114     def convert(self, value: str, param: Parameter | None, ctx: Context | None) -> uuid.UUID: ...
115
116 def convert_type(ty: _ConvertibleType | None, default: Any | None = ...) -> ParamType: ...
117
118 # parameter type shortcuts
119
120 BOOL: BoolParamType
121 FLOAT: FloatParamType
122 INT: IntParamType
123 STRING: StringParamType
124 UNPROCESSED: UnprocessedParamType
125 UUID: UUIDParameterType