Skip to content

Commit 3ae99d1

Browse files
authored
Allow Python 2 unicode for some click interfaces (#4825)
Helps Python 2 code using: form __future__ import unicode_literals On Python 2, these interfaces are compatible with both str and unicode.
1 parent 35d73ef commit 3ae99d1

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

third_party/2and3/click/decorators.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def group(
5757
**kwargs: Any,
5858
) -> Callable[[Callable[..., Any]], Group]: ...
5959
def argument(
60-
*param_decls: str,
60+
*param_decls: Text,
6161
cls: Type[Argument] = ...,
6262
# Argument
6363
required: Optional[bool] = ...,
@@ -74,7 +74,7 @@ def argument(
7474
) -> _IdentityFunction: ...
7575
@overload
7676
def option(
77-
*param_decls: str,
77+
*param_decls: Text,
7878
cls: Type[Option] = ...,
7979
# Option
8080
show_default: Union[bool, Text] = ...,
@@ -87,7 +87,7 @@ def option(
8787
count: bool = ...,
8888
allow_from_autoenv: bool = ...,
8989
type: Optional[_ConvertibleType] = ...,
90-
help: Optional[str] = ...,
90+
help: Optional[Text] = ...,
9191
show_choices: bool = ...,
9292
# Parameter
9393
default: Optional[Any] = ...,

third_party/2and3/click/termui.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ def progressbar(
6363
def clear() -> None: ...
6464
def style(
6565
text: Text,
66-
fg: Optional[str] = ...,
67-
bg: Optional[str] = ...,
66+
fg: Optional[Text] = ...,
67+
bg: Optional[Text] = ...,
6868
bold: Optional[bool] = ...,
6969
dim: Optional[bool] = ...,
7070
underline: Optional[bool] = ...,

third_party/2and3/click/types.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import datetime
22
import uuid
3-
from typing import IO, Any, Callable, Generic, Iterable, List, Optional, Tuple as _PyTuple, Type, TypeVar, Union
3+
from typing import IO, Any, Callable, Generic, Iterable, List, Optional, Text, Tuple as _PyTuple, Type, TypeVar, Union
44

55
from click.core import Context, Parameter, _ConvertibleType, _ParamType
66

@@ -31,7 +31,7 @@ class FloatRange(FloatParamType):
3131
class File(ParamType):
3232
def __init__(
3333
self,
34-
mode: str = ...,
34+
mode: Text = ...,
3535
encoding: Optional[str] = ...,
3636
errors: Optional[str] = ...,
3737
lazy: Optional[bool] = ...,

0 commit comments

Comments
 (0)