Big diff: Use new "|" union syntax (#5872)

This commit is contained in:
Akuli authored and GitHub committed 2021-08-08 11:05:21 +02:00
1 parent b9adb7a874
commit ee487304d7
578 files changed
+8080 -8966

No files matched your search

+14 -14
View File
@@ -1,5 +1,5 @@
import textwrap
from typing import IO, Any, Callable, Dict, Generic, List, Optional, Text, Tuple, Type, TypeVar, Union, overload
from typing import IO, Any, Callable, Dict, Generic, List, Text, Tuple, Type, TypeVar, overload
from typing_extensions import SupportsIndex
_TB = TypeVar("_TB", bound="_BaseEntry")
@@ -19,7 +19,7 @@ def pofile(pofile: Text, **kwargs: Any) -> POFile: ...
def mofile(mofile: Text, *, klass: Type[_TM], **kwargs: Any) -> _TM: ...
@overload
def mofile(mofile: Text, **kwargs: Any) -> MOFile: ...
def detect_encoding(file: Union[bytes, Text], binary_mode: bool = ...) -> str: ...
def detect_encoding(file: bytes | Text, binary_mode: bool = ...) -> str: ...
def escape(st: Text) -> Text: ...
def unescape(st: Text) -> Text: ...
@@ -38,8 +38,8 @@ class _BaseFile(List[_TB]):
def append(self, entry: _TB) -> None: ...
def insert(self, index: SupportsIndex, entry: _TB) -> None: ...
def metadata_as_entry(self) -> POEntry: ...
def save(self, fpath: Optional[Text] = ..., repr_method: str = ...) -> None: ...
def find(self, st: Text, by: str = ..., include_obsolete_entries: bool = ..., msgctxt: bool = ...) -> Optional[_TB]: ...
def save(self, fpath: Text | None = ..., repr_method: str = ...) -> None: ...
def find(self, st: Text, by: str = ..., include_obsolete_entries: bool = ..., msgctxt: bool = ...) -> _TB | None: ...
def ordered_metadata(self) -> list[tuple[Text, Text]]: ...
def to_binary(self) -> bytes: ...
@@ -56,11 +56,11 @@ class POFile(_BaseFile[POEntry]):
class MOFile(_BaseFile[MOEntry]):
MAGIC: int
MAGIC_SWAPPED: int
magic_number: Optional[int]
magic_number: int | None
version: int
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
def save_as_pofile(self, fpath: str) -> None: ...
def save(self, fpath: Optional[Text] = ...) -> None: ... # type: ignore # binary file does not allow argument repr_method
def save(self, fpath: Text | None = ...) -> None: ... # type: ignore # binary file does not allow argument repr_method
def percent_translated(self) -> int: ...
def translated_entries(self) -> List[MOEntry]: ...
def untranslated_entries(self) -> List[MOEntry]: ...
@@ -84,10 +84,10 @@ class POEntry(_BaseEntry):
tcomment: Text
occurrences: List[Tuple[str, int]]
flags: List[Text]
previous_msgctxt: Optional[Text]
previous_msgid: Optional[Text]
previous_msgid_plural: Optional[Text]
linenum: Optional[int]
previous_msgctxt: Text | None
previous_msgid: Text | None
previous_msgid_plural: Text | None
linenum: int | None
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
def __unicode__(self, wrapwidth: int = ...) -> Text: ...
def __cmp__(self, other: POEntry) -> int: ...
@@ -110,9 +110,9 @@ class MOEntry(_BaseEntry):
tcomment: Text
occurrences: List[Tuple[str, int]]
flags: List[Text]
previous_msgctxt: Optional[Text]
previous_msgid: Optional[Text]
previous_msgid_plural: Optional[Text]
previous_msgctxt: Text | None
previous_msgid: Text | None
previous_msgid_plural: Text | None
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
def __hash__(self) -> int: ...
@@ -123,7 +123,7 @@ class _POFileParser(Generic[_TP]):
current_line: int
current_entry: POEntry
current_state: str
current_token: Optional[str]
current_token: str | None
msgstr_index: int
entry_obsolete: int
def __init__(self, pofile: Text, *args: Any, **kwargs: Any) -> None: ...