Commit Graph
51 Commits
Author SHA1 Message Date
Sebastian RittauandGitHub 30b16c168d Drop Python 3.8 branches (#13776) 2025-04-03 10:35:36 +02:00
Sebastian RittauandGitHub 5f1fd23bd2 Rework tarfile.open/TarFile.open (#13177)
* Copy overloads of `open()` to `TarFile.open()`.
* Replace remaining instances of `IO` with `_Fileobj`.
* Replace `open()` with alias to `TarFile.open()` to match implementation.
2025-03-06 13:54:35 +01:00
Sebastian RittauandGitHub ba85e0c282 Fix tarfile.open overloads (#13441)
* Allow `compresslevel` argument for modes `w|gz` and `w|bz2`.
* Remove `preset` argument from modes where it's not allowed.

Closes: #13440
2025-03-06 10:39:56 +01:00
Anthony SottileandGitHub 101287091c add "w:tar" as a mode for tarfile (#13401) 2025-01-14 17:26:25 +01:00
Colin WatsonandGitHub 7d9f5acebe Allow float for TarInfo.replace(mtime) (#13199) 2024-12-05 14:59:00 +01:00
Konstantin BaikovandGitHub fcf30cfd40 Fix todo in tarfile for modes with pipe char (#13130) 2024-12-03 13:48:47 +01:00
Colin WatsonandGitHub 1ae7e615c0 Loosen type of fileobj argument to TarFile.addfile (#12961)
It only seems to need something it can read bytes from, rather than a
full-fledged `IO[bytes]`.
2024-11-06 06:10:25 -08:00
Sebastian RittauandGitHub 975760281c tarfile.open(): Handle all modes (#12181) 2024-10-02 20:35:56 -07:00
Alyssa CoghlanandGitHub bed832da8a Allow float for TarInfo.mtime (#12521) 2024-08-13 10:57:21 +02:00
Kanishk PachauriandGitHub de22c30fa8 tarfile: fix preset type for tarfile.open (#12193) 2024-06-23 16:08:31 -07:00
Max MuotoandGitHub 72a85f4c99 Add missing tarfile.open overload for writable objects (#12117) 2024-06-21 11:20:10 +02:00
Amin AlaeeandGitHub b45456739a platform, tarfile, io: Python 3.13 updates (#12056) 2024-05-29 14:37:26 +02:00
ShantanuandGitHub 470a13ab09 Use PEP 570 syntax in stdlib (#11250) 2024-03-09 14:50:16 -08:00
Jelle ZijlstraandGitHub c62fedc190 tarfile: Remove @deprecated (#11476)
Fixes #11472.

As noted in the issue, it is possible to set the filter on the class, but that will still cause type checkers to show deprecation warnings. Therefore, we unfortunately cannot enforce this deprecation in the type system.
2024-02-27 06:34:26 -08:00
bba8cbd6f8 stdlib: more deprecations (#11009)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-02-18 06:50:29 -08:00
Karim BaidarandGitHub cfb16543b8 Implement Preset Argument in tarfile.open Function and Add Test Coverage (#11251) 2024-01-15 16:39:31 +01:00
53a8193d64 Update typing_extensions imports in stdlib (#11244)
Co-authored-by: AlexWaygood <alex.waygood@gmail.com>
2024-01-05 08:15:19 -08:00
Sebastian RittauandGitHub 23604858a6 Remove Python 3.7 branches (#11238) 2024-01-05 11:39:39 +01:00
5beddbe883 Add PEP 706 filters to tarfile (#10316)
Fixes #10315

Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
2023-06-14 15:08:32 +01:00
Alex WaygoodandGitHub 9ed39d8796 Use typing_extensions.Self in the stdlib (#9694) 2023-02-09 09:12:13 +00:00
Alex WaygoodandGitHub a6919227be Add several version-dependent default values to parameters in the stdlib (#9631) 2023-01-31 01:21:39 +00:00
Alex WaygoodandGitHub 33a62ae42d Add more defaults to the stdlib (#9606)
Continuing work towards #8988.

The first five commits were created using stubdefaulter on various Python versions; the following commits were all created manually by me to fix various problems. The main things this adds that weren't present in #9501 are:

- Defaults in Windows-only modules and Windows-only branches (because I'm running a Windows machine)
- Defaults in non-py311 branches
- Defaults for float parameters
- Defaults for overloads
2023-01-29 01:51:23 +00:00
Jelle ZijlstraandGitHub ddfaca3200 stdlib: add argument default values (#9501) 2023-01-18 09:37:34 +01:00
Nikita SobolevandGitHub e68567a1b4 tarfile: improve bytes handling (#9076) 2022-11-03 10:15:46 -07:00
Nikita SobolevandGitHub 4905074919 tarfile.TarFile: mark OPEN_METH as a ClassVar (#8725) 2022-09-11 14:32:52 +01:00
Alex WaygoodandGitHub edc0ecd857 Remove Python 3.6 branches from typeshed (#8269) 2022-07-11 10:55:17 +02:00
Adam SimpkinsandGitHub 40d6592ba1 tarfile.gettarinfo() accepts PathLike objects (#7832)
This method has accepted PathLike objects since Python 3.6
(https://github.com/python/cpython/pull/512)
2022-05-11 22:02:04 -07:00
Alex WaygoodandGitHub b093c90a94 Use TypeAlias for type aliases where possible, part II (#7667) 2022-04-20 20:02:47 +01:00
Alex WaygoodandGitHub f4ae363b56 stdlib: correct many pos-or-kw arg names in dunder methods (#7451) 2022-03-07 16:40:03 +01:00
Alex WaygoodandGitHub 6a743348ca Add __all__ for most modules beginning with 't' (#7373) 2022-02-23 18:25:28 -08:00
Alex WaygoodandGitHub 7ccbbdb30a stdlib: Improve many __iter__ and constructor methods (#7112) 2022-02-02 19:14:57 +01:00
ShantanuandGitHub b88a6f19cd Upgrade black version (#7089) 2022-01-30 16:27:06 -08:00
Alex WaygoodandGitHub 96c9abb058 Always use _typeshed.Self, where applicable (#6880)
* Always use `_typeshed.Self`, where applicable

* Revert changes to `google-cloud-ndb` (ambiguous)

* Remove empty line added by script

* Revert changes to `stubs/python-dateutil/dateutil/relativedelta.pyi`

* Manually add a few more that the script missed

* Improve `filelock` annotation

Source code here: https://github.com/tox-dev/py-filelock/blob/79ec7b2826e33b982fe83b057f359448b9d966ba/src/filelock/_api.py#L207

* Improve `opentracing/scope` annotation

Source code here: https://github.com/opentracing/opentracing-python/blob/3e1d357a348269ef54d67f761302fab93dbfc0f7/opentracing/scope.py#L71

* Improve `redis/client` stub

Source code here: https://github.com/redis/redis-py/blob/15f315a496c3267c8cbcc6d6d9c6005ea4d4a4d5/redis/client.py#L1217

* Improve `redis/lock` annotation

Source code here: https://github.com/redis/redis-py/blob/15f315a496c3267c8cbcc6d6d9c6005ea4d4a4d5/redis/lock.py#L155

* Improve `requests/models` annotation

Source code here: https://github.com/psf/requests/blob/d718e753834b84018014a23d663369ac27d1ab9c/requests/models.py#L653
2022-01-09 19:16:19 -08:00
Alex WaygoodandGitHub a40d79a4e6 Use lowercase type everywhere (#6853) 2022-01-08 16:09:29 +01:00
Alex WaygoodandGitHub 8d5d2520ac Use PEP 585 syntax wherever possible (#6717) 2021-12-28 11:31:43 +01:00
Alex WaygoodandGitHub 5c8e68f0eb Use lowercase set, frozenset and deque where possible (#6346) 2021-11-19 15:05:45 -08:00
AkuliandGitHub 9af9cca7f3 lowercase list and dict in the rest of stdlib (#5892) 2021-08-09 00:13:08 +02:00
AkuliandGitHub ee487304d7 Big diff: Use new "|" union syntax (#5872) 2021-08-08 11:05:21 +02:00
Jon DufresneandGitHub b2e429cd41 Add typing for TarFile._extract_member method (#5841)
Refs: #2673
2021-08-03 08:53:35 +02:00
Anton GrübelandGitHub 8a107464a8 Use _typeshed.Self with __enter__ (#5719) 2021-07-01 23:15:13 +02:00
Dominic Davis-FosterandGitHub 48a346920b Use a TypeVar for the return types of TarFile classmethods. (#5602)
* Use a TypeVar for the return types of TarFile classmethods.

* Add TypeVar annotation to TarFile.__enter__
2021-06-12 10:54:34 +03:00
Sebastian RittauandGitHub f562713939 Use protocols instead of IO for bz2 (#5499) 2021-05-29 09:01:43 -07:00
Sebastian RittauandGitHub 1ea3d0f003 tarfile improvements (#5492)
* Remove explicit Iterable super class
* Use Literals for mode parameters
* Import from collections.abc
* Use protocols for TarFile(fileobj=) and Tarfile.gzopen()
* Use object instead of Any as protocol return types
2021-05-19 10:13:35 +02:00
Sebastian RittauandGitHub f0bf6eebbd AnyStr cleanup (#5487)
* Replace all uses of StrPath, BytesPath, and AnyPath in Python 2 stubs.
* Add StrOrBytesPath as preferred alias for AnyPath.
* Replace all remaining AnyPath instances with StrOrBytesPath.
* Mark AnyPath as obsolete.

Part of #5470
2021-05-17 20:45:48 +02:00
17dcea4a68 Akuli and srittau: Remove Python 2 branches from Python 3 stubs (#5461)
* run script and do some manual changes (Akuli)

* do the whole thing manually (srittau)

* merge changes (Akuli)

Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
2021-05-15 15:33:39 +03:00
Sam BullandGitHub 050cfda7d9 Change tarfile.extractall() to Iterable (#5273) 2021-04-30 14:40:01 -07:00
Ashwin RamaswamiandGitHub 54f85c5b27 Add TarFile.offset (#5210)
Add TarFile.offset, which is an undocumented property. Fixes https://github.com/python/typeshed/issues/5209
2021-04-11 20:21:01 -07:00
Vyom PathakandGitHub 3c0f2acdf0 Changed: Name argument type to support None value (#5075)
Closes: #5027
2021-02-27 11:32:31 +01:00
a1f16da64e Added some missing parameter annotations and type arguments detected by pyright. (#5061)
Co-authored-by: Eric Traut <erictr@microsoft.com>
2021-02-23 19:46:53 +01:00
Ankur SinghandGitHub f52b154fe7 Add missing definitions in tarfile (#5020)
Resolves #4885
2021-02-15 14:19:49 -08:00