Skip to content

Commit 520022e

Browse files
committed
TIL how to chain ignores
1 parent b6255ba commit 520022e

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/svcs/_core.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
isgeneratorfunction,
2626
)
2727
from types import TracebackType
28-
from typing import Any, TypeVar, no_type_check, overload
28+
from typing import Any, TypeVar, overload
2929
from unittest.mock import MagicMock
3030

3131
import attrs
@@ -469,7 +469,6 @@ def close(self) -> None:
469469
self._services.clear()
470470
self._on_close.clear()
471471

472-
@no_type_check # both ty and pyrefly choke on this method
473472
async def aclose(self) -> None:
474473
"""
475474
Clear registrations and run all *on_registry_close* callbacks.
@@ -482,15 +481,15 @@ async def aclose(self) -> None:
482481
for rs, oc in reversed(self._on_close):
483482
try:
484483
if iscoroutinefunction(oc):
485-
oc = oc() # noqa: PLW2901
484+
oc = oc() # noqa: PLW2901 # ty: ignore[call-non-callable] # pyrefly: ignore[bad-assignment]
486485

487486
if isawaitable(oc):
488487
log.debug("async closing %r", rs.name)
489488
await oc
490489
log.debug("async closed %r", rs.name)
491490
else:
492491
log.debug("closing %r", rs.name)
493-
oc()
492+
oc() # pyrefly: ignore[unused-coroutine]
494493
log.debug("closed %r", rs.name)
495494
except Exception: # noqa: BLE001, PERF203
496495
log.warning(

0 commit comments

Comments
 (0)