@@ -204,7 +204,9 @@ async def release(self) -> None:
204204 ttl_seconds = int (self .ttl .total_seconds ())
205205
206206 # Execute the release Lua script atomically
207- result = await type (self ).release_script ( # noqa: SLF001
207+ cls = type (self )
208+ assert cls .release_script is not None # nosec
209+ result = await cls .release_script (
208210 keys = (
209211 self .semaphore_key ,
210212 self .holder_key ,
@@ -239,7 +241,9 @@ async def _try_acquire(self) -> bool:
239241 ttl_seconds = int (self .ttl .total_seconds ())
240242
241243 # Execute the Lua script atomically
242- result = await type (self ).acquire_script ( # noqa: SLF001
244+ cls = type (self )
245+ assert cls .acquire_script is not None # nosec
246+ result = await cls .acquire_script (
243247 keys = (self .semaphore_key , self .holder_key ),
244248 args = (self .instance_id , str (self .capacity ), str (ttl_seconds )),
245249 client = self .redis_client .redis ,
@@ -282,7 +286,9 @@ async def reacquire(self) -> None:
282286 ttl_seconds = int (self .ttl .total_seconds ())
283287
284288 # Execute the renewal Lua script atomically
285- result = await type (self ).renew_script ( # noqa: SLF001
289+ cls = type (self )
290+ assert cls .renew_script is not None # nosec
291+ result = await cls .renew_script (
286292 keys = (self .semaphore_key , self .holder_key ),
287293 args = (
288294 self .instance_id ,
@@ -330,7 +336,9 @@ async def get_current_count(self) -> int:
330336 ttl_seconds = int (self .ttl .total_seconds ())
331337
332338 # Execute the count Lua script atomically
333- result = await type (self ).count_script ( # noqa: SLF001
339+ cls = type (self )
340+ assert cls .count_script is not None # nosec
341+ result = await cls .count_script (
334342 keys = (self .semaphore_key ,),
335343 args = (str (ttl_seconds ),),
336344 client = self .redis_client .redis ,
0 commit comments