ional[TextIO] = ...,
            line: Optional[str] = ...,
            source: Optional[Any] = ...,
        ) -> None: ...
    else:
        def __init__(
            self,
            message: Union[Warning, str],
            category: Type[Warning],
            filename: str,
            lineno: int,
            file: Optional[TextIO] = ...,
            line: Optional[str] = ...,
        ) -> None: ...

class catch_warnings:
    @overload
    def __new__(cls, *, record: Literal[False] = ..., module: Optional[ModuleType] = ...) -> _catch_warnings_without_records: ...
    @overload
    def __new__(cls, *, record: Literal[True], module: Optional[ModuleType] = ...) -> _catch_warnings_with_records: ...
    @overload
    def __new__(cls, *, record: bool, module: Optional[ModuleType] = ...) -> catch_warnings: ...
    def __enter__(self) -> Optional[List[WarningMessage]]: ...
    def __exit__(
        self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]
    ) -> None: ...

class _catch_warnings_without_records(catch_warnings):
    def __enter__(self) -> None: ...

class _catch_warnings_with_records(catch_warnings):
    def __enter__(self) -> List[WarningMessage]: ...
PK