mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 13:34:58 +08:00
Use PEP 585 syntax in Python 2, protobuf & _ast stubs, where possible (#6949)
This commit is contained in:
@@ -1,35 +1,20 @@
|
||||
from _typeshed import SupportsWrite
|
||||
from types import MethodType, ModuleType, TracebackType
|
||||
from typing import (
|
||||
IO,
|
||||
Any,
|
||||
AnyStr,
|
||||
Callable,
|
||||
Container,
|
||||
Dict,
|
||||
List,
|
||||
Mapping,
|
||||
MutableMapping,
|
||||
NoReturn,
|
||||
Optional,
|
||||
Text,
|
||||
Tuple,
|
||||
Type,
|
||||
)
|
||||
from typing import IO, Any, AnyStr, Callable, Container, Mapping, MutableMapping, NoReturn, Optional, Text
|
||||
|
||||
from repr import Repr
|
||||
|
||||
# the return type of sys.exc_info(), used by ErrorDuringImport.__init__
|
||||
_Exc_Info = Tuple[Optional[Type[BaseException]], Optional[BaseException], Optional[TracebackType]]
|
||||
_Exc_Info = tuple[Optional[type[BaseException]], Optional[BaseException], Optional[TracebackType]]
|
||||
|
||||
__author__: str
|
||||
__date__: str
|
||||
__version__: str
|
||||
__credits__: str
|
||||
|
||||
def pathdirs() -> List[str]: ...
|
||||
def pathdirs() -> list[str]: ...
|
||||
def getdoc(object: object) -> Text: ...
|
||||
def splitdoc(doc: AnyStr) -> Tuple[AnyStr, AnyStr]: ...
|
||||
def splitdoc(doc: AnyStr) -> tuple[AnyStr, AnyStr]: ...
|
||||
def classname(object: object, modname: str) -> str: ...
|
||||
def isdata(object: object) -> bool: ...
|
||||
def replace(text: AnyStr, *pairs: AnyStr) -> AnyStr: ...
|
||||
@@ -37,14 +22,14 @@ def cram(text: str, maxlen: int) -> str: ...
|
||||
def stripid(text: str) -> str: ...
|
||||
def allmethods(cl: type) -> MutableMapping[str, MethodType]: ...
|
||||
def visiblename(name: str, all: Container[str] | None = ..., obj: object | None = ...) -> bool: ...
|
||||
def classify_class_attrs(object: object) -> List[Tuple[str, str, type, str]]: ...
|
||||
def classify_class_attrs(object: object) -> list[tuple[str, str, type, str]]: ...
|
||||
def ispackage(path: str) -> bool: ...
|
||||
def source_synopsis(file: IO[AnyStr]) -> AnyStr | None: ...
|
||||
def synopsis(filename: str, cache: MutableMapping[str, Tuple[int, str]] = ...) -> str | None: ...
|
||||
def synopsis(filename: str, cache: MutableMapping[str, tuple[int, str]] = ...) -> str | None: ...
|
||||
|
||||
class ErrorDuringImport(Exception):
|
||||
filename: str
|
||||
exc: Type[BaseException] | None
|
||||
exc: type[BaseException] | None
|
||||
value: BaseException | None
|
||||
tb: TracebackType | None
|
||||
def __init__(self, filename: str, exc_info: _Exc_Info) -> None: ...
|
||||
@@ -97,12 +82,12 @@ class HTMLDoc(Doc):
|
||||
) -> str: ...
|
||||
def bigsection(self, title: str, *args: Any) -> str: ...
|
||||
def preformat(self, text: str) -> str: ...
|
||||
def multicolumn(self, list: List[Any], format: Callable[[Any], str], cols: int = ...) -> str: ...
|
||||
def multicolumn(self, list: list[Any], format: Callable[[Any], str], cols: int = ...) -> str: ...
|
||||
def grey(self, text: str) -> str: ...
|
||||
def namelink(self, name: str, *dicts: MutableMapping[str, str]) -> str: ...
|
||||
def classlink(self, object: object, modname: str) -> str: ...
|
||||
def modulelink(self, object: object) -> str: ...
|
||||
def modpkglink(self, modpkginfo: Tuple[str, str, bool, bool]) -> str: ...
|
||||
def modpkglink(self, modpkginfo: tuple[str, str, bool, bool]) -> str: ...
|
||||
def markup(
|
||||
self,
|
||||
text: str,
|
||||
@@ -112,7 +97,7 @@ class HTMLDoc(Doc):
|
||||
methods: Mapping[str, str] = ...,
|
||||
) -> str: ...
|
||||
def formattree(
|
||||
self, tree: List[Tuple[type, Tuple[type, ...]] | List[Any]], modname: str, parent: type | None = ...
|
||||
self, tree: list[tuple[type, tuple[type, ...]] | list[Any]], modname: str, parent: type | None = ...
|
||||
) -> str: ...
|
||||
def docmodule(self, object: object, name: str | None = ..., mod: str | None = ..., *ignored: Any) -> str: ...
|
||||
def docclass(
|
||||
@@ -164,7 +149,7 @@ class TextDoc(Doc):
|
||||
def indent(self, text: str, prefix: str = ...) -> str: ...
|
||||
def section(self, title: str, contents: str) -> str: ...
|
||||
def formattree(
|
||||
self, tree: List[Tuple[type, Tuple[type, ...]] | List[Any]], modname: str, parent: type | None = ..., prefix: str = ...
|
||||
self, tree: list[tuple[type, tuple[type, ...]] | list[Any]], modname: str, parent: type | None = ..., prefix: str = ...
|
||||
) -> str: ...
|
||||
def docmodule(self, object: object, name: str | None = ..., mod: Any | None = ..., *ignored: Any) -> str: ...
|
||||
def docclass(self, object: object, name: str | None = ..., mod: str | None = ..., *ignored: Any) -> str: ...
|
||||
@@ -204,16 +189,16 @@ html: HTMLDoc
|
||||
|
||||
class _OldStyleClass: ...
|
||||
|
||||
def resolve(thing: str | object, forceload: bool = ...) -> Tuple[object, str] | None: ...
|
||||
def resolve(thing: str | object, forceload: bool = ...) -> tuple[object, str] | None: ...
|
||||
def render_doc(thing: str | object, title: str = ..., forceload: bool = ..., renderer: Doc | None = ...) -> str: ...
|
||||
def doc(thing: str | object, title: str = ..., forceload: bool = ..., output: SupportsWrite[str] | None = ...) -> None: ...
|
||||
def writedoc(thing: str | object, forceload: bool = ...) -> None: ...
|
||||
def writedocs(dir: str, pkgpath: str = ..., done: Any | None = ...) -> None: ...
|
||||
|
||||
class Helper:
|
||||
keywords: Dict[str, str | Tuple[str, str]]
|
||||
symbols: Dict[str, str]
|
||||
topics: Dict[str, str | Tuple[str, ...]]
|
||||
keywords: dict[str, str | tuple[str, str]]
|
||||
symbols: dict[str, str]
|
||||
topics: dict[str, str | tuple[str, ...]]
|
||||
def __init__(self, input: IO[str] | None = ..., output: IO[str] | None = ...) -> None: ...
|
||||
input: IO[str]
|
||||
output: IO[str]
|
||||
@@ -222,7 +207,7 @@ class Helper:
|
||||
def getline(self, prompt: str) -> str: ...
|
||||
def help(self, request: Any) -> None: ...
|
||||
def intro(self) -> None: ...
|
||||
def list(self, items: List[str], columns: int = ..., width: int = ...) -> None: ...
|
||||
def list(self, items: list[str], columns: int = ..., width: int = ...) -> None: ...
|
||||
def listkeywords(self) -> None: ...
|
||||
def listsymbols(self) -> None: ...
|
||||
def listtopics(self) -> None: ...
|
||||
|
||||
Reference in New Issue
Block a user