mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 21:14:48 +08:00
Make email.policy classes generic (#12724)
This commit is contained in:
@@ -12,9 +12,9 @@ _MessageT = TypeVar("_MessageT", bound=Message, default=Message)
|
||||
|
||||
class Parser(Generic[_MessageT]):
|
||||
@overload
|
||||
def __init__(self: Parser[Message[str, str]], _class: None = None, *, policy: Policy = ...) -> None: ...
|
||||
def __init__(self: Parser[Message[str, str]], _class: None = None, *, policy: Policy[Message[str, str]] = ...) -> None: ...
|
||||
@overload
|
||||
def __init__(self, _class: Callable[[], _MessageT], *, policy: Policy = ...) -> None: ...
|
||||
def __init__(self, _class: Callable[[], _MessageT], *, policy: Policy[_MessageT] = ...) -> None: ...
|
||||
def parse(self, fp: SupportsRead[str], headersonly: bool = False) -> _MessageT: ...
|
||||
def parsestr(self, text: str, headersonly: bool = False) -> _MessageT: ...
|
||||
|
||||
@@ -25,9 +25,11 @@ class HeaderParser(Parser[_MessageT]):
|
||||
class BytesParser(Generic[_MessageT]):
|
||||
parser: Parser[_MessageT]
|
||||
@overload
|
||||
def __init__(self: BytesParser[Message[str, str]], _class: None = None, *, policy: Policy = ...) -> None: ...
|
||||
def __init__(
|
||||
self: BytesParser[Message[str, str]], _class: None = None, *, policy: Policy[Message[str, str]] = ...
|
||||
) -> None: ...
|
||||
@overload
|
||||
def __init__(self, _class: Callable[[], _MessageT], *, policy: Policy = ...) -> None: ...
|
||||
def __init__(self, _class: Callable[[], _MessageT], *, policy: Policy[_MessageT] = ...) -> None: ...
|
||||
def parse(self, fp: _WrappedBuffer, headersonly: bool = False) -> _MessageT: ...
|
||||
def parsebytes(self, text: bytes | bytearray, headersonly: bool = False) -> _MessageT: ...
|
||||
|
||||
|
||||
Reference in New Issue
Block a user