Skip to content

Commit

Permalink
Allow Python 2 unicode for some click interfaces (#4825)
Browse files Browse the repository at this point in the history
Helps Python 2 code using:

    form __future__ import unicode_literals

On Python 2, these interfaces are compatible with both str and unicode.
  • Loading branch information
jdufresne authored Dec 15, 2020
1 parent 35d73ef commit 3ae99d1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions third_party/2and3/click/decorators.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def group(
**kwargs: Any,
) -> Callable[[Callable[..., Any]], Group]: ...
def argument(
*param_decls: str,
*param_decls: Text,
cls: Type[Argument] = ...,
# Argument
required: Optional[bool] = ...,
Expand All @@ -74,7 +74,7 @@ def argument(
) -> _IdentityFunction: ...
@overload
def option(
*param_decls: str,
*param_decls: Text,
cls: Type[Option] = ...,
# Option
show_default: Union[bool, Text] = ...,
Expand All @@ -87,7 +87,7 @@ def option(
count: bool = ...,
allow_from_autoenv: bool = ...,
type: Optional[_ConvertibleType] = ...,
help: Optional[str] = ...,
help: Optional[Text] = ...,
show_choices: bool = ...,
# Parameter
default: Optional[Any] = ...,
Expand Down
4 changes: 2 additions & 2 deletions third_party/2and3/click/termui.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ def progressbar(
def clear() -> None: ...
def style(
text: Text,
fg: Optional[str] = ...,
bg: Optional[str] = ...,
fg: Optional[Text] = ...,
bg: Optional[Text] = ...,
bold: Optional[bool] = ...,
dim: Optional[bool] = ...,
underline: Optional[bool] = ...,
Expand Down
4 changes: 2 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, Tuple as _PyTuple, Type, TypeVar, Union
from typing import IO, Any, Callable, Generic, Iterable, List, Optional, Text, Tuple as _PyTuple, Type, TypeVar, Union

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

Expand Down Expand Up @@ -31,7 +31,7 @@ class FloatRange(FloatParamType):
class File(ParamType):
def __init__(
self,
mode: str = ...,
mode: Text = ...,
encoding: Optional[str] = ...,
errors: Optional[str] = ...,
lazy: Optional[bool] = ...,
Expand Down

0 comments on commit 3ae99d1

Please sign in to comment.