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

@@ -13,12 +13,12 @@ from opcode import (
opmap as opmap,
opname as opname,
)
from typing import Any, Callable, Iterator, Union
from typing import Any, Callable, Iterator
# Strictly this should not have to include Callable, but mypy doesn't use FunctionType
# for functions (python/mypy#3171)
_have_code = Union[types.MethodType, types.FunctionType, types.CodeType, type, Callable[..., Any]]
_have_code_or_string = Union[_have_code, str, bytes]
_have_code = types.MethodType | types.FunctionType | types.CodeType | type | Callable[..., Any]
_have_code_or_string = _have_code | str | bytes
COMPILER_FLAG_NAMES: dict[int, str]