@@ -2,7 +2,7 @@ import sys
22from _typeshed import Incomplete
33from collections .abc import Callable , Iterable , Iterator
44from contextlib import AbstractContextManager
5- from typing import Any , Literal , overload
5+ from typing import Any , Literal , Protocol , overload , type_check_only
66from typing_extensions import Self , TypeAlias , deprecated
77
88from psutil ._common import (
@@ -234,11 +234,18 @@ class Popen(Process):
234234 def __getattribute__ (self , name : str ) -> Any : ...
235235 def __dir__ (self ) -> list [str ]: ...
236236
237+ @type_check_only
238+ class _ProcessIterCallable (Protocol ):
239+ def __call__ (
240+ self , attrs : list [str ] | tuple [str , ...] | set [str ] | frozenset [str ] | None = None , ad_value = None
241+ ) -> Iterator [Process ]: ...
242+ def cache_clear (self ) -> None : ...
243+
237244def pids () -> list [int ]: ...
238245def pid_exists (pid : int ) -> bool : ...
239- def process_iter (
240- attrs : list [ str ] | tuple [ str , ...] | set [ str ] | frozenset [ str ] | None = None , ad_value = None
241- ) -> Iterator [ Process ]: ...
246+
247+ process_iter : _ProcessIterCallable
248+
242249def wait_procs (
243250 procs : Iterable [Process ], timeout : float | None = None , callback : Callable [[Process ], object ] | None = None
244251) -> tuple [list [Process ], list [Process ]]: ...
0 commit comments