Use PEP 604 syntax wherever possible (#7493)

This commit is contained in:
Alex Waygood
2022-03-16 15:01:33 +00:00
committed by GitHub
parent 15e21a8dc1
commit 3ab250eec8
174 changed files with 472 additions and 490 deletions

View File

@@ -2,7 +2,7 @@ import sys
import types
from _typeshed import Self
from opcode import * # `dis` re-exports it as a part of public API
from typing import IO, Any, Callable, Iterator, NamedTuple, Union
from typing import IO, Any, Callable, Iterator, NamedTuple
__all__ = [
"code_info",
@@ -34,8 +34,8 @@ __all__ = [
# 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]]
_HaveCodeOrStringType = Union[_HaveCodeType, str, bytes]
_HaveCodeType = types.MethodType | types.FunctionType | types.CodeType | type | Callable[..., Any]
_HaveCodeOrStringType = _HaveCodeType | str | bytes
class Instruction(NamedTuple):
opname: str