mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 13:04:46 +08:00
Continuing work towards #8988. The first five commits were created using stubdefaulter on various Python versions; the following commits were all created manually by me to fix various problems. The main things this adds that weren't present in #9501 are: - Defaults in Windows-only modules and Windows-only branches (because I'm running a Windows machine) - Defaults in non-py311 branches - Defaults for float parameters - Defaults for overloads
25 lines
965 B
Python
25 lines
965 B
Python
from collections.abc import Callable
|
|
from email.message import Message
|
|
from email.policy import Policy
|
|
from typing import Generic, TypeVar, overload
|
|
|
|
__all__ = ["FeedParser", "BytesFeedParser"]
|
|
|
|
_MessageT = TypeVar("_MessageT", bound=Message)
|
|
|
|
class FeedParser(Generic[_MessageT]):
|
|
@overload
|
|
def __init__(self: FeedParser[Message], _factory: None = None, *, policy: Policy = ...) -> None: ...
|
|
@overload
|
|
def __init__(self, _factory: Callable[[], _MessageT], *, policy: Policy = ...) -> None: ...
|
|
def feed(self, data: str) -> None: ...
|
|
def close(self) -> _MessageT: ...
|
|
|
|
class BytesFeedParser(Generic[_MessageT]):
|
|
@overload
|
|
def __init__(self: BytesFeedParser[Message], _factory: None = None, *, policy: Policy = ...) -> None: ...
|
|
@overload
|
|
def __init__(self, _factory: Callable[[], _MessageT], *, policy: Policy = ...) -> None: ...
|
|
def feed(self, data: bytes | bytearray) -> None: ...
|
|
def close(self) -> _MessageT: ...
|