Switch to PEP-604 syntax in python2 stubs (#5915)

Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
This commit is contained in:
Oleg Höfling
2021-08-14 11:12:30 +02:00
committed by GitHub
parent 431c4f7fc1
commit ff63953188
235 changed files with 2473 additions and 2768 deletions

View File

@@ -2,7 +2,7 @@ import subprocess
import time
from socket import socket as _socket
from ssl import SSLSocket
from typing import IO, Any, Callable, Dict, List, Optional, Pattern, Text, Tuple, Type, Union
from typing import IO, Any, Callable, Dict, List, Pattern, Text, Tuple, Type, Union
from typing_extensions import Literal
# TODO: Commands should use their actual return types, not this type alias.
@@ -18,9 +18,9 @@ class IMAP4:
mustquote: Pattern[Text] = ...
debug: int = ...
state: str = ...
literal: Optional[Text] = ...
tagged_commands: Dict[bytes, Optional[List[bytes]]]
untagged_responses: Dict[str, List[Union[bytes, Tuple[bytes, bytes]]]]
literal: Text | None = ...
tagged_commands: Dict[bytes, List[bytes] | None]
untagged_responses: Dict[str, List[bytes | Tuple[bytes, bytes]]]
continuation_response: str = ...
is_readonly: bool = ...
tagnum: int = ...
@@ -35,7 +35,7 @@ class IMAP4:
host: str = ...
port: int = ...
sock: _socket = ...
file: Union[IO[Text], IO[bytes]] = ...
file: IO[Text] | IO[bytes] = ...
def read(self, size: int) -> bytes: ...
def readline(self) -> bytes: ...
def send(self, data: bytes) -> None: ...
@@ -44,7 +44,7 @@ class IMAP4:
def recent(self) -> _CommandResults: ...
def response(self, code: str) -> _CommandResults: ...
def append(self, mailbox: str, flags: str, date_time: str, message: str) -> str: ...
def authenticate(self, mechanism: str, authobject: Callable[[bytes], Optional[bytes]]) -> Tuple[str, str]: ...
def authenticate(self, mechanism: str, authobject: Callable[[bytes], bytes | None]) -> Tuple[str, str]: ...
def capability(self) -> _CommandResults: ...
def check(self) -> _CommandResults: ...
def close(self) -> _CommandResults: ...
@@ -69,8 +69,8 @@ class IMAP4:
def partial(self, message_num: str, message_part: str, start: str, length: str) -> _CommandResults: ...
def proxyauth(self, user: str) -> _CommandResults: ...
def rename(self, oldmailbox: str, newmailbox: str) -> _CommandResults: ...
def search(self, charset: Optional[str], *criteria: str) -> _CommandResults: ...
def select(self, mailbox: str = ..., readonly: bool = ...) -> Tuple[str, List[Optional[bytes]]]: ...
def search(self, charset: str | None, *criteria: str) -> _CommandResults: ...
def select(self, mailbox: str = ..., readonly: bool = ...) -> Tuple[str, List[bytes | None]]: ...
def setacl(self, mailbox: str, who: str, what: str) -> _CommandResults: ...
def setannotation(self, *args: str) -> _CommandResults: ...
def setquota(self, root: str, limits: str) -> _CommandResults: ...
@@ -87,13 +87,13 @@ class IMAP4:
class IMAP4_SSL(IMAP4):
keyfile: str = ...
certfile: str = ...
def __init__(self, host: str = ..., port: int = ..., keyfile: Optional[str] = ..., certfile: Optional[str] = ...) -> None: ...
def __init__(self, host: str = ..., port: int = ..., keyfile: str | None = ..., certfile: str | None = ...) -> None: ...
host: str = ...
port: int = ...
sock: _socket = ...
sslobj: SSLSocket = ...
file: IO[Any] = ...
def open(self, host: str = ..., port: Optional[int] = ...) -> None: ...
def open(self, host: str = ..., port: int | None = ...) -> None: ...
def read(self, size: int) -> bytes: ...
def readline(self) -> bytes: ...
def send(self, data: bytes) -> None: ...
@@ -111,7 +111,7 @@ class IMAP4_stream(IMAP4):
process: subprocess.Popen[bytes] = ...
writefile: IO[Any] = ...
readfile: IO[Any] = ...
def open(self, host: Optional[str] = ..., port: Optional[int] = ...) -> None: ...
def open(self, host: str | None = ..., port: int | None = ...) -> None: ...
def read(self, size: int) -> bytes: ...
def readline(self) -> bytes: ...
def send(self, data: bytes) -> None: ...
@@ -127,4 +127,4 @@ class _Authenticator:
def Internaldate2tuple(resp: str) -> time.struct_time: ...
def Int2AP(num: int) -> str: ...
def ParseFlags(resp: str) -> Tuple[str]: ...
def Time2Internaldate(date_time: Union[float, time.struct_time, str]) -> str: ...
def Time2Internaldate(date_time: float | time.struct_time | str) -> str: ...