mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-08-13 19:41:07 +08:00
Added __class_getitem__ (#4695)
Resolves #4682 Co-authored-by: hauntsaninja <>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import email.message
|
||||
import sys
|
||||
from _typeshed import AnyPath
|
||||
from types import TracebackType
|
||||
from typing import (
|
||||
@@ -24,6 +25,9 @@ from typing import (
|
||||
)
|
||||
from typing_extensions import Literal
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
from types import GenericAlias
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_MessageType = TypeVar("_MessageType", bound=Message)
|
||||
_MessageData = Union[email.message.Message, bytes, str, IO[str], IO[bytes]]
|
||||
@@ -76,6 +80,8 @@ class Mailbox(Generic[_MessageType]):
|
||||
def lock(self) -> None: ...
|
||||
def unlock(self) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
if sys.version_info >= (3, 9):
|
||||
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
|
||||
|
||||
class Maildir(Mailbox[MaildirMessage]):
|
||||
|
||||
@@ -188,6 +194,8 @@ class _ProxyFile(Generic[AnyStr]):
|
||||
def flush(self) -> None: ...
|
||||
@property
|
||||
def closed(self) -> bool: ...
|
||||
if sys.version_info >= (3, 9):
|
||||
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
|
||||
|
||||
class _PartialFile(_ProxyFile[AnyStr]):
|
||||
def __init__(self, f: IO[AnyStr], start: Optional[int] = ..., stop: Optional[int] = ...) -> None: ...
|
||||
|
||||
Reference in New Issue
Block a user