11import time
22import random
3+ from typing import Dict , Optional , Tuple , List , Callable
34from datetime import datetime
45from dataclasses import dataclass
5- from typing import Optional , List , Tuple , Dict
66
77import requests
88
99from . import utils
1010
11- __all__ = ('OneSecMail' ,)
11+ __all__ = (
12+ 'OneSecMail' ,
13+ )
1214
1315
1416class OneSecMail :
@@ -17,7 +19,12 @@ class OneSecMail:
1719 inbox_update_interval = 0.5
1820 """How often to update the inbox in seconds"""
1921
20- def __init__ (self , address : Optional [str ] = None , username : Optional [str ] = None , domain : Optional [str ] = None ) -> None :
22+ def __init__ (
23+ self ,
24+ address : Optional [str ] = None ,
25+ username : Optional [str ] = None ,
26+ domain : Optional [str ] = None ,
27+ ) -> None :
2128 """Create a new 1secmail.com email address
2229
2330 :param address: The full email address (username@domain)
@@ -57,7 +64,8 @@ def download_attachment(self, id: int, file: str) -> bytes:
5764 resp .raise_for_status ()
5865 return resp .content
5966
60- def wait_for_message (self , timeout : Optional [int ] = 60 , filter : callable = lambda _ : True ) -> 'OneSecMail.Message' :
67+ def wait_for_message (self , timeout : Optional [int ] = 60 ,
68+ filter : Callable [['OneSecMail.Message' ], bool ] = lambda _ : True ) -> 'OneSecMail.Message' :
6169 """Wait for a message to arrive in the inbox
6270
6371 :param timeout: How long to wait for a message to arrive, in seconds
@@ -148,7 +156,7 @@ class Message:
148156 html_body : str
149157 "Message body (html format)"
150158 _mail_instance : 'OneSecMail'
151- _attachments : list [ dict [str , any ]]
159+ _attachments : List [ Dict [str , any ]]
152160
153161 @property
154162 def date (self ) -> datetime :
@@ -158,7 +166,8 @@ def date(self) -> datetime:
158166 @property
159167 def attachments (self ) -> List ['OneSecMail.Attachment' ]:
160168 """List of attachments in the message (files)"""
161- return [OneSecMail .Attachment .from_dict (self ._mail_instance , self .id , attachment ) for attachment in self ._attachments ]
169+ return [OneSecMail .Attachment .from_dict (self ._mail_instance , self .id , attachment )
170+ for attachment in self ._attachments ]
162171
163172 @classmethod
164173 def from_dict (cls , mail_instance : 'OneSecMail' , msg : Dict [str , any ]) -> 'OneSecMail.Message' :
0 commit comments