mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 13:04:46 +08:00
Big diff: Use new "|" union syntax (#5872)
This commit is contained in:
@@ -16,7 +16,7 @@ from opcode import (
|
||||
opname as opname,
|
||||
stack_effect as stack_effect,
|
||||
)
|
||||
from typing import IO, Any, Callable, Dict, Iterator, List, NamedTuple, Optional, Tuple, Union
|
||||
from typing import IO, Any, Callable, Dict, Iterator, List, NamedTuple, Tuple, Union
|
||||
|
||||
# Strictly this should not have to include Callable, but mypy doesn't use FunctionType
|
||||
# for functions (python/mypy#3171)
|
||||
@@ -26,19 +26,17 @@ _have_code_or_string = Union[_have_code, str, bytes]
|
||||
class Instruction(NamedTuple):
|
||||
opname: str
|
||||
opcode: int
|
||||
arg: Optional[int]
|
||||
arg: int | None
|
||||
argval: Any
|
||||
argrepr: str
|
||||
offset: int
|
||||
starts_line: Optional[int]
|
||||
starts_line: int | None
|
||||
is_jump_target: bool
|
||||
|
||||
class Bytecode:
|
||||
codeobj: types.CodeType
|
||||
first_line: int
|
||||
def __init__(
|
||||
self, x: _have_code_or_string, *, first_line: Optional[int] = ..., current_offset: Optional[int] = ...
|
||||
) -> None: ...
|
||||
def __init__(self, x: _have_code_or_string, *, first_line: int | None = ..., current_offset: int | None = ...) -> None: ...
|
||||
def __iter__(self) -> Iterator[Instruction]: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def info(self) -> str: ...
|
||||
@@ -54,13 +52,13 @@ def pretty_flags(flags: int) -> str: ...
|
||||
def code_info(x: _have_code_or_string) -> str: ...
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
def dis(x: Optional[_have_code_or_string] = ..., *, file: Optional[IO[str]] = ..., depth: Optional[int] = ...) -> None: ...
|
||||
def dis(x: _have_code_or_string | None = ..., *, file: IO[str] | None = ..., depth: int | None = ...) -> None: ...
|
||||
|
||||
else:
|
||||
def dis(x: Optional[_have_code_or_string] = ..., *, file: Optional[IO[str]] = ...) -> None: ...
|
||||
def dis(x: _have_code_or_string | None = ..., *, file: IO[str] | None = ...) -> None: ...
|
||||
|
||||
def distb(tb: Optional[types.TracebackType] = ..., *, file: Optional[IO[str]] = ...) -> None: ...
|
||||
def disassemble(co: _have_code, lasti: int = ..., *, file: Optional[IO[str]] = ...) -> None: ...
|
||||
def disco(co: _have_code, lasti: int = ..., *, file: Optional[IO[str]] = ...) -> None: ...
|
||||
def show_code(co: _have_code, *, file: Optional[IO[str]] = ...) -> None: ...
|
||||
def get_instructions(x: _have_code, *, first_line: Optional[int] = ...) -> Iterator[Instruction]: ...
|
||||
def distb(tb: types.TracebackType | None = ..., *, file: IO[str] | None = ...) -> None: ...
|
||||
def disassemble(co: _have_code, lasti: int = ..., *, file: IO[str] | None = ...) -> None: ...
|
||||
def disco(co: _have_code, lasti: int = ..., *, file: IO[str] | None = ...) -> None: ...
|
||||
def show_code(co: _have_code, *, file: IO[str] | None = ...) -> None: ...
|
||||
def get_instructions(x: _have_code, *, first_line: int | None = ...) -> Iterator[Instruction]: ...
|
||||
|
||||
Reference in New Issue
Block a user