1010import  datetime 
1111import  os 
1212import  time 
13+ import  warnings 
1314from  abc  import  ABCMeta , abstractmethod 
1415from  threading  import  Thread 
1516from  typing  import  Callable , Iterable , List , Optional 
16- import  warnings 
1717
1818__all__  =  [
1919 "History" ,
@@ -40,7 +40,10 @@ def __init__(self) -> None:
4040 # Methods expected by `Buffer`. 
4141 # 
4242
43-  def  load (self , item_loaded_callback : Callable [[str ], None ],) ->  None :
43+  def  load (
44+  self ,
45+  item_loaded_callback : Callable [[str ], None ],
46+  ) ->  None :
4447 """ 
4548 Load the history and call the callback for every entry in the history. 
4649 This one assumes the callback is only called from same thread as `Buffer` is using. 
@@ -103,13 +106,13 @@ class ThreadedHistory(History):
103106 """ 
104107
105108 def  __init__ (
106-  self , history : History , event_loop : asyncio .BaseEventLoop  =  None 
109+  self , history : History , event_loop : Optional [ asyncio .AbstractEventLoop ]  =  None 
107110 ) ->  None :
108111 """Create instance of ThreadedHistory 
109112
110113 Args: 
111114 history (History): Instance of History intended to run on a background thread. 
112-  event_loop (asyncio.BaseEventLoop , optional): The event loop on which prompt toolkit is running. 
115+  event_loop (asyncio.AbstractEventLoop , optional): The event loop on which prompt toolkit is running. 
113116 (Deprecated) Defaults to ``asyncio.get_event_loop(), which may *create* the event loop. Caller should provide an explicit value. 
114117 """ 
115118 self .history  =  history 
@@ -151,7 +154,10 @@ def call_all_callbacks(item: str) -> None:
151154 self ._load_thread .daemon  =  True 
152155 self ._load_thread .start ()
153156
154-  def  bg_loader (self , item_loaded_callback : Callable [[str ], None ],) ->  None :
157+  def  bg_loader (
158+  self ,
159+  item_loaded_callback : Callable [[str ], None ],
160+  ) ->  None :
155161 """ 
156162 Load the history and schedule the callback for every entry in the history. 
157163 TODO: extend the callback so it can take a batch of lines in one event_loop dispatch. 
0 commit comments