massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-pyright / node_modules / pyright / dist / typeshed-fallback / stdlib / dis.pyi
1 import sys
2 import types
3 from opcode import (
4     EXTENDED_ARG as EXTENDED_ARG,
5     HAVE_ARGUMENT as HAVE_ARGUMENT,
6     cmp_op as cmp_op,
7     hascompare as hascompare,
8     hasconst as hasconst,
9     hasfree as hasfree,
10     hasjabs as hasjabs,
11     hasjrel as hasjrel,
12     haslocal as haslocal,
13     hasname as hasname,
14     hasnargs as hasnargs,
15     opmap as opmap,
16     opname as opname,
17     stack_effect as stack_effect,
18 )
19 from typing import IO, Any, Callable, Iterator, NamedTuple, Union
20
21 # Strictly this should not have to include Callable, but mypy doesn't use FunctionType
22 # for functions (python/mypy#3171)
23 _have_code = Union[types.MethodType, types.FunctionType, types.CodeType, type, Callable[..., Any]]
24 _have_code_or_string = Union[_have_code, str, bytes]
25
26 class Instruction(NamedTuple):
27     opname: str
28     opcode: int
29     arg: int | None
30     argval: Any
31     argrepr: str
32     offset: int
33     starts_line: int | None
34     is_jump_target: bool
35
36 class Bytecode:
37     codeobj: types.CodeType
38     first_line: int
39     def __init__(self, x: _have_code_or_string, *, first_line: int | None = ..., current_offset: int | None = ...) -> None: ...
40     def __iter__(self) -> Iterator[Instruction]: ...
41     def __repr__(self) -> str: ...
42     def info(self) -> str: ...
43     def dis(self) -> str: ...
44     @classmethod
45     def from_traceback(cls, tb: types.TracebackType) -> Bytecode: ...
46
47 COMPILER_FLAG_NAMES: dict[int, str]
48
49 def findlabels(code: _have_code) -> list[int]: ...
50 def findlinestarts(code: _have_code) -> Iterator[tuple[int, int]]: ...
51 def pretty_flags(flags: int) -> str: ...
52 def code_info(x: _have_code_or_string) -> str: ...
53
54 if sys.version_info >= (3, 7):
55     def dis(x: _have_code_or_string | None = ..., *, file: IO[str] | None = ..., depth: int | None = ...) -> None: ...
56
57 else:
58     def dis(x: _have_code_or_string | None = ..., *, file: IO[str] | None = ...) -> None: ...
59
60 def distb(tb: types.TracebackType | None = ..., *, file: IO[str] | None = ...) -> None: ...
61 def disassemble(co: _have_code, lasti: int = ..., *, file: IO[str] | None = ...) -> None: ...
62 def disco(co: _have_code, lasti: int = ..., *, file: IO[str] | None = ...) -> None: ...
63 def show_code(co: _have_code, *, file: IO[str] | None = ...) -> None: ...
64 def get_instructions(x: _have_code, *, first_line: int | None = ...) -> Iterator[Instruction]: ...