mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-09 13:02:22 +08:00
Avoid using string literals in type annotations (#2294)
This commit is contained in:
committed by
Jelle Zijlstra
parent
25ad95de4f
commit
6192cce9d9
2
third_party/2/pymssql.pyi
vendored
2
third_party/2/pymssql.pyi
vendored
@@ -11,7 +11,7 @@ class Connection(object):
|
||||
def autocommit(self, status: bool) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
def commit(self) -> None: ...
|
||||
def cursor(self) -> 'Cursor': ...
|
||||
def cursor(self) -> Cursor: ...
|
||||
def rollback(self) -> None: ...
|
||||
|
||||
class Cursor(object):
|
||||
|
||||
4
third_party/2and3/click/_termui_impl.pyi
vendored
4
third_party/2and3/click/_termui_impl.pyi
vendored
@@ -5,8 +5,8 @@ _T = TypeVar("_T")
|
||||
class ProgressBar(object, Generic[_T]):
|
||||
def update(self, n_steps: int) -> None: ...
|
||||
def finish(self) -> None: ...
|
||||
def __enter__(self) -> "ProgressBar[_T]": ...
|
||||
def __enter__(self) -> ProgressBar[_T]: ...
|
||||
def __exit__(self, exc_type, exc_value, tb) -> None: ...
|
||||
def __iter__(self) -> "ProgressBar[_T]": ...
|
||||
def __iter__(self) -> ProgressBar[_T]: ...
|
||||
def next(self) -> _T: ...
|
||||
def __next__(self) -> _T: ...
|
||||
|
||||
42
third_party/2and3/click/core.pyi
vendored
42
third_party/2and3/click/core.pyi
vendored
@@ -19,9 +19,9 @@ from click.formatting import HelpFormatter
|
||||
from click.parser import OptionParser
|
||||
|
||||
def invoke_param_callback(
|
||||
callback: Callable[['Context', 'Parameter', Optional[str]], Any],
|
||||
ctx: 'Context',
|
||||
param: 'Parameter',
|
||||
callback: Callable[[Context, Parameter, Optional[str]], Any],
|
||||
ctx: Context,
|
||||
param: Parameter,
|
||||
value: Optional[str]
|
||||
) -> Any:
|
||||
...
|
||||
@@ -29,21 +29,21 @@ def invoke_param_callback(
|
||||
|
||||
@contextmanager
|
||||
def augment_usage_errors(
|
||||
ctx: 'Context', param: Optional['Parameter'] = ...
|
||||
ctx: Context, param: Optional[Parameter] = ...
|
||||
) -> Generator[None, None, None]:
|
||||
...
|
||||
|
||||
|
||||
def iter_params_for_processing(
|
||||
invocation_order: Sequence['Parameter'],
|
||||
declaration_order: Iterable['Parameter'],
|
||||
) -> Iterable['Parameter']:
|
||||
invocation_order: Sequence[Parameter],
|
||||
declaration_order: Iterable[Parameter],
|
||||
) -> Iterable[Parameter]:
|
||||
...
|
||||
|
||||
|
||||
class Context:
|
||||
parent: Optional['Context']
|
||||
command: 'Command'
|
||||
parent: Optional[Context]
|
||||
command: Command
|
||||
info_name: Optional[str]
|
||||
params: Dict
|
||||
args: List[str]
|
||||
@@ -71,8 +71,8 @@ class Context:
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
command: 'Command',
|
||||
parent: Optional['Context'] = ...,
|
||||
command: Command,
|
||||
parent: Optional[Context] = ...,
|
||||
info_name: Optional[str] = ...,
|
||||
obj: Optional[Any] = ...,
|
||||
auto_envvar_prefix: Optional[str] = ...,
|
||||
@@ -90,7 +90,7 @@ class Context:
|
||||
...
|
||||
|
||||
@contextmanager
|
||||
def scope(self, cleanup: bool = ...) -> Generator['Context', None, None]:
|
||||
def scope(self, cleanup: bool = ...) -> Generator[Context, None, None]:
|
||||
...
|
||||
|
||||
def make_formatter(self) -> HelpFormatter:
|
||||
@@ -102,7 +102,7 @@ class Context:
|
||||
def close(self) -> None:
|
||||
...
|
||||
|
||||
def find_root(self) -> 'Context':
|
||||
def find_root(self) -> Context:
|
||||
...
|
||||
|
||||
def find_object(self, object_type: type) -> Any:
|
||||
@@ -130,12 +130,12 @@ class Context:
|
||||
...
|
||||
|
||||
def invoke(
|
||||
self, callback: Union['Command', Callable], *args, **kwargs
|
||||
self, callback: Union[Command, Callable], *args, **kwargs
|
||||
) -> Any:
|
||||
...
|
||||
|
||||
def forward(
|
||||
self, callback: Union['Command', Callable], *args, **kwargs
|
||||
self, callback: Union[Command, Callable], *args, **kwargs
|
||||
) -> Any:
|
||||
...
|
||||
|
||||
@@ -182,7 +182,7 @@ class BaseCommand:
|
||||
|
||||
class Command(BaseCommand):
|
||||
callback: Optional[Callable]
|
||||
params: List['Parameter']
|
||||
params: List[Parameter]
|
||||
help: Optional[str]
|
||||
epilog: Optional[str]
|
||||
short_help: Optional[str]
|
||||
@@ -194,7 +194,7 @@ class Command(BaseCommand):
|
||||
name: str,
|
||||
context_settings: Optional[Dict] = ...,
|
||||
callback: Optional[Callable] = ...,
|
||||
params: Optional[List['Parameter']] = ...,
|
||||
params: Optional[List[Parameter]] = ...,
|
||||
help: Optional[str] = ...,
|
||||
epilog: Optional[str] = ...,
|
||||
short_help: Optional[str] = ...,
|
||||
@@ -203,7 +203,7 @@ class Command(BaseCommand):
|
||||
) -> None:
|
||||
...
|
||||
|
||||
def get_params(self, ctx: Context) -> List['Parameter']:
|
||||
def get_params(self, ctx: Context) -> List[Parameter]:
|
||||
...
|
||||
|
||||
def format_usage(
|
||||
@@ -219,7 +219,7 @@ class Command(BaseCommand):
|
||||
def get_help_option_names(self, ctx: Context) -> Set[str]:
|
||||
...
|
||||
|
||||
def get_help_option(self, ctx: Context) -> Optional['Option']:
|
||||
def get_help_option(self, ctx: Context) -> Optional[Option]:
|
||||
...
|
||||
|
||||
def make_parser(self, ctx: Context) -> OptionParser:
|
||||
@@ -356,7 +356,7 @@ class Parameter:
|
||||
secondary_opts: List[str]
|
||||
type: _ParamType
|
||||
required: bool
|
||||
callback: Optional[Callable[[Context, 'Parameter', str], Any]]
|
||||
callback: Optional[Callable[[Context, Parameter, str], Any]]
|
||||
nargs: int
|
||||
multiple: bool
|
||||
expose_value: bool
|
||||
@@ -373,7 +373,7 @@ class Parameter:
|
||||
type: Optional[_ConvertibleType] = ...,
|
||||
required: bool = ...,
|
||||
default: Optional[Any] = ...,
|
||||
callback: Optional[Callable[[Context, 'Parameter', str], Any]] = ...,
|
||||
callback: Optional[Callable[[Context, Parameter, str], Any]] = ...,
|
||||
nargs: Optional[int] = ...,
|
||||
metavar: Optional[str] = ...,
|
||||
expose_value: bool = ...,
|
||||
|
||||
4
third_party/2and3/click/parser.pyi
vendored
4
third_party/2and3/click/parser.pyi
vendored
@@ -44,7 +44,7 @@ class Option:
|
||||
) -> None:
|
||||
...
|
||||
|
||||
def process(self, value: Any, state: 'ParsingState') -> None:
|
||||
def process(self, value: Any, state: ParsingState) -> None:
|
||||
...
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ class Argument:
|
||||
def __init__(self, dest: str, nargs: int = ..., obj: Optional[Any] = ...) -> None:
|
||||
...
|
||||
|
||||
def process(self, value: Any, state: 'ParsingState') -> None:
|
||||
def process(self, value: Any, state: ParsingState) -> None:
|
||||
...
|
||||
|
||||
|
||||
|
||||
4
third_party/2and3/click/utils.pyi
vendored
4
third_party/2and3/click/utils.pyi
vendored
@@ -46,7 +46,7 @@ class LazyFile:
|
||||
def close_intelligently(self) -> None:
|
||||
...
|
||||
|
||||
def __enter__(self) -> 'LazyFile':
|
||||
def __enter__(self) -> LazyFile:
|
||||
...
|
||||
|
||||
def __exit__(self, exc_type, exc_value, tb):
|
||||
@@ -62,7 +62,7 @@ class KeepOpenFile:
|
||||
def __init__(self, file: IO) -> None:
|
||||
...
|
||||
|
||||
def __enter__(self) -> 'KeepOpenFile':
|
||||
def __enter__(self) -> KeepOpenFile:
|
||||
...
|
||||
|
||||
def __exit__(self, exc_type, exc_value, tb):
|
||||
|
||||
2
third_party/2and3/dateutil/_common.pyi
vendored
2
third_party/2and3/dateutil/_common.pyi
vendored
@@ -3,7 +3,7 @@ from typing import Optional
|
||||
class weekday(object):
|
||||
def __init__(self, weekday: int, n: Optional[int]=...) -> None: ...
|
||||
|
||||
def __call__(self, n: int) -> 'weekday': ...
|
||||
def __call__(self, n: int) -> weekday: ...
|
||||
|
||||
def __eq__(self, other) -> bool: ...
|
||||
|
||||
|
||||
2
third_party/2and3/requests/sessions.pyi
vendored
2
third_party/2and3/requests/sessions.pyi
vendored
@@ -77,7 +77,7 @@ class Session(SessionRedirectMixin):
|
||||
adapters = ... # type: MutableMapping
|
||||
redirect_cache = ... # type: RecentlyUsedContainer
|
||||
def __init__(self) -> None: ...
|
||||
def __enter__(self) -> 'Session': ...
|
||||
def __enter__(self) -> Session: ...
|
||||
def __exit__(self, *args) -> None: ...
|
||||
def prepare_request(self, request): ...
|
||||
def request(self, method: str, url: str,
|
||||
|
||||
2
third_party/2and3/werkzeug/wrappers.pyi
vendored
2
third_party/2and3/werkzeug/wrappers.pyi
vendored
@@ -27,7 +27,7 @@ class BaseRequest:
|
||||
@property
|
||||
def url_charset(self) -> str: ...
|
||||
@classmethod
|
||||
def from_values(cls, *args, **kwargs) -> 'BaseRequest': ...
|
||||
def from_values(cls, *args, **kwargs) -> BaseRequest: ...
|
||||
@classmethod
|
||||
def application(cls, f): ...
|
||||
@property
|
||||
|
||||
Reference in New Issue
Block a user