Use PEP 585 syntax wherever possible (#6717)

This commit is contained in:
Alex Waygood
2021-12-28 10:31:43 +00:00
committed by GitHub
parent e6cb341d94
commit 8d5d2520ac
237 changed files with 966 additions and 1069 deletions

View File

@@ -1,5 +1,5 @@
from collections.abc import Iterable, Iterator, Sequence
from typing import Any, Tuple
from typing import Any
from pygments.token import _TokenType
from pygments.util import Future
@@ -40,7 +40,7 @@ class _inherit: ...
inherit: Any
class combined(Tuple[Any]):
class combined(tuple[Any]):
def __new__(cls, *args): ...
def __init__(self, *args) -> None: ...

View File

@@ -1,13 +1,13 @@
from _typeshed import StrOrBytesPath, StrPath
from collections.abc import Iterator
from typing import Any, Tuple, Union
from typing import Any, Union
from pygments.lexer import Lexer, LexerMeta
_OpenFile = Union[StrOrBytesPath, int] # copy/pasted from builtins.pyi
# TODO: use lower-case tuple once mypy updated
def get_all_lexers() -> Iterator[tuple[str, Tuple[str, ...], Tuple[str, ...], Tuple[str, ...]]]: ...
def get_all_lexers() -> Iterator[tuple[str, tuple[str, ...], tuple[str, ...], tuple[str, ...]]]: ...
def find_lexer_class(name: str) -> LexerMeta | None: ...
def find_lexer_class_by_name(_alias: str) -> LexerMeta: ...
def get_lexer_by_name(_alias: str, **options: Any) -> Lexer: ...

View File

@@ -1,7 +1,6 @@
from collections.abc import Mapping
from typing import Tuple
class _TokenType(Tuple[str]): # TODO: change to lower-case tuple once new mypy released
class _TokenType(tuple[str]): # TODO: change to lower-case tuple once new mypy released
parent: _TokenType | None
def split(self) -> list[_TokenType]: ...
subtypes: set[_TokenType]