mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-06 04:04:25 +08:00
Add missing attribute hints for click.types (#4813)
Co-authored-by: Maximilian Frank <maximilian.frank@ait.ac.at>
This commit is contained in:
26
third_party/2and3/click/types.pyi
vendored
26
third_party/2and3/click/types.pyi
vendored
@@ -1,6 +1,6 @@
|
||||
import datetime
|
||||
import uuid
|
||||
from typing import IO, Any, Callable, Generic, Iterable, List, Optional, Text, Tuple as _PyTuple, Type, TypeVar, Union
|
||||
from typing import IO, Any, Callable, Generic, Iterable, List, Optional, Sequence, Text, Tuple as _PyTuple, Type, TypeVar, Union
|
||||
|
||||
from click.core import Context, Parameter, _ConvertibleType, _ParamType
|
||||
|
||||
@@ -15,10 +15,12 @@ class CompositeParamType(ParamType):
|
||||
|
||||
class Choice(ParamType):
|
||||
choices: Iterable[str]
|
||||
case_sensitive: bool
|
||||
def __init__(self, choices: Iterable[str], case_sensitive: bool = ...) -> None: ...
|
||||
|
||||
class DateTime(ParamType):
|
||||
def __init__(self, formats: Optional[List[str]] = ...) -> None: ...
|
||||
formats: Sequence[str]
|
||||
def __init__(self, formats: Optional[Sequence[str]] = ...) -> None: ...
|
||||
def convert(self, value: str, param: Optional[Parameter], ctx: Optional[Context]) -> datetime.datetime: ...
|
||||
|
||||
class FloatParamType(ParamType):
|
||||
@@ -26,9 +28,17 @@ class FloatParamType(ParamType):
|
||||
def convert(self, value: str, param: Optional[Parameter], ctx: Optional[Context]) -> float: ...
|
||||
|
||||
class FloatRange(FloatParamType):
|
||||
min: Optional[float]
|
||||
max: Optional[float]
|
||||
clamp: bool
|
||||
def __init__(self, min: Optional[float] = ..., max: Optional[float] = ..., clamp: bool = ...) -> None: ...
|
||||
|
||||
class File(ParamType):
|
||||
mode: str
|
||||
encoding: Optional[str]
|
||||
errors: Optional[str]
|
||||
lazy: Optional[bool]
|
||||
atomic: bool
|
||||
def __init__(
|
||||
self,
|
||||
mode: Text = ...,
|
||||
@@ -55,11 +65,23 @@ class IntParamType(ParamType):
|
||||
def convert(self, value: str, param: Optional[Parameter], ctx: Optional[Context]) -> int: ...
|
||||
|
||||
class IntRange(IntParamType):
|
||||
min: Optional[int]
|
||||
max: Optional[int]
|
||||
clamp: bool
|
||||
def __init__(self, min: Optional[int] = ..., max: Optional[int] = ..., clamp: bool = ...) -> None: ...
|
||||
|
||||
_PathType = TypeVar("_PathType", str, bytes)
|
||||
_PathTypeBound = Union[Type[str], Type[bytes]]
|
||||
|
||||
class Path(ParamType):
|
||||
exists: bool
|
||||
file_okay: bool
|
||||
dir_okay: bool
|
||||
writable: bool
|
||||
readable: bool
|
||||
resolve_path: bool
|
||||
allow_dash: bool
|
||||
type: Optional[_PathTypeBound]
|
||||
def __init__(
|
||||
self,
|
||||
exists: bool = ...,
|
||||
|
||||
Reference in New Issue
Block a user