@@ -123,17 +123,17 @@ class Clock:
123123 """
124124
125125 _reactor : IReactorTime
126- _delayed_call_id : int = 0
127- """Unique ID used to track delayed calls"""
128-
129- _looping_calls : List [LoopingCall ] = []
130- """List of active looping calls"""
131-
132- _call_id_to_delayed_call : Dict [int , IDelayedCall ] = {}
133- """Mapping from unique call ID to delayed call"""
134126
135127 def __init__ (self , reactor : IReactorTime ) -> None :
136128 self ._reactor = reactor
129+ self ._delayed_call_id : int = 0
130+ """Unique ID used to track delayed calls"""
131+
132+ self ._looping_calls : List [LoopingCall ] = []
133+ """List of active looping calls"""
134+
135+ self ._call_id_to_delayed_call : Dict [int , IDelayedCall ] = {}
136+ """Mapping from unique call ID to delayed call"""
137137
138138 async def sleep (self , seconds : float ) -> None :
139139 d : defer .Deferred [float ] = defer .Deferred ()
@@ -246,16 +246,16 @@ def call_later(
246246 **kwargs: Key arguments to pass to function.
247247 """
248248
249- id = self ._delayed_call_id
250- self ._delayed_call_id += 1
249+ call_id = self ._delayed_call_id
250+ self ._delayed_call_id = self . _delayed_call_id + 1
251251
252252 def wrapped_callback (* args : Any , ** kwargs : Any ) -> None :
253253 callback (* args , ** kwargs )
254- self ._call_id_to_delayed_call .pop (id )
254+ self ._call_id_to_delayed_call .pop (call_id )
255255
256256 with context .PreserveLoggingContext ():
257257 call = self ._reactor .callLater (delay , wrapped_callback , * args , ** kwargs )
258- self ._call_id_to_delayed_call [id ] = call
258+ self ._call_id_to_delayed_call [call_id ] = call
259259 return call
260260
261261 def cancel_call_later (self , timer : IDelayedCall , ignore_errs : bool = False ) -> None :
0 commit comments