@@ -56,12 +56,20 @@ class WarningMessage:
56
56
) -> None : ...
57
57
58
58
class catch_warnings :
59
- @overload
60
- def __new__ (cls , * , record : Literal [False ] = ..., module : ModuleType | None = ...) -> _catch_warnings_without_records : ...
61
- @overload
62
- def __new__ (cls , * , record : Literal [True ], module : ModuleType | None = ...) -> _catch_warnings_with_records : ...
63
- @overload
64
- def __new__ (cls , * , record : bool , module : ModuleType | None = ...) -> catch_warnings : ...
59
+ if sys .version_info >= (3 , 11 ):
60
+ @overload
61
+ def __new__ (cls , * , record : Literal [False ] = ..., module : ModuleType | None = ..., action : _ActionKind | None = ..., category : type [Warning ] = ..., lineno : int = ..., append : bool = ...) -> _catch_warnings_without_records : ...
62
+ @overload
63
+ def __new__ (cls , * , record : Literal [True ], module : ModuleType | None = ..., action : _ActionKind | None = ..., category : type [Warning ] = ..., lineno : int = ..., append : bool = ...) -> _catch_warnings_with_records : ...
64
+ @overload
65
+ def __new__ (cls , * , record : bool , module : ModuleType | None = ..., action : _ActionKind | None = ..., category : type [Warning ] = ..., lineno : int = ..., append : bool = ...) -> catch_warnings : ...
66
+ else :
67
+ @overload
68
+ def __new__ (cls , * , record : Literal [False ] = ..., module : ModuleType | None = ...) -> _catch_warnings_without_records : ...
69
+ @overload
70
+ def __new__ (cls , * , record : Literal [True ], module : ModuleType | None = ...) -> _catch_warnings_with_records : ...
71
+ @overload
72
+ def __new__ (cls , * , record : bool , module : ModuleType | None = ...) -> catch_warnings : ...
65
73
def __enter__ (self ) -> list [WarningMessage ] | None : ...
66
74
def __exit__ (
67
75
self , exc_type : type [BaseException ] | None , exc_val : BaseException | None , exc_tb : TracebackType | None
0 commit comments