added type hints for new stuff
This commit is contained in:
@@ -138,6 +138,8 @@ def fetch_email_by_uid(uid, connection, parser_policy):
|
|||||||
|
|
||||||
email_object = parse_email(raw_email, policy=parser_policy)
|
email_object = parse_email(raw_email, policy=parser_policy)
|
||||||
flags = parse_flags(raw_headers.decode())
|
flags = parse_flags(raw_headers.decode())
|
||||||
|
if len(flags) > 0:
|
||||||
|
print(type(flags[0]))
|
||||||
email_object.__dict__['flags'] = flags
|
email_object.__dict__['flags'] = flags
|
||||||
|
|
||||||
return email_object
|
return email_object
|
||||||
|
|||||||
@@ -26,5 +26,9 @@ def parse_attachment(message_part: Message) -> Optional[Dict[str, Union[int, str
|
|||||||
def decode_content(message: Message) -> str: ...
|
def decode_content(message: Message) -> str: ...
|
||||||
|
|
||||||
def fetch_email_by_uid(uid: bytes, connection: IMAP4_SSL, parser_policy: Optional[Policy]) -> Struct: ...
|
def fetch_email_by_uid(uid: bytes, connection: IMAP4_SSL, parser_policy: Optional[Policy]) -> Struct: ...
|
||||||
|
raw_headers: bytes
|
||||||
|
raw_email: bytes
|
||||||
|
|
||||||
|
def parse_flags(headers: str) -> Union[list, List[bytes]]: ...
|
||||||
|
|
||||||
def parse_email(raw_email: bytes, policy: Optional[Policy]) -> Struct: ...
|
def parse_email(raw_email: bytes, policy: Optional[Policy]) -> Struct: ...
|
||||||
|
|||||||
9
imbox/vendors/__init__.pyi
vendored
Normal file
9
imbox/vendors/__init__.pyi
vendored
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
from typing import List, Dict, Optional
|
||||||
|
|
||||||
|
from imbox.messages import Messages
|
||||||
|
|
||||||
|
vendors: List[Messages]
|
||||||
|
|
||||||
|
hostname_vendorname_dict: Dict[str, str]
|
||||||
|
name_authentication_string_dict: Dict[str, Optional[str]]
|
||||||
|
|
||||||
14
imbox/vendors/gmail.pyi
vendored
Normal file
14
imbox/vendors/gmail.pyi
vendored
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
import datetime
|
||||||
|
from email._policybase import Policy
|
||||||
|
from imaplib import IMAP4, IMAP4_SSL
|
||||||
|
from typing import Union
|
||||||
|
|
||||||
|
from imbox.messages import Messages
|
||||||
|
|
||||||
|
|
||||||
|
class GmailMessages(Messages):
|
||||||
|
|
||||||
|
def __init__(self,
|
||||||
|
connection: Union[IMAP4, IMAP4_SSL],
|
||||||
|
parser_policy: Policy,
|
||||||
|
**kwargs: Union[bool, str, datetime.date]) -> None: ...
|
||||||
Reference in New Issue
Block a user