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,4 +1,4 @@
from typing import Any, ClassVar, NamedTuple, Tuple
from typing import Any, ClassVar, NamedTuple
__docformat__: str
__version__: str
@@ -23,19 +23,19 @@ class ApplicationError(Exception): ...
class DataError(ApplicationError): ...
class SettingsSpec:
settings_spec: ClassVar[Tuple[Any, ...]]
settings_spec: ClassVar[tuple[Any, ...]]
settings_defaults: ClassVar[dict[Any, Any] | None]
settings_default_overrides: ClassVar[dict[Any, Any] | None]
relative_path_settings: ClassVar[Tuple[Any, ...]]
relative_path_settings: ClassVar[tuple[Any, ...]]
config_section: ClassVar[str | None]
config_section_dependencies: ClassVar[Tuple[str, ...] | None]
config_section_dependencies: ClassVar[tuple[str, ...] | None]
class TransformSpec:
def get_transforms(self) -> list[Any]: ...
default_transforms: ClassVar[Tuple[Any, ...]]
default_transforms: ClassVar[tuple[Any, ...]]
unknown_reference_resolvers: ClassVar[list[Any]]
class Component(SettingsSpec, TransformSpec):
component_type: ClassVar[str | None]
supported: ClassVar[Tuple[str, ...]]
supported: ClassVar[tuple[str, ...]]
def supports(self, format: str) -> bool: ...

View File

@@ -1,7 +1,7 @@
import optparse
from collections.abc import Iterable, Mapping
from configparser import RawConfigParser
from typing import Any, ClassVar, Tuple, Type
from typing import Any, ClassVar, Type
from docutils import SettingsSpec
from docutils.parsers import Parser
@@ -45,7 +45,7 @@ def validate_smartquotes_locales(
) -> list[tuple[str, str]]: ...
def make_paths_absolute(pathdict, keys, base_path: Any | None = ...) -> None: ...
def make_one_path_absolute(base_path, path) -> str: ...
def filter_settings_spec(settings_spec, *exclude, **replace) -> Tuple[Any, ...]: ...
def filter_settings_spec(settings_spec, *exclude, **replace) -> tuple[Any, ...]: ...
class Values(optparse.Values):
def update(self, other_dict, option_parser) -> None: ...

View File

@@ -1,6 +1,6 @@
from typing import ClassVar, Tuple
from typing import ClassVar
from docutils import parsers
class Parser(parsers.Parser):
config_section_dependencies: ClassVar[Tuple[str, ...]]
config_section_dependencies: ClassVar[tuple[str, ...]]

View File

@@ -1,11 +1,11 @@
from typing import Any, ClassVar, Tuple
from typing import Any, ClassVar
from typing_extensions import Literal
from docutils import parsers
from docutils.parsers.rst import states
class Parser(parsers.Parser):
config_section_dependencies: ClassVar[Tuple[str, ...]]
config_section_dependencies: ClassVar[tuple[str, ...]]
initial_state: Literal["Body", "RFC2822Body"]
state_classes: Any
inliner: Any

View File

@@ -1,11 +1,11 @@
from typing import Any, Callable, Dict, List, Tuple
from typing import Any, Callable
import docutils.nodes
import docutils.parsers.rst.states
_RoleFn = Callable[
[str, str, str, int, docutils.parsers.rst.states.Inliner, Dict[str, Any], List[str]],
Tuple[List[docutils.nodes.reference], List[docutils.nodes.reference]],
[str, str, str, int, docutils.parsers.rst.states.Inliner, dict[str, Any], list[str]],
tuple[list[docutils.nodes.reference], list[docutils.nodes.reference]],
]
def register_local_role(name: str, role_fn: _RoleFn) -> None: ...