Cleanup: use lower-case list and dict, add a test (#6161)

This commit is contained in:
Akuli
2021-10-13 19:59:27 +00:00
committed by GitHub
parent eab7adad62
commit e72a4034bf
8 changed files with 42 additions and 45 deletions

View File

@@ -235,7 +235,7 @@ class Tag(PageElement):
sourcepos: int | None
known_xml: bool | None
attrs: Mapping[str, str]
contents: List[PageElement]
contents: list[PageElement]
hidden: bool
can_be_empty_element: bool | None
cdata_list_attributes: list[str] | None

View File

@@ -1,5 +1,5 @@
from collections import OrderedDict
from typing import Any, Iterator, List
from typing import Any, Iterator
from .locale import Locale
@@ -8,16 +8,16 @@ LOCALE_SPLIT_PATTERN: Any
class LocaleDataLoader:
def get_locale_map(
self,
languages: List[str] | None = ...,
locales: List[str] | None = ...,
languages: list[str] | None = ...,
locales: list[str] | None = ...,
region: str | None = ...,
use_given_order: bool = ...,
allow_conflicting_locales: bool = ...,
) -> OrderedDict[str, List[Any] | str | int]: ...
) -> OrderedDict[str, list[Any] | str | int]: ...
def get_locales(
self,
languages: List[str] | None = ...,
locales: List[str] | None = ...,
languages: list[str] | None = ...,
locales: list[str] | None = ...,
region: str | None = ...,
use_given_order: bool = ...,
allow_conflicting_locales: bool = ...,

View File

@@ -1,6 +1,6 @@
import sys
from datetime import datetime
from typing import Any, List, Mapping, Set, Tuple, overload
from typing import Any, Mapping, Set, Tuple, overload
if sys.version_info >= (3, 8):
from typing import Literal
@@ -10,14 +10,14 @@ else:
@overload
def search_dates(
text: str,
languages: List[str] | Tuple[str] | Set[str] | None,
languages: list[str] | Tuple[str] | Set[str] | None,
settings: Mapping[Any, Any] | None,
add_detected_language: Literal[True],
) -> List[Tuple[str, datetime, str]]: ...
) -> list[Tuple[str, datetime, str]]: ...
@overload
def search_dates(
text: str,
languages: List[str] | Tuple[str] | Set[str] | None = ...,
languages: list[str] | Tuple[str] | Set[str] | None = ...,
settings: Mapping[Any, Any] | None = ...,
add_detected_language: Literal[False] = ...,
) -> List[Tuple[str, datetime]]: ...
) -> list[Tuple[str, datetime]]: ...

View File

@@ -1,6 +1,6 @@
import sys
from _typeshed import Self
from typing import Any, Dict, Iterator, List, Sequence, Text, Tuple, Type
from typing import Any, Iterator, Sequence, Text, Tuple, Type
if sys.version_info >= (3, 0):
from configparser import ConfigParser
@@ -53,5 +53,5 @@ def iter_files_distros(
path: Sequence[Text] | None = ..., repeated_distro: Text = ...
) -> Iterator[Tuple[ConfigParser, Distribution | None]]: ...
def get_single(group: Text, name: Text, path: Sequence[Text] | None = ...) -> EntryPoint: ...
def get_group_named(group: Text, path: Sequence[Text] | None = ...) -> Dict[str, EntryPoint]: ...
def get_group_all(group: Text, path: Sequence[Text] | None = ...) -> List[EntryPoint]: ...
def get_group_named(group: Text, path: Sequence[Text] | None = ...) -> dict[str, EntryPoint]: ...
def get_group_all(group: Text, path: Sequence[Text] | None = ...) -> list[EntryPoint]: ...