11from _typeshed import StrOrBytesPath , structseq
22from collections .abc import Callable , Sequence
3- from typing import Final , Self , TypeAlias , final
3+ from typing import Final , TypeAlias , final
4+ from typing_extensions import Self , disjoint_base
45
56_Location : TypeAlias = int | LocationInfo | None
67_Frame : TypeAlias = tuple [str , _Location , str , int | None ] | FrameInfo
@@ -17,6 +18,7 @@ THREAD_STATUS_UNKNOWN: Final[int]
1718
1819@final
1920class LocationInfo (structseq [int ], tuple [int , int , int , int ]):
21+ __match_args__ : Final = ("lineno" , "end_lineno" , "col_offset" , "end_col_offset" )
2022 @property
2123 def lineno (self ) -> int : ...
2224 @property
@@ -28,6 +30,7 @@ class LocationInfo(structseq[int], tuple[int, int, int, int]):
2830
2931@final
3032class FrameInfo (structseq [object ], tuple [str , _Location , str , int | None ]):
33+ __match_args__ : Final = ("filename" , "location" , "funcname" , "opcode" )
3134 @property
3235 def filename (self ) -> str : ...
3336 @property
@@ -39,13 +42,15 @@ class FrameInfo(structseq[object], tuple[str, _Location, str, int | None]):
3942
4043@final
4144class CoroInfo (structseq [object ], tuple [list [_Frame ], int | str ]):
45+ __match_args__ : Final = ("call_stack" , "task_name" )
4246 @property
4347 def call_stack (self ) -> list [_Frame ]: ...
4448 @property
4549 def task_name (self ) -> int | str : ...
4650
4751@final
4852class TaskInfo (structseq [object ], tuple [int , str , list [CoroInfo ], list [CoroInfo ]]):
53+ __match_args__ : Final = ("task_id" , "task_name" , "coroutine_stack" , "awaited_by" )
4954 @property
5055 def task_id (self ) -> int : ...
5156 @property
@@ -57,6 +62,7 @@ class TaskInfo(structseq[object], tuple[int, str, list[CoroInfo], list[CoroInfo]
5762
5863@final
5964class ThreadInfo (structseq [object ], tuple [int , int , list [_Frame ]]):
65+ __match_args__ : Final = ("thread_id" , "status" , "frame_info" )
6066 @property
6167 def thread_id (self ) -> int : ...
6268 @property
@@ -66,20 +72,34 @@ class ThreadInfo(structseq[object], tuple[int, int, list[_Frame]]):
6672
6773@final
6874class InterpreterInfo (structseq [object ], tuple [int , list [ThreadInfo ]]):
75+ __match_args__ : Final = ("interpreter_id" , "threads" )
6976 @property
7077 def interpreter_id (self ) -> int : ...
7178 @property
7279 def threads (self ) -> list [ThreadInfo ]: ...
7380
7481@final
7582class AwaitedInfo (structseq [object ], tuple [int , list [TaskInfo ]]):
83+ __match_args__ : Final = ("thread_id" , "awaited_by" )
7684 @property
7785 def thread_id (self ) -> int : ...
7886 @property
7987 def awaited_by (self ) -> list [TaskInfo ]: ...
8088
8189@final
8290class GCStatsInfo (structseq [object ], tuple [int , int , int , int , int , int , int , int , int , float ]):
91+ __match_args__ : Final = (
92+ "gen" ,
93+ "iid" ,
94+ "ts_start" ,
95+ "ts_stop" ,
96+ "collections" ,
97+ "collected" ,
98+ "uncollectable" ,
99+ "candidates" ,
100+ "heap_size" ,
101+ "duration" ,
102+ )
83103 @property
84104 def gen (self ) -> int : ...
85105 @property
@@ -101,6 +121,8 @@ class GCStatsInfo(structseq[object], tuple[int, int, int, int, int, int, int, in
101121 @property
102122 def duration (self ) -> float : ...
103123
124+ @final
125+ @disjoint_base
104126class RemoteUnwinder :
105127 def __init__ (
106128 self ,
@@ -121,10 +143,14 @@ class RemoteUnwinder:
121143 def pause_threads (self ) -> bool : ...
122144 def resume_threads (self ) -> bool : ...
123145
146+ @final
147+ @disjoint_base
124148class GCMonitor :
125149 def __init__ (self , pid : int , * , debug : bool = False ) -> None : ...
126150 def get_gc_stats (self , all_interpreters : bool = False ) -> list [GCStatsInfo ]: ...
127151
152+ @final
153+ @disjoint_base
128154class BinaryWriter :
129155 total_samples : int
130156 def __init__ (
@@ -137,6 +163,8 @@ class BinaryWriter:
137163 def __exit__ (self , exc_type : object = None , exc_val : object = None , exc_tb : object = None ) -> bool : ...
138164 def get_stats (self ) -> _Stats : ...
139165
166+ @final
167+ @disjoint_base
140168class BinaryReader :
141169 sample_count : int
142170 sample_interval_us : int
0 commit comments