Commit Graph

44 Commits

Author SHA1 Message Date
Shantanu
470a13ab09 Use PEP 570 syntax in stdlib (#11250) 2024-03-09 14:50:16 -08: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
Alex Waygood
10febc4fe0 stdlib: remove unused type: ignore comments (#11061) 2023-11-23 14:00:07 +01:00
Alex Waygood
a08d4c8d2e Remove many redundant inheritances from Generic[] (#10933) 2023-10-26 20:07:20 +02:00
Nikita Sobolev
2c1db00761 Consistently use Generic as the last base class (#10610) 2023-08-28 10:16:54 +02:00
Sujal Gupta
575dd0c448 Add _file attribute to SpooledTemporaryFile (#10327)
Co-authored-by: Akuli <akuviljanen17@gmail.com>
2023-06-24 17:09:51 +03:00
Sebastian Rittau
5f9d05c7f5 TemporaryFile(): Handle one more case correctly (#10284) 2023-06-14 05:33:01 -07:00
Sebastian Rittau
0fe724dfab Tighten tempfile() return types (#10232) 2023-06-07 21:57:13 -07:00
Alex Waygood
cf25698325 tempfile: more updates for py312 (#10256) 2023-06-04 12:13:12 -07:00
Nikita Sobolev
b25150aa30 py312: Add delete=True parameter to tempfile.TemporaryDirectory (#10244)
Source: https://github.com/python/cpython/blob/3.12/Lib/tempfile.py#L864
2023-06-03 14:30:30 +01:00
Alex Waygood
21d7f7153b [alt] typing: accept buffers in IO.write (#9861)
Co-authored-by: JelleZijlstra <jelle.zijlstra@gmail.com>
2023-03-15 00:42:10 -07:00
Alex Waygood
9ed39d8796 Use typing_extensions.Self in the stdlib (#9694) 2023-02-09 09:12:13 +00:00
Jelle Zijlstra
0fc3a567fc stdlib: add defaults for modules accessible on MacOS (#9659)
Ran stubdefaulter with standard options on a Mac.
2023-02-01 22:46:55 +00:00
Alex Waygood
81463b9995 tempfile.SpooledTemporaryFile: fix overloads (#9627) 2023-01-30 17:04:18 -08: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
Alex Waygood
01d5e28ff7 Fix miscellaneous invalid TypeVar usages (#8074) 2022-06-14 08:48:41 -07:00
Alex Waygood
ceccc655db Introduce _typeshed.GenericPath and _typeshed.AnyStr_co (#7970) 2022-05-27 19:02:00 +01:00
Alex Waygood
c05731c46f tempfile.pyi: readability improvements (#7959)
The name `_DirT` implies that it is a `TypeVar`, but it isn't; it's a generic `TypeAlias` that can be parameterised with a `TypeVar`. Rename it to just `_Dir` instead.

Also, use aliases instead of repeating incredibly long Literal annotations six times.
2022-05-27 08:52:44 +01:00
Alex Waygood
cb7742e12c tempfile: Fix TypeVar usage (#7939)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-05-25 20:06:46 -07:00
Jelle Zijlstra
8f5a83516b tempfile.SpooledTemporaryFile: inherit from IOBase on 3.11 (#7802)
python/cpython#29560

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2022-05-17 18:41:47 -07:00
Alex Waygood
97a74bc1aa Import from collections.abc wherever possible (#7635) 2022-04-18 12:50:37 +02:00
Alex Waygood
740193a8fc Use TypeAlias where possible for type aliases (#7630) 2022-04-15 18:01:00 -07:00
Alex Waygood
3ab250eec8 Use PEP 604 syntax wherever possible (#7493) 2022-03-16 16:01:33 +01:00
Aaron Kau
bf2049ef18 Change TemporaryFileWrapper.__exit__ return type to None (#7470)
For context we found this from quora/pyanalyze#496, which makes pyanalyze stricter about context managers that may swallow exceptions. tempfile._TemporaryFileWrapper.__exit__ returns whatever its underlying file returns (https://github.com/python/cpython/blob/3.6/Lib/tempfile.py#L502), and file objects don't tend to return anything from __exit__.
2022-03-09 19:34:24 -08: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
b0f2bd68b0 Improve tempfile.SpooledTemporaryFile (#7196) 2022-02-13 17:41:54 -08:00
Shantanu
b88a6f19cd Upgrade black version (#7089) 2022-01-30 16:27:06 -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
Shantanu
c0675a797f tempfile: add ignore_cleanup_errors to TemporaryDirectory (#6226) 2021-11-02 20:25:58 -07:00
Akuli
994b69ef8f Use lowercase tuple where possible (#6170) 2021-10-14 17:18:19 -07:00
Akuli
ce11072dbe Big diff: use lower-case list and dict (#5888) 2021-08-08 09:26:35 -07:00
Akuli
ee487304d7 Big diff: Use new "|" union syntax (#5872) 2021-08-08 11:05:21 +02:00
Anton Grübel
39ede0242c add missing type hints for __class_getitem__ (#5869) 2021-08-07 16:12:53 +02:00
Anton Grübel
8a107464a8 Use _typeshed.Self with __enter__ (#5719) 2021-07-01 23:15:13 +02:00
Akuli
55a2a180c6 tempfile._TemporaryFileWrapper enhancements (#5519) 2021-05-25 15:30:08 +02:00
Jade
56ebf92463 Make _TemporaryFileWrapper generic on AnyStr, use it (#5456)
* Make _TemporaryFileWrapper generic on AnyStr, use it

Previously it was not used on NamedTemoraryFile and thus the file
field was missing from the types for the return value of
NamedTemoraryFile.
2021-05-17 19:04:40 +03:00
Eric Traut
f8e70d66e8 Improved overloads for mkstemp and mktemp functions in tempfile.pyi (#5133) 2021-03-23 17:07:46 -07:00
Edgar Handal
45c916e8d2 Type fixes for tempfile.TemporaryDirectory (#5121)
If no arguments are passed to the TemporaryDirectory constructor, then
the class defaults to using str. Overload the __init__ function to
cover this case.
2021-03-22 18:30:22 -07:00
Eric Traut
e4005505b9 Fixed incompatible use of constrained TypeVar in tempfile. (#5043)
The TypeVar `_T` was being used as a type argument for `PathLike`, but `PathLike` requires that its type argument be constrained to `str` or `bytes`, and `_T` didn't provide any such constraint. The easy workaround is to use the TypeVar `AnyStr` instead.

Co-authored-by: Eric Traut <erictr@microsoft.com>
2021-02-20 13:11:36 -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