6161 from collections .abc import (
6262 Awaitable ,
6363 Callable ,
64- Coroutine ,
6564 Generator ,
6665 Iterator ,
6766 Sequence ,
@@ -1303,8 +1302,7 @@ def start_soon(
13031302 GLOBAL_RUN_CONTEXT .runner .spawn_impl (async_fn , args , self , name )
13041303
13051304 # Typing changes blocked by https://github.com/python/mypy/pull/17512
1306- # Explicit "Any" is not allowed
1307- async def start ( # type: ignore[misc]
1305+ async def start ( # type: ignore[explicit-any]
13081306 self ,
13091307 async_fn : Callable [..., Awaitable [object ]],
13101308 * args : object ,
@@ -1404,10 +1402,9 @@ def __del__(self) -> None:
14041402
14051403@final
14061404@attrs .define (eq = False , repr = False )
1407- class Task (metaclass = NoPublicConstructor ): # type: ignore[misc ]
1405+ class Task (metaclass = NoPublicConstructor ): # type: ignore[explicit-any ]
14081406 _parent_nursery : Nursery | None
1409- # Explicit "Any" is not allowed
1410- coro : Coroutine [Any , Outcome [object ], Any ] # type: ignore[misc]
1407+ coro : types .CoroutineType [Any , Outcome [object ], Any ] # type: ignore[explicit-any]
14111408 _runner : Runner
14121409 name : str
14131410 context : contextvars .Context
@@ -1425,11 +1422,10 @@ class Task(metaclass=NoPublicConstructor): # type: ignore[misc]
14251422 # tracebacks with extraneous frames.
14261423 # - for scheduled tasks, custom_sleep_data is None
14271424 # Tasks start out unscheduled.
1428- # Explicit "Any" is not allowed
1429- _next_send_fn : Callable [[Any ], object ] | None = None # type: ignore[misc]
1430- _next_send : Outcome [Any ] | BaseException | None = None # type: ignore[misc]
1425+ _next_send_fn : Callable [[Any ], object ] | None = None # type: ignore[explicit-any]
1426+ _next_send : Outcome [Any ] | BaseException | None = None # type: ignore[explicit-any]
14311427 _abort_func : Callable [[_core .RaiseCancelT ], Abort ] | None = None
1432- custom_sleep_data : Any = None # type: ignore[misc ]
1428+ custom_sleep_data : Any = None # type: ignore[explicit-any ]
14331429
14341430 # For introspection and nursery.start()
14351431 _child_nurseries : list [Nursery ] = attrs .Factory (list )
@@ -1497,7 +1493,7 @@ def print_stack_for_task(task):
14971493
14981494 """
14991495 # Ignore static typing as we're doing lots of dynamic introspection
1500- coro : Any = self .coro # type: ignore[misc ]
1496+ coro : Any = self .coro # type: ignore[explicit-any ]
15011497 while coro is not None :
15021498 if hasattr (coro , "cr_frame" ):
15031499 # A real coroutine
@@ -1642,16 +1638,13 @@ class RunStatistics:
16421638
16431639
16441640@attrs .define (eq = False )
1645- # Explicit "Any" is not allowed
1646- class GuestState : # type: ignore[misc]
1641+ class GuestState : # type: ignore[explicit-any]
16471642 runner : Runner
16481643 run_sync_soon_threadsafe : Callable [[Callable [[], object ]], object ]
16491644 run_sync_soon_not_threadsafe : Callable [[Callable [[], object ]], object ]
1650- # Explicit "Any" is not allowed
1651- done_callback : Callable [[Outcome [Any ]], object ] # type: ignore[misc]
1645+ done_callback : Callable [[Outcome [Any ]], object ] # type: ignore[explicit-any]
16521646 unrolled_run_gen : Generator [float , EventResult , None ]
1653- # Explicit "Any" is not allowed
1654- unrolled_run_next_send : Outcome [Any ] = attrs .Factory (lambda : Value (None )) # type: ignore[misc]
1647+ unrolled_run_next_send : Outcome [Any ] = attrs .Factory (lambda : Value (None )) # type: ignore[explicit-any]
16551648
16561649 def guest_tick (self ) -> None :
16571650 prev_library , sniffio_library .name = sniffio_library .name , "trio"
@@ -1696,17 +1689,15 @@ def in_main_thread() -> None:
16961689
16971690
16981691@attrs .define (eq = False )
1699- # Explicit "Any" is not allowed
1700- class Runner : # type: ignore[misc]
1692+ class Runner : # type: ignore[explicit-any]
17011693 clock : Clock
17021694 instruments : Instruments
17031695 io_manager : TheIOManager
17041696 ki_manager : KIManager
17051697 strict_exception_groups : bool
17061698
17071699 # Run-local values, see _local.py
1708- # Explicit "Any" is not allowed
1709- _locals : dict [_core .RunVar [Any ], object ] = attrs .Factory (dict ) # type: ignore[misc]
1700+ _locals : dict [_core .RunVar [Any ], object ] = attrs .Factory (dict ) # type: ignore[explicit-any]
17101701
17111702 runq : deque [Task ] = attrs .Factory (deque )
17121703 tasks : set [Task ] = attrs .Factory (set )
@@ -1895,7 +1886,7 @@ async def python_wrapper(orig_coro: Awaitable[RetT]) -> RetT:
18951886 return await orig_coro
18961887
18971888 coro = python_wrapper (coro )
1898- assert coro .cr_frame is not None , "Coroutine frame should exist"
1889+ assert coro .cr_frame is not None , "Coroutine frame should exist" # type: ignore[attr-defined]
18991890
19001891 ######
19011892 # Set up the Task object
@@ -2133,8 +2124,7 @@ def _deliver_ki_cb(self) -> None:
21332124
21342125 # sortedcontainers doesn't have types, and is reportedly very hard to type:
21352126 # https://github.com/grantjenks/python-sortedcontainers/issues/68
2136- # Explicit "Any" is not allowed
2137- waiting_for_idle : Any = attrs .Factory (SortedDict ) # type: ignore[misc]
2127+ waiting_for_idle : Any = attrs .Factory (SortedDict ) # type: ignore[explicit-any]
21382128
21392129 @_public
21402130 async def wait_all_tasks_blocked (self , cushion : float = 0.0 ) -> None :
@@ -2435,8 +2425,7 @@ def run(
24352425 raise AssertionError (runner .main_task_outcome )
24362426
24372427
2438- # Explicit .../"Any" not allowed
2439- def start_guest_run ( # type: ignore[misc]
2428+ def start_guest_run ( # type: ignore[explicit-any]
24402429 async_fn : Callable [..., Awaitable [RetT ]],
24412430 * args : object ,
24422431 run_sync_soon_threadsafe : Callable [[Callable [[], object ]], object ],
0 commit comments