mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 13:04:46 +08:00
Add missing tarfile.open overload for writable objects (#12117)
This commit is contained in:
@@ -103,10 +103,32 @@ PAX_NAME_FIELDS: set[str]
|
||||
|
||||
ENCODING: str
|
||||
|
||||
_FileCreationModes: TypeAlias = Literal["a", "w", "x"]
|
||||
|
||||
@overload
|
||||
def open(
|
||||
name: StrOrBytesPath | None = None,
|
||||
mode: str = "r",
|
||||
fileobj: IO[bytes] | None = None, # depends on mode
|
||||
fileobj: IO[bytes] | None = None,
|
||||
bufsize: int = 10240,
|
||||
*,
|
||||
format: int | None = ...,
|
||||
tarinfo: type[TarInfo] | None = ...,
|
||||
dereference: bool | None = ...,
|
||||
ignore_zeros: bool | None = ...,
|
||||
encoding: str | None = ...,
|
||||
errors: str = ...,
|
||||
pax_headers: Mapping[str, str] | None = ...,
|
||||
debug: int | None = ...,
|
||||
errorlevel: int | None = ...,
|
||||
compresslevel: int | None = ...,
|
||||
preset: Literal[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] | None = ...,
|
||||
) -> TarFile: ...
|
||||
@overload
|
||||
def open(
|
||||
name: StrOrBytesPath | None = None,
|
||||
mode: _FileCreationModes = ...,
|
||||
fileobj: _Fileobj | None = None,
|
||||
bufsize: int = 10240,
|
||||
*,
|
||||
format: int | None = ...,
|
||||
|
||||
Reference in New Issue
Block a user