1
1
import sys
2
- from typing import Any , Callable , ContextManager , Iterable , Iterator , TypeVar
2
+ from typing import Any , Callable , ContextManager , Iterable , Iterator , Tuple , TypeVar
3
3
4
4
from ._common import (
5
5
AIX as AIX ,
@@ -97,6 +97,16 @@ if sys.platform == "win32":
97
97
win_service_iter as win_service_iter ,
98
98
)
99
99
100
+ if sys .platform == "linux" :
101
+ from ._pslinux import pfullmem , pmem
102
+ elif sys .platform == "darwin" :
103
+ from ._psosx import pfullmem , pmem
104
+ elif sys .platform == "win32" :
105
+ from ._pswindows import pfullmem , pmem
106
+ else :
107
+ pmem = Any
108
+ pfullmem = Any
109
+
100
110
if sys .platform == "linux" :
101
111
PROCFS_PATH : str
102
112
AF_LINK : int
@@ -106,20 +116,22 @@ __author__: str
106
116
107
117
class Process :
108
118
def __init__ (self , pid : int | None = ...) -> None : ...
109
- def __eq__ (self , other ) -> bool : ...
110
- def __ne__ (self , other ) -> bool : ...
119
+ def __eq__ (self , other : object ) -> bool : ...
120
+ def __ne__ (self , other : object ) -> bool : ...
111
121
def __hash__ (self ) -> int : ...
112
122
@property
113
123
def pid (self ) -> int : ...
114
124
def oneshot (self ) -> ContextManager [None ]: ...
115
- def as_dict (self , attrs : Any | None = ..., ad_value : Any | None = ...): ...
125
+ def as_dict (
126
+ self , attrs : list [str ] | Tuple [str , ...] | set [str ] | frozenset [str ] | None = ..., ad_value : Any | None = ...
127
+ ) -> dict [str , Any ]: ...
116
128
def parent (self ) -> Process : ...
117
129
def parents (self ) -> list [Process ]: ...
118
130
def is_running (self ) -> bool : ...
119
131
def ppid (self ) -> int : ...
120
132
def name (self ) -> str : ...
121
133
def exe (self ) -> str : ...
122
- def cmdline (self ): ...
134
+ def cmdline (self ) -> list [ str ] : ...
123
135
def status (self ) -> int : ...
124
136
def username (self ) -> str : ...
125
137
def create_time (self ) -> float : ...
@@ -148,9 +160,9 @@ class Process:
148
160
def children (self , recursive : bool = ...) -> list [Process ]: ...
149
161
def cpu_percent (self , interval : float | None = ...) -> float : ...
150
162
def cpu_times (self ) -> pcputimes : ...
151
- def memory_info (self ): ...
152
- def memory_info_ex (self ): ...
153
- def memory_full_info (self ): ...
163
+ def memory_info (self ) -> pmem : ...
164
+ def memory_info_ex (self ) -> pmem : ...
165
+ def memory_full_info (self ) -> pfullmem : ...
154
166
def memory_percent (self , memtype : str = ...) -> float : ...
155
167
if sys .platform != "darwin" :
156
168
def memory_maps (self , grouped : bool = ...): ...
@@ -173,7 +185,9 @@ class Popen(Process):
173
185
174
186
def pids () -> list [int ]: ...
175
187
def pid_exists (pid : int ) -> bool : ...
176
- def process_iter (attrs : Any | None = ..., ad_value : Any | None = ...) -> Iterator [Process ]: ...
188
+ def process_iter (
189
+ attrs : list [str ] | Tuple [str , ...] | set [str ] | frozenset [str ] | None = ..., ad_value : Any | None = ...
190
+ ) -> Iterator [Process ]: ...
177
191
def wait_procs (
178
192
procs : Iterable [Process ], timeout : float | None = ..., callback : Callable [[Process ], Any ] | None = ...
179
193
) -> tuple [list [Process ], list [Process ]]: ...
0 commit comments