Commit Graph

47 Commits

Author SHA1 Message Date
Colin Watson
7d9f5acebe Allow float for TarInfo.replace(mtime) (#13199) 2024-12-05 14:59:00 +01:00
Konstantin Baikov
fcf30cfd40 Fix todo in tarfile for modes with pipe char (#13130) 2024-12-03 13:48:47 +01:00
Colin Watson
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 Rittau
975760281c tarfile.open(): Handle all modes (#12181) 2024-10-02 20:35:56 -07:00
Alyssa Coghlan
bed832da8a Allow float for TarInfo.mtime (#12521) 2024-08-13 10:57:21 +02:00
Kanishk Pachauri
de22c30fa8 tarfile: fix preset type for tarfile.open (#12193) 2024-06-23 16:08:31 -07:00
Max Muoto
72a85f4c99 Add missing tarfile.open overload for writable objects (#12117) 2024-06-21 11:20:10 +02:00
Amin Alaee
b45456739a platform, tarfile, io: Python 3.13 updates (#12056) 2024-05-29 14:37:26 +02:00
Shantanu
470a13ab09 Use PEP 570 syntax in stdlib (#11250) 2024-03-09 14:50:16 -08:00
Jelle Zijlstra
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
Jelle Zijlstra
bba8cbd6f8 stdlib: more deprecations (#11009)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-02-18 06:50:29 -08:00
Karim Baidar
cfb16543b8 Implement Preset Argument in tarfile.open Function and Add Test Coverage (#11251) 2024-01-15 16:39:31 +01:00
Sebastian Rittau
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 Rittau
23604858a6 Remove Python 3.7 branches (#11238) 2024-01-05 11:39:39 +01:00
Jelle Zijlstra
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 Waygood
9ed39d8796 Use typing_extensions.Self in the stdlib (#9694) 2023-02-09 09:12:13 +00:00
Alex Waygood
a6919227be Add several version-dependent default values to parameters in the stdlib (#9631) 2023-01-31 01:21:39 +00:00
Alex Waygood
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 Zijlstra
ddfaca3200 stdlib: add argument default values (#9501) 2023-01-18 09:37:34 +01:00
Nikita Sobolev
e68567a1b4 tarfile: improve bytes handling (#9076) 2022-11-03 10:15:46 -07:00
Nikita Sobolev
4905074919 tarfile.TarFile: mark OPEN_METH as a ClassVar (#8725) 2022-09-11 14:32:52 +01:00
Alex Waygood
edc0ecd857 Remove Python 3.6 branches from typeshed (#8269) 2022-07-11 10:55:17 +02:00
Adam Simpkins
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 Waygood
b093c90a94 Use TypeAlias for type aliases where possible, part II (#7667) 2022-04-20 20:02:47 +01:00
Alex Waygood
f4ae363b56 stdlib: correct many pos-or-kw arg names in dunder methods (#7451) 2022-03-07 16:40:03 +01:00
Alex Waygood
6a743348ca Add __all__ for most modules beginning with 't' (#7373) 2022-02-23 18:25:28 -08:00
Alex Waygood
7ccbbdb30a stdlib: Improve many __iter__ and constructor methods (#7112) 2022-02-02 19:14:57 +01:00
Shantanu
b88a6f19cd Upgrade black version (#7089) 2022-01-30 16:27:06 -08:00
Alex Waygood
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: 79ec7b2826/src/filelock/_api.py (L207)

* Improve `opentracing/scope` annotation

Source code here: 3e1d357a34/opentracing/scope.py (L71)

* Improve `redis/client` stub

Source code here: 15f315a496/redis/client.py (L1217)

* Improve `redis/lock` annotation

Source code here: 15f315a496/redis/lock.py (L155)

* Improve `requests/models` annotation

Source code here: d718e75383/requests/models.py (L653)
2022-01-09 19:16:19 -08:00
Alex Waygood
a40d79a4e6 Use lowercase type everywhere (#6853) 2022-01-08 16:09:29 +01:00
Alex Waygood
8d5d2520ac Use PEP 585 syntax wherever possible (#6717) 2021-12-28 11:31:43 +01:00
Alex Waygood
5c8e68f0eb Use lowercase set, frozenset and deque where possible (#6346) 2021-11-19 15:05:45 -08:00
Akuli
9af9cca7f3 lowercase list and dict in the rest of stdlib (#5892) 2021-08-09 00:13:08 +02:00
Akuli
ee487304d7 Big diff: Use new "|" union syntax (#5872) 2021-08-08 11:05:21 +02:00
Jon Dufresne
b2e429cd41 Add typing for TarFile._extract_member method (#5841)
Refs: #2673
2021-08-03 08:53:35 +02:00
Anton Grübel
8a107464a8 Use _typeshed.Self with __enter__ (#5719) 2021-07-01 23:15:13 +02:00
Dominic Davis-Foster
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 Rittau
f562713939 Use protocols instead of IO for bz2 (#5499) 2021-05-29 09:01:43 -07:00
Sebastian Rittau
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 Rittau
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
Akuli
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 Bull
050cfda7d9 Change tarfile.extractall() to Iterable (#5273) 2021-04-30 14:40:01 -07:00
Ashwin Ramaswami
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 Pathak
3c0f2acdf0 Changed: Name argument type to support None value (#5075)
Closes: #5027
2021-02-27 11:32:31 +01:00
Eric Traut
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 Singh
f52b154fe7 Add missing definitions in tarfile (#5020)
Resolves #4885
2021-02-15 14:19:49 -08:00
Ivan Levkivskyi
16ae4c6120 Re-organize directory structure (#4971)
See discussion in #2491

Co-authored-by: Ivan Levkivskyi <ilevkivskyi@dropbox.com>
2021-01-27 12:00:39 +00:00