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

This commit is contained in:
Akuli
2021-08-08 12:05:21 +03:00
committed by GitHub
parent b9adb7a874
commit ee487304d7
578 changed files with 8080 additions and 8966 deletions

View File

@@ -1,7 +1,7 @@
import types
from _typeshed import StrPath
from os import PathLike
from typing import IO, Any, List, Optional, Protocol, Tuple, TypeVar, Union
from typing import IO, Any, List, Protocol, Tuple, TypeVar
from _imp import (
acquire_lock as acquire_lock,
@@ -31,7 +31,7 @@ IMP_HOOK: int
def new_module(name: str) -> types.ModuleType: ...
def get_magic() -> bytes: ...
def get_tag() -> str: ...
def cache_from_source(path: StrPath, debug_override: Optional[bool] = ...) -> str: ...
def cache_from_source(path: StrPath, debug_override: bool | None = ...) -> str: ...
def source_from_cache(path: StrPath) -> str: ...
def get_suffixes() -> List[Tuple[str, str, int]]: ...
@@ -44,21 +44,21 @@ class NullImporter:
class _FileLike(Protocol):
closed: bool
mode: str
def read(self) -> Union[str, bytes]: ...
def read(self) -> str | bytes: ...
def close(self) -> Any: ...
def __enter__(self) -> Any: ...
def __exit__(self, *args: Any) -> Any: ...
# PathLike doesn't work for the pathname argument here
def load_source(name: str, pathname: str, file: Optional[_FileLike] = ...) -> types.ModuleType: ...
def load_compiled(name: str, pathname: str, file: Optional[_FileLike] = ...) -> types.ModuleType: ...
def load_source(name: str, pathname: str, file: _FileLike | None = ...) -> types.ModuleType: ...
def load_compiled(name: str, pathname: str, file: _FileLike | None = ...) -> types.ModuleType: ...
def load_package(name: str, path: StrPath) -> types.ModuleType: ...
def load_module(name: str, file: Optional[_FileLike], filename: str, details: Tuple[str, str, int]) -> types.ModuleType: ...
def load_module(name: str, file: _FileLike | None, filename: str, details: Tuple[str, str, int]) -> types.ModuleType: ...
# IO[Any] is a TextIOWrapper if name is a .py file, and a FileIO otherwise.
def find_module(
name: str, path: Union[None, List[str], List[PathLike[str]], List[StrPath]] = ...
name: str, path: None | List[str] | List[PathLike[str]] | List[StrPath] = ...
) -> Tuple[IO[Any], str, Tuple[str, str, int]]: ...
def reload(module: types.ModuleType) -> types.ModuleType: ...
def init_builtin(name: str) -> Optional[types.ModuleType]: ...
def init_builtin(name: str) -> types.ModuleType | None: ...
def load_dynamic(name: str, path: str, file: Any = ...) -> types.ModuleType: ... # file argument is ignored