Skip to content

Add missing attribute hints for click.types #4813

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 23, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions third_party/2and3/click/types.pyi
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -15,20 +15,30 @@ 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):
def __call__(self, value: Optional[str], param: Optional[Parameter] = ..., ctx: Optional[Context] = ...) -> float: ...
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 = ...,
Expand All @@ -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 = ...,
Expand Down