Add __all__ to dis (#6947)

This commit is contained in:
Nikita Sobolev
2022-01-18 17:56:24 +03:00
committed by GitHub
parent 7d2de33bba
commit 3cbdb5a1d2

View File

@@ -1,23 +1,36 @@
import sys
import types
from opcode import (
EXTENDED_ARG as EXTENDED_ARG,
HAVE_ARGUMENT as HAVE_ARGUMENT,
cmp_op as cmp_op,
hascompare as hascompare,
hasconst as hasconst,
hasfree as hasfree,
hasjabs as hasjabs,
hasjrel as hasjrel,
haslocal as haslocal,
hasname as hasname,
hasnargs as hasnargs,
opmap as opmap,
opname as opname,
stack_effect as stack_effect,
)
from opcode import * # `dis` re-exports it as a part of public API
from typing import IO, Any, Callable, Iterator, NamedTuple, Union
__all__ = [
"code_info",
"dis",
"disassemble",
"distb",
"disco",
"findlinestarts",
"findlabels",
"show_code",
"get_instructions",
"Instruction",
"Bytecode",
"cmp_op",
"hasconst",
"hasname",
"hasjrel",
"hasjabs",
"haslocal",
"hascompare",
"hasfree",
"opname",
"opmap",
"HAVE_ARGUMENT",
"EXTENDED_ARG",
"hasnargs",
"stack_effect",
]
# Strictly this should not have to include Callable, but mypy doesn't use FunctionType
# for functions (python/mypy#3171)
_HaveCodeType = Union[types.MethodType, types.FunctionType, types.CodeType, type, Callable[..., Any]]