mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 13:34:58 +08:00
Switch to PEP-604 syntax in python2 stubs (#5915)
Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
This commit is contained in:
@@ -15,7 +15,6 @@ from typing import (
|
||||
Text,
|
||||
Tuple,
|
||||
Type,
|
||||
Union,
|
||||
)
|
||||
|
||||
from repr import Repr
|
||||
@@ -37,17 +36,17 @@ def replace(text: AnyStr, *pairs: AnyStr) -> AnyStr: ...
|
||||
def cram(text: str, maxlen: int) -> str: ...
|
||||
def stripid(text: str) -> str: ...
|
||||
def allmethods(cl: type) -> MutableMapping[str, MethodType]: ...
|
||||
def visiblename(name: str, all: Optional[Container[str]] = ..., obj: Optional[object] = ...) -> bool: ...
|
||||
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 ispackage(path: str) -> bool: ...
|
||||
def source_synopsis(file: IO[AnyStr]) -> Optional[AnyStr]: ...
|
||||
def synopsis(filename: str, cache: MutableMapping[str, Tuple[int, str]] = ...) -> Optional[str]: ...
|
||||
def source_synopsis(file: IO[AnyStr]) -> AnyStr | None: ...
|
||||
def synopsis(filename: str, cache: MutableMapping[str, Tuple[int, str]] = ...) -> str | None: ...
|
||||
|
||||
class ErrorDuringImport(Exception):
|
||||
filename: str
|
||||
exc: Optional[Type[BaseException]]
|
||||
value: Optional[BaseException]
|
||||
tb: Optional[TracebackType]
|
||||
exc: Type[BaseException] | None
|
||||
value: BaseException | None
|
||||
tb: TracebackType | None
|
||||
def __init__(self, filename: str, exc_info: _Exc_Info) -> None: ...
|
||||
|
||||
def importfile(path: str) -> ModuleType: ...
|
||||
@@ -55,15 +54,15 @@ def safeimport(path: str, forceload: bool = ..., cache: MutableMapping[str, Modu
|
||||
|
||||
class Doc:
|
||||
PYTHONDOCS: str
|
||||
def document(self, object: object, name: Optional[str] = ..., *args: Any) -> str: ...
|
||||
def fail(self, object: object, name: Optional[str] = ..., *args: Any) -> NoReturn: ...
|
||||
def docmodule(self, object: object, name: Optional[str] = ..., *args: Any) -> str: ...
|
||||
def docclass(self, object: object, name: Optional[str] = ..., *args: Any) -> str: ...
|
||||
def docroutine(self, object: object, name: Optional[str] = ..., *args: Any) -> str: ...
|
||||
def docother(self, object: object, name: Optional[str] = ..., *args: Any) -> str: ...
|
||||
def docproperty(self, object: object, name: Optional[str] = ..., *args: Any) -> str: ...
|
||||
def docdata(self, object: object, name: Optional[str] = ..., *args: Any) -> str: ...
|
||||
def getdocloc(self, object: object, basedir: str = ...) -> Optional[str]: ...
|
||||
def document(self, object: object, name: str | None = ..., *args: Any) -> str: ...
|
||||
def fail(self, object: object, name: str | None = ..., *args: Any) -> NoReturn: ...
|
||||
def docmodule(self, object: object, name: str | None = ..., *args: Any) -> str: ...
|
||||
def docclass(self, object: object, name: str | None = ..., *args: Any) -> str: ...
|
||||
def docroutine(self, object: object, name: str | None = ..., *args: Any) -> str: ...
|
||||
def docother(self, object: object, name: str | None = ..., *args: Any) -> str: ...
|
||||
def docproperty(self, object: object, name: str | None = ..., *args: Any) -> str: ...
|
||||
def docdata(self, object: object, name: str | None = ..., *args: Any) -> str: ...
|
||||
def getdocloc(self, object: object, basedir: str = ...) -> str | None: ...
|
||||
|
||||
class HTMLRepr(Repr):
|
||||
maxlist: int
|
||||
@@ -93,7 +92,7 @@ class HTMLDoc(Doc):
|
||||
contents: str,
|
||||
width: int = ...,
|
||||
prelude: str = ...,
|
||||
marginalia: Optional[str] = ...,
|
||||
marginalia: str | None = ...,
|
||||
gap: str = ...,
|
||||
) -> str: ...
|
||||
def bigsection(self, title: str, *args: Any) -> str: ...
|
||||
@@ -107,20 +106,20 @@ class HTMLDoc(Doc):
|
||||
def markup(
|
||||
self,
|
||||
text: str,
|
||||
escape: Optional[Callable[[str], str]] = ...,
|
||||
escape: Callable[[str], str] | None = ...,
|
||||
funcs: Mapping[str, str] = ...,
|
||||
classes: Mapping[str, str] = ...,
|
||||
methods: Mapping[str, str] = ...,
|
||||
) -> str: ...
|
||||
def formattree(
|
||||
self, tree: List[Union[Tuple[type, Tuple[type, ...]], List[Any]]], modname: str, parent: Optional[type] = ...
|
||||
self, tree: List[Tuple[type, Tuple[type, ...]] | List[Any]], modname: str, parent: type | None = ...
|
||||
) -> str: ...
|
||||
def docmodule(self, object: object, name: Optional[str] = ..., mod: Optional[str] = ..., *ignored: Any) -> str: ...
|
||||
def docmodule(self, object: object, name: str | None = ..., mod: str | None = ..., *ignored: Any) -> str: ...
|
||||
def docclass(
|
||||
self,
|
||||
object: object,
|
||||
name: Optional[str] = ...,
|
||||
mod: Optional[str] = ...,
|
||||
name: str | None = ...,
|
||||
mod: str | None = ...,
|
||||
funcs: Mapping[str, str] = ...,
|
||||
classes: Mapping[str, str] = ...,
|
||||
*ignored: Any,
|
||||
@@ -129,22 +128,22 @@ class HTMLDoc(Doc):
|
||||
def docroutine(
|
||||
self,
|
||||
object: object,
|
||||
name: Optional[str] = ...,
|
||||
mod: Optional[str] = ...,
|
||||
name: str | None = ...,
|
||||
mod: str | None = ...,
|
||||
funcs: Mapping[str, str] = ...,
|
||||
classes: Mapping[str, str] = ...,
|
||||
methods: Mapping[str, str] = ...,
|
||||
cl: Optional[type] = ...,
|
||||
cl: type | None = ...,
|
||||
*ignored: Any,
|
||||
) -> str: ...
|
||||
def docproperty(
|
||||
self, object: object, name: Optional[str] = ..., mod: Optional[str] = ..., cl: Optional[Any] = ..., *ignored: Any
|
||||
self, object: object, name: str | None = ..., mod: str | None = ..., cl: Any | None = ..., *ignored: Any
|
||||
) -> str: ...
|
||||
def docother(self, object: object, name: Optional[str] = ..., mod: Optional[Any] = ..., *ignored: Any) -> str: ...
|
||||
def docother(self, object: object, name: str | None = ..., mod: Any | None = ..., *ignored: Any) -> str: ...
|
||||
def docdata(
|
||||
self, object: object, name: Optional[str] = ..., mod: Optional[Any] = ..., cl: Optional[Any] = ..., *ignored: Any
|
||||
self, object: object, name: str | None = ..., mod: Any | None = ..., cl: Any | None = ..., *ignored: Any
|
||||
) -> str: ...
|
||||
def index(self, dir: str, shadowed: Optional[MutableMapping[str, bool]] = ...) -> str: ...
|
||||
def index(self, dir: str, shadowed: MutableMapping[str, bool] | None = ...) -> str: ...
|
||||
def filelink(self, url: str, path: str) -> str: ...
|
||||
|
||||
class TextRepr(Repr):
|
||||
@@ -165,32 +164,28 @@ class TextDoc(Doc):
|
||||
def indent(self, text: str, prefix: str = ...) -> str: ...
|
||||
def section(self, title: str, contents: str) -> str: ...
|
||||
def formattree(
|
||||
self,
|
||||
tree: List[Union[Tuple[type, Tuple[type, ...]], List[Any]]],
|
||||
modname: str,
|
||||
parent: Optional[type] = ...,
|
||||
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: Optional[str] = ..., mod: Optional[Any] = ..., *ignored: Any) -> str: ...
|
||||
def docclass(self, object: object, name: Optional[str] = ..., mod: Optional[str] = ..., *ignored: Any) -> 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: ...
|
||||
def formatvalue(self, object: object) -> str: ...
|
||||
def docroutine(
|
||||
self, object: object, name: Optional[str] = ..., mod: Optional[str] = ..., cl: Optional[Any] = ..., *ignored: Any
|
||||
self, object: object, name: str | None = ..., mod: str | None = ..., cl: Any | None = ..., *ignored: Any
|
||||
) -> str: ...
|
||||
def docproperty(
|
||||
self, object: object, name: Optional[str] = ..., mod: Optional[Any] = ..., cl: Optional[Any] = ..., *ignored: Any
|
||||
self, object: object, name: str | None = ..., mod: Any | None = ..., cl: Any | None = ..., *ignored: Any
|
||||
) -> str: ...
|
||||
def docdata(
|
||||
self, object: object, name: Optional[str] = ..., mod: Optional[str] = ..., cl: Optional[Any] = ..., *ignored: Any
|
||||
self, object: object, name: str | None = ..., mod: str | None = ..., cl: Any | None = ..., *ignored: Any
|
||||
) -> str: ...
|
||||
def docother(
|
||||
self,
|
||||
object: object,
|
||||
name: Optional[str] = ...,
|
||||
mod: Optional[str] = ...,
|
||||
parent: Optional[str] = ...,
|
||||
maxlen: Optional[int] = ...,
|
||||
doc: Optional[Any] = ...,
|
||||
name: str | None = ...,
|
||||
mod: str | None = ...,
|
||||
parent: str | None = ...,
|
||||
maxlen: int | None = ...,
|
||||
doc: Any | None = ...,
|
||||
*ignored: Any,
|
||||
) -> str: ...
|
||||
|
||||
@@ -209,22 +204,20 @@ html: HTMLDoc
|
||||
|
||||
class _OldStyleClass: ...
|
||||
|
||||
def resolve(thing: Union[str, object], forceload: bool = ...) -> Optional[Tuple[object, str]]: ...
|
||||
def render_doc(thing: Union[str, object], title: str = ..., forceload: bool = ..., renderer: Optional[Doc] = ...) -> str: ...
|
||||
def doc(
|
||||
thing: Union[str, object], title: str = ..., forceload: bool = ..., output: Optional[SupportsWrite[str]] = ...
|
||||
) -> None: ...
|
||||
def writedoc(thing: Union[str, object], forceload: bool = ...) -> None: ...
|
||||
def writedocs(dir: str, pkgpath: str = ..., done: Optional[Any] = ...) -> 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, Union[str, Tuple[str, str]]]
|
||||
keywords: Dict[str, str | Tuple[str, str]]
|
||||
symbols: Dict[str, str]
|
||||
topics: Dict[str, Union[str, Tuple[str, ...]]]
|
||||
def __init__(self, input: Optional[IO[str]] = ..., output: Optional[IO[str]] = ...) -> None: ...
|
||||
topics: Dict[str, str | Tuple[str, ...]]
|
||||
def __init__(self, input: IO[str] | None = ..., output: IO[str] | None = ...) -> None: ...
|
||||
input: IO[str]
|
||||
output: IO[str]
|
||||
def __call__(self, request: Union[str, Helper, object] = ...) -> None: ...
|
||||
def __call__(self, request: str | Helper | object = ...) -> None: ...
|
||||
def interact(self) -> None: ...
|
||||
def getline(self, prompt: str) -> str: ...
|
||||
def help(self, request: Any) -> None: ...
|
||||
@@ -252,14 +245,14 @@ class ModuleScanner:
|
||||
quit: bool
|
||||
def run(
|
||||
self,
|
||||
callback: Callable[[Optional[str], str, str], None],
|
||||
key: Optional[Any] = ...,
|
||||
completer: Optional[Callable[[], None]] = ...,
|
||||
onerror: Optional[Callable[[str], None]] = ...,
|
||||
callback: Callable[[str | None, str, str], None],
|
||||
key: Any | None = ...,
|
||||
completer: Callable[[], None] | None = ...,
|
||||
onerror: Callable[[str], None] | None = ...,
|
||||
) -> None: ...
|
||||
|
||||
def apropos(key: str) -> None: ...
|
||||
def ispath(x: Any) -> bool: ...
|
||||
def cli() -> None: ...
|
||||
def serve(port: int, callback: Optional[Callable[[Any], None]] = ..., completer: Optional[Callable[[], None]] = ...) -> None: ...
|
||||
def serve(port: int, callback: Callable[[Any], None] | None = ..., completer: Callable[[], None] | None = ...) -> None: ...
|
||||
def gui() -> None: ...
|
||||
|
||||
Reference in New Issue
Block a user