Import names from typing directly rather than importing module (#13761)

This commit is contained in:
Avasam
2025-04-12 19:10:09 +02:00
committed by GitHub
parent 7ffb7e0832
commit a045be8ed6
10 changed files with 43 additions and 34 deletions
@@ -1,5 +1,5 @@
import typing as t
from _typeshed import Incomplete
from collections.abc import Sequence
import click
@@ -23,7 +23,7 @@ class DefaultCommandFormatter:
formatter: click.HelpFormatter
mark: str
def __init__(self, group: click.Group, formatter: click.HelpFormatter, mark: str = ...) -> None: ...
def write_dl(self, rows: t.Sequence[tuple[str, str]], col_max: int = 30, col_spacing: int = -2) -> None: ...
def write_dl(self, rows: Sequence[tuple[str, str]], col_max: int = 30, col_spacing: int = -2) -> None: ...
def __getattr__(self, attr: str) -> Incomplete: ...
# __getattr__ used to ala-derive from click.HelpFormatter:
# indent_increment: int
+5 -6
View File
@@ -1,12 +1,11 @@
import logging
import typing as t
from collections.abc import Callable
from typing import Any, TypeVar
from typing_extensions import TypeAlias
import click
_AnyCallable: TypeAlias = t.Callable[..., t.Any]
_FC = t.TypeVar("_FC", bound=_AnyCallable | click.Command)
_AnyCallable: TypeAlias = Callable[..., Any]
_FC = TypeVar("_FC", bound=_AnyCallable | click.Command)
def simple_verbosity_option(
logger: logging.Logger | str | None = None, *names: str, **kwargs: t.Any
) -> t.Callable[[_FC], _FC]: ...
def simple_verbosity_option(logger: logging.Logger | str | None = None, *names: str, **kwargs: Any) -> Callable[[_FC], _FC]: ...
@@ -1,17 +1,19 @@
import re
from typing import ClassVar
from typing import ClassVar, TypeVar
import click
_T = TypeVar("_T")
class EmailParamType(click.ParamType):
EMAIL_REGEX: ClassVar[re.Pattern[str]]
def convert(self, value: str, param: click.Parameter | None, ctx: click.Context | None) -> str | None: ...
def convert(self, value: str, param: click.Parameter | None, ctx: click.Context | None) -> str: ...
class PasswordParamType(click.ParamType):
def convert(self, value: str, param: click.Parameter | None, ctx: click.Context | None) -> str | None: ...
def convert(self, value: _T, param: click.Parameter | None, ctx: click.Context | None) -> _T: ...
class TextAreaParamType(click.ParamType):
def convert(self, value: str, param: click.Parameter | None, ctx: click.Context | None) -> str | None: ...
def convert(self, value: _T, param: click.Parameter | None, ctx: click.Context | None) -> _T: ...
EMAIL_TYPE: EmailParamType
PASSWORD_TYPE: PasswordParamType
+2 -2
View File
@@ -1,4 +1,3 @@
import typing
from _typeshed import Incomplete
from collections.abc import Generator
from math import (
@@ -14,6 +13,7 @@ from math import (
tan as tan,
trunc as trunc,
)
from typing import TypeVar
PY2: Incomplete
text_type = str
@@ -52,7 +52,7 @@ quote_quote: Incomplete
spaces: Incomplete
dots: Incomplete
_T = typing.TypeVar("_T")
_T = TypeVar("_T")
class Template(list[_T]):
@classmethod