@@ -2,10 +2,11 @@ import sys
22import threading
33from _typeshed import StrPath , SupportsWrite
44from collections .abc import Callable , Iterable , Mapping , MutableMapping , Sequence
5+ from io import TextIOWrapper
56from string import Template
67from time import struct_time
78from types import FrameType , TracebackType
8- from typing import IO , Any , ClassVar , Optional , Pattern , Tuple , Type , Union
9+ from typing import Any , ClassVar , Optional , Pattern , Tuple , Type , Union
910
1011_SysExcInfoType = Union [Tuple [Type [BaseException ], BaseException , Optional [TracebackType ]], Tuple [None , None , None ]]
1112_ExcInfoType = Union [None , bool , _SysExcInfoType , BaseException ]
@@ -754,28 +755,26 @@ lastResort: Optional[StreamHandler]
754755class StreamHandler (Handler ):
755756 stream : SupportsWrite [str ] # undocumented
756757 terminator : str
757- def __init__ (self , stream : Optional [ SupportsWrite [str ]] = ...) -> None : ...
758+ def __init__ (self , stream : SupportsWrite [str ] | None = ...) -> None : ...
758759 if sys .version_info >= (3 , 7 ):
759- def setStream (self , stream : SupportsWrite [str ]) -> Optional [ SupportsWrite [str ]] : ...
760+ def setStream (self , stream : SupportsWrite [str ]) -> SupportsWrite [str ] | None : ...
760761
761762class FileHandler (StreamHandler ):
763+ stream : TextIOWrapper # undocumented
762764 baseFilename : str # undocumented
763765 mode : str # undocumented
764- encoding : Optional [ str ] # undocumented
766+ encoding : str | None # undocumented
765767 delay : bool # undocumented
766768 if sys .version_info >= (3 , 9 ):
767- errors : Optional [ str ] # undocumented
769+ errors : str | None # undocumented
768770 def __init__ (
769- self ,
770- filename : StrPath ,
771- mode : str = ...,
772- encoding : Optional [str ] = ...,
773- delay : bool = ...,
774- errors : Optional [str ] = ...,
771+ self , filename : StrPath , mode : str = ..., encoding : str | None = ..., delay : bool = ..., errors : str | None = ...
775772 ) -> None : ...
776773 else :
777- def __init__ (self , filename : StrPath , mode : str = ..., encoding : Optional [str ] = ..., delay : bool = ...) -> None : ...
778- def _open (self ) -> IO [Any ]: ...
774+ def __init__ (self , filename : StrPath , mode : str = ..., encoding : str | None = ..., delay : bool = ...) -> None : ...
775+ def _open (self ) -> TextIOWrapper : ...
776+ if sys .version_info >= (3 , 7 ):
777+ def setStream (self , stream : TextIOWrapper ) -> TextIOWrapper | None : ... # type: ignore
779778
780779class NullHandler (Handler ): ...
781780
0 commit comments