@@ -103,10 +103,32 @@ PAX_NAME_FIELDS: set[str]
103103
104104ENCODING : str
105105
106+ _FileCreationModes : TypeAlias = Literal ["a" , "w" , "x" ]
107+
108+ @overload
106109def open (
107110 name : StrOrBytesPath | None = None ,
108111 mode : str = "r" ,
109- fileobj : IO [bytes ] | None = None , # depends on mode
112+ fileobj : IO [bytes ] | None = None ,
113+ bufsize : int = 10240 ,
114+ * ,
115+ format : int | None = ...,
116+ tarinfo : type [TarInfo ] | None = ...,
117+ dereference : bool | None = ...,
118+ ignore_zeros : bool | None = ...,
119+ encoding : str | None = ...,
120+ errors : str = ...,
121+ pax_headers : Mapping [str , str ] | None = ...,
122+ debug : int | None = ...,
123+ errorlevel : int | None = ...,
124+ compresslevel : int | None = ...,
125+ preset : Literal [0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 ] | None = ...,
126+ ) -> TarFile : ...
127+ @overload
128+ def open (
129+ name : StrOrBytesPath | None = None ,
130+ mode : _FileCreationModes = ...,
131+ fileobj : _Fileobj | None = None ,
110132 bufsize : int = 10240 ,
111133 * ,
112134 format : int | None = ...,
0 commit comments