mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-23 19:41:51 +08:00
Big diff: Use new "|" union syntax (#5872)
This commit is contained in:
@@ -5,68 +5,68 @@ from typing import IO, Any, Dict, Generator, Iterable, Iterator, List, Mapping,
|
||||
|
||||
_PT = Tuple[str, int, str, Optional[str]]
|
||||
|
||||
def print_tb(tb: Optional[TracebackType], limit: Optional[int] = ..., file: Optional[IO[str]] = ...) -> None: ...
|
||||
def print_tb(tb: TracebackType | None, limit: int | None = ..., file: IO[str] | None = ...) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 10):
|
||||
def print_exception(
|
||||
__exc: Optional[Type[BaseException]],
|
||||
value: Optional[BaseException] = ...,
|
||||
tb: Optional[TracebackType] = ...,
|
||||
limit: Optional[int] = ...,
|
||||
file: Optional[IO[str]] = ...,
|
||||
__exc: Type[BaseException] | None,
|
||||
value: BaseException | None = ...,
|
||||
tb: TracebackType | None = ...,
|
||||
limit: int | None = ...,
|
||||
file: IO[str] | None = ...,
|
||||
chain: bool = ...,
|
||||
) -> None: ...
|
||||
|
||||
else:
|
||||
def print_exception(
|
||||
etype: Optional[Type[BaseException]],
|
||||
value: Optional[BaseException],
|
||||
tb: Optional[TracebackType],
|
||||
limit: Optional[int] = ...,
|
||||
file: Optional[IO[str]] = ...,
|
||||
etype: Type[BaseException] | None,
|
||||
value: BaseException | None,
|
||||
tb: TracebackType | None,
|
||||
limit: int | None = ...,
|
||||
file: IO[str] | None = ...,
|
||||
chain: bool = ...,
|
||||
) -> None: ...
|
||||
|
||||
def print_exc(limit: Optional[int] = ..., file: Optional[IO[str]] = ..., chain: bool = ...) -> None: ...
|
||||
def print_last(limit: Optional[int] = ..., file: Optional[IO[str]] = ..., chain: bool = ...) -> None: ...
|
||||
def print_stack(f: Optional[FrameType] = ..., limit: Optional[int] = ..., file: Optional[IO[str]] = ...) -> None: ...
|
||||
def extract_tb(tb: Optional[TracebackType], limit: Optional[int] = ...) -> StackSummary: ...
|
||||
def extract_stack(f: Optional[FrameType] = ..., limit: Optional[int] = ...) -> StackSummary: ...
|
||||
def print_exc(limit: int | None = ..., file: IO[str] | None = ..., chain: bool = ...) -> None: ...
|
||||
def print_last(limit: int | None = ..., file: IO[str] | None = ..., chain: bool = ...) -> None: ...
|
||||
def print_stack(f: FrameType | None = ..., limit: int | None = ..., file: IO[str] | None = ...) -> None: ...
|
||||
def extract_tb(tb: TracebackType | None, limit: int | None = ...) -> StackSummary: ...
|
||||
def extract_stack(f: FrameType | None = ..., limit: int | None = ...) -> StackSummary: ...
|
||||
def format_list(extracted_list: List[FrameSummary]) -> List[str]: ...
|
||||
|
||||
# undocumented
|
||||
def print_list(extracted_list: List[FrameSummary], file: Optional[SupportsWrite[str]] = ...) -> None: ...
|
||||
def print_list(extracted_list: List[FrameSummary], file: SupportsWrite[str] | None = ...) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 10):
|
||||
def format_exception_only(__exc: Optional[Type[BaseException]], value: Optional[BaseException] = ...) -> List[str]: ...
|
||||
def format_exception_only(__exc: Type[BaseException] | None, value: BaseException | None = ...) -> List[str]: ...
|
||||
|
||||
else:
|
||||
def format_exception_only(etype: Optional[Type[BaseException]], value: Optional[BaseException]) -> List[str]: ...
|
||||
def format_exception_only(etype: Type[BaseException] | None, value: BaseException | None) -> List[str]: ...
|
||||
|
||||
if sys.version_info >= (3, 10):
|
||||
def format_exception(
|
||||
__exc: Optional[Type[BaseException]],
|
||||
value: Optional[BaseException] = ...,
|
||||
tb: Optional[TracebackType] = ...,
|
||||
limit: Optional[int] = ...,
|
||||
__exc: Type[BaseException] | None,
|
||||
value: BaseException | None = ...,
|
||||
tb: TracebackType | None = ...,
|
||||
limit: int | None = ...,
|
||||
chain: bool = ...,
|
||||
) -> List[str]: ...
|
||||
|
||||
else:
|
||||
def format_exception(
|
||||
etype: Optional[Type[BaseException]],
|
||||
value: Optional[BaseException],
|
||||
tb: Optional[TracebackType],
|
||||
limit: Optional[int] = ...,
|
||||
etype: Type[BaseException] | None,
|
||||
value: BaseException | None,
|
||||
tb: TracebackType | None,
|
||||
limit: int | None = ...,
|
||||
chain: bool = ...,
|
||||
) -> List[str]: ...
|
||||
|
||||
def format_exc(limit: Optional[int] = ..., chain: bool = ...) -> str: ...
|
||||
def format_tb(tb: Optional[TracebackType], limit: Optional[int] = ...) -> List[str]: ...
|
||||
def format_stack(f: Optional[FrameType] = ..., limit: Optional[int] = ...) -> List[str]: ...
|
||||
def format_exc(limit: int | None = ..., chain: bool = ...) -> str: ...
|
||||
def format_tb(tb: TracebackType | None, limit: int | None = ...) -> List[str]: ...
|
||||
def format_stack(f: FrameType | None = ..., limit: int | None = ...) -> List[str]: ...
|
||||
def clear_frames(tb: TracebackType) -> None: ...
|
||||
def walk_stack(f: Optional[FrameType]) -> Iterator[Tuple[FrameType, int]]: ...
|
||||
def walk_tb(tb: Optional[TracebackType]) -> Iterator[Tuple[FrameType, int]]: ...
|
||||
def walk_stack(f: FrameType | None) -> Iterator[Tuple[FrameType, int]]: ...
|
||||
def walk_tb(tb: TracebackType | None) -> Iterator[Tuple[FrameType, int]]: ...
|
||||
|
||||
class TracebackException:
|
||||
__cause__: TracebackException
|
||||
@@ -86,18 +86,18 @@ class TracebackException:
|
||||
exc_value: BaseException,
|
||||
exc_traceback: TracebackType,
|
||||
*,
|
||||
limit: Optional[int] = ...,
|
||||
limit: int | None = ...,
|
||||
lookup_lines: bool = ...,
|
||||
capture_locals: bool = ...,
|
||||
compact: bool = ...,
|
||||
_seen: Optional[Set[int]] = ...,
|
||||
_seen: Set[int] | None = ...,
|
||||
) -> None: ...
|
||||
@classmethod
|
||||
def from_exception(
|
||||
cls,
|
||||
exc: BaseException,
|
||||
*,
|
||||
limit: Optional[int] = ...,
|
||||
limit: int | None = ...,
|
||||
lookup_lines: bool = ...,
|
||||
capture_locals: bool = ...,
|
||||
compact: bool = ...,
|
||||
@@ -109,14 +109,14 @@ class TracebackException:
|
||||
exc_value: BaseException,
|
||||
exc_traceback: TracebackType,
|
||||
*,
|
||||
limit: Optional[int] = ...,
|
||||
limit: int | None = ...,
|
||||
lookup_lines: bool = ...,
|
||||
capture_locals: bool = ...,
|
||||
_seen: Optional[Set[int]] = ...,
|
||||
_seen: Set[int] | None = ...,
|
||||
) -> None: ...
|
||||
@classmethod
|
||||
def from_exception(
|
||||
cls, exc: BaseException, *, limit: Optional[int] = ..., lookup_lines: bool = ..., capture_locals: bool = ...
|
||||
cls, exc: BaseException, *, limit: int | None = ..., lookup_lines: bool = ..., capture_locals: bool = ...
|
||||
) -> TracebackException: ...
|
||||
def format(self, *, chain: bool = ...) -> Generator[str, None, None]: ...
|
||||
def format_exception_only(self) -> Generator[str, None, None]: ...
|
||||
@@ -126,7 +126,7 @@ class FrameSummary(Iterable[Any]):
|
||||
lineno: int
|
||||
name: str
|
||||
line: str
|
||||
locals: Optional[Dict[str, str]]
|
||||
locals: Dict[str, str] | None
|
||||
def __init__(
|
||||
self,
|
||||
filename: str,
|
||||
@@ -134,8 +134,8 @@ class FrameSummary(Iterable[Any]):
|
||||
name: str,
|
||||
*,
|
||||
lookup_line: bool = ...,
|
||||
locals: Optional[Mapping[str, str]] = ...,
|
||||
line: Optional[str] = ...,
|
||||
locals: Mapping[str, str] | None = ...,
|
||||
line: str | None = ...,
|
||||
) -> None: ...
|
||||
# TODO: more precise typing for __getitem__ and __iter__,
|
||||
# for a namedtuple-like view on (filename, lineno, name, str).
|
||||
@@ -148,7 +148,7 @@ class StackSummary(List[FrameSummary]):
|
||||
cls,
|
||||
frame_gen: Generator[Tuple[FrameType, int], None, None],
|
||||
*,
|
||||
limit: Optional[int] = ...,
|
||||
limit: int | None = ...,
|
||||
lookup_lines: bool = ...,
|
||||
capture_locals: bool = ...,
|
||||
) -> StackSummary: ...
|
||||
|
||||
Reference in New Issue
Block a user