Commit Graph

5896 Commits

Author SHA1 Message Date
Joren Hammudoglu c8bdfcb49d covariant warnings.catch_warnings type-parameter with default (#13675) 2025-03-20 13:26:43 +01:00
Sebastian Rittau b943f311ac logging.config: Add @type_check_only markers (#13674) 2025-03-19 16:23:24 +01:00
Sebastian Rittau 5a8f8aa052 Update typing_extensions to 4.13.0rc1 (#13671)
Also sort __all__ to match the implementation
2025-03-19 13:56:18 +01:00
Semyon Moroz f7799bb683 Use Generator for heapq.merge (#13663) 2025-03-18 13:05:59 +01:00
Semyon Moroz b733e57571 Deprecate CGIHTTPRequestHandler (#13658) 2025-03-18 11:35:20 +01:00
Sebastian Rittau 52202f42a6 Add TypedDict.__{readonly,mutable}_keys__ (#13646) 2025-03-17 19:30:30 +01:00
Brian Schubert 205e993b52 Fix parameter types for pkgutil functions accepting pathlike arguments (#13642) 2025-03-17 18:02:07 +01:00
Joren Hammudoglu 8064d995e7 Some minor statistics.NormalDist adjustments (#13626)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2025-03-15 19:07:47 +00:00
Joren Hammudoglu 5ba2e4989e Add types.UnionType.__parameters__ (#13628)
annotate the `types.UnionType.__parameters__` property
2025-03-15 17:51:36 +00:00
Joren Hammudoglu 28106bcb73 Annotate pathlib.Path.{owner,group,is_mount} on windows (#13613) 2025-03-11 18:45:40 +01:00
Dan Pascu d04d532337 Fix return type for GenericAlias.__origin__ for type aliases parameterised with a type (#13619) 2025-03-11 17:11:19 +01:00
Max Muoto 2e76963775 Fix asyncio executor types (#13616)
Update type annotations for `run_in_executor` and `set_default_executor` in asyncio event loop interfaces to use more specific executor types from `concurrent.futures`
2025-03-11 11:45:28 +01:00
Avasam 1f2ceccfae distutils: Allow overriding Command and Distribution boolean attributes with actual bool in subclasses (#13615) 2025-03-11 11:18:03 +01:00
Joren Hammudoglu ab46a26de8 Annotate unittest.TestCase.__init_subclass__ (#13602) 2025-03-09 13:47:43 +01:00
Stephen Morton 846d167f51 Fix default of dict.get (#13222) 2025-03-09 13:44:27 +01:00
Stephen Morton 56fa438a27 Decouple types.DynamicClassAttribute from property (#13276) 2025-03-07 19:08:27 +01:00
Kanishk Pachauri 7cb3eef00c Update _socket.pyi to include tuple[int, bytes] address format (#13596) 2025-03-07 19:05:24 +01:00
Sebastian Rittau 90d89f8983 Remove redundant version_info checks (#13588)
`zipfile._path` was split into a separate module in Python 3.12.
Originally, we just copied the definition for `CompleteDirs` and `Path`
from `zipfile.pyi` to `zipfile/_path/__init__.pyi` and left the now
defunct version_info branches. This removes the unnecessary branches
from the respective stub files.
2025-03-06 17:02:48 +01:00
Sebastian Rittau 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 Rittau 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
Avasam 58a4c08ab0 shutil.which cannot return PathLike, and fails with cmd: PathLike on Windows Python < 3.12 (#13580) 2025-03-05 08:54:48 +01:00
Philipp A. 714c99bbdb Fix singledispatch register signature (#13578) 2025-03-04 14:52:07 +01:00
Avasam 6f98c59f93 Enable Ruff PLR (Pylint Refactor) (#13307) 2025-03-03 18:03:34 +01:00
Sebastian Rittau 3e83e42a0f Update pyright to v1.1.395; disable a pow() check (#13564)
pyright and mypy disagree about the exact type due to differing
overloads handling.

---------

Co-authored-by: Avasam <samuel.06@hotmail.com>
2025-03-03 11:49:41 -05:00
cake-monotone 9f11db4296 Improving type support for math.prod (#13572) 2025-03-03 16:41:34 +01:00
Stephen Morton 175e700656 Push items down from socketserver.BaseServer to TCPServer (#13082)
Cf. https://github.com/python/cpython/issues/127209
2025-03-03 16:38:43 +01:00
Avasam 1e71351016 Allow any sliceable sequence as getopt args (#13116) 2025-03-03 15:52:57 +01:00
Avasam cc206f760d Drop flake8-noqa and remove workarounds to work with Ruff (#13571) 2025-03-03 15:48:59 +01:00
Sebastian Rittau 96c3fe712a Remove SupportsGetItem.__contains__ (#13541) 2025-03-03 15:44:26 +01:00
Avasam 6d6e858e63 Enable Ruff PLC (Pylint Convention) (#13306) 2025-03-03 15:39:40 +01:00
Randolf Scholz be17dc0ac4 builtins.slice: more precise __new__ overloads and defaults for StopT and StepT. (#13008) 2025-02-28 13:33:07 +01:00
Sebastian Rittau f1b121cf29 [configparser] Fix missing fallback argument in SectionProxy.get (#13559)
Closes: #13556
2025-02-28 03:33:10 -08:00
Stephen Morton 1bd2a358c9 test suite characterizing dict.get() (#13225) 2025-02-28 12:18:56 +01:00
Colin Watson 8ebf8af91b Weaken return type of Path.{glob,rglob} in 3.13 (#13223)
Since https://github.com/python/cpython/pull/117589 (at least),
`Path.glob` and `Path.rglob` return an `Iterator` rather than a
`Generator`.
2025-02-28 12:15:07 +01:00
Pierre Chapuis b0c6fffe28 Introduce the _HashObject protocol (#13553)
This protocol corresponds to what is called "hash object" in the hashlib documentation. In particular, it includes the non-OpenSSL BLAKE2 implementations which do not inherit HASH.
2025-02-27 15:31:56 +01:00
Stephen Morton 14605d0c21 Complete importlib.readers (#13356) 2025-02-27 14:44:46 +01:00
Stephen Morton 40dc55c4be Major update for the xml module (#13349) 2025-02-27 12:50:09 +01:00
mtnpke 0647903db3 Support configparser.UNNAMED_SECTION (#13542) (#13544) 2025-02-27 12:19:38 +01:00
Avasam 62feb28c29 Enable Ruff SIM (#13309) 2025-02-26 23:19:36 +01:00
Sebastian Rittau 9da1df60be Update an itertool recipe from Python docs (#13543) 2025-02-26 14:04:04 +01:00
Victor Westerhuis bef43fc46e Relax functools.update_wrapper's parameter types (#13491) 2025-02-26 12:59:39 +01:00
Brian Schubert c27e41c33b Make various email.Policy use sites generic over the message type (#13274) 2025-02-23 20:28:43 +01:00
Sam Bull fd4fc6091d Return BufferedIncrementalReader for some encodings (#13523) 2025-02-22 21:25:01 +01:00
Richard Si 4050dd42ef Update importlib cache,source return types to StrPath (#13509)
This has been true since Python 3.6.
2025-02-17 16:05:15 -08:00
Richard Si 654d8c2457 Update compileall.compile_{dir, file, path} to return bool (#13504) 2025-02-15 15:33:01 -08:00
Michael H cc8ca939c0 Fix type for run_coroutine_threadsafe (#13498) 2025-02-14 13:23:11 +00:00
Alyssa Coghlan 3f41b30535 Revert "Improve [Async]ContextDecorator type hinting (#13416)" (#13436)
This reverts commit 57d7c4334b.

The attempted fix loses all type overload information during type
inferencing, so postpone fixing the issue until we have a solution
which doesn't impose such a dramatic loss in functionality.

Reopens #13403
2025-02-13 20:49:51 -08:00
David Peter 15f98a8ab8 chr: Accept SupportsIndex argument (#13494)
The `chr` function does accept objects that implement the
`SupportsIndex` protocol. The [implementation] of the builtin method
calls `PyLong_AsLongAndOverflow` on the argument, which in turn calls
`__index__()`, if present. The parameter of the `chr` function can
therefore be annotated with `int | SupportsIndex`.

It seems to me like `SupportsIndex` alone would be enough, since `int`
implements `SupportIndex`, but I chose `int | SupportIndex` to make it
consistent with the annotations on `hex`, `oct` and `bin`.

[implementation]: https://github.com/python/cpython/blob/b05fa90b21dd01bb836285cdd41920320b09e681/Python/bltinmodule.c#L725
[PyLong_AsLongAndOverflow]: https://docs.python.org/3.13/c-api/long.html#c.PyLong_AsLongAndOverflow
2025-02-12 07:50:42 +00:00
Avasam 24c78b9e0d http.server.SimpleHTTPRequestHandler's directory param can be PathLike (#13477) 2025-02-09 21:42:41 +00:00
M Bussonnier 8bd178e0c6 Fix: incorrect type for Bdb.format_stack_entry (#13485)
```python
    def format_stack_entry(self, frame_lineno, lprefix=': '):
         ...
        frame, lineno = frame_lineno
```

The type of `frame_lineno` is `tuple[FrameType, int]` not `int`,
understandably, since the type of `frame_lineno` can be interprted as
the line number of the frame. But looking at the implementation of
`Bdb.format_stack_entry`, it is clear that `frame_lineno` is a tuple.

It is also necessary to somehow pass a frame to `format_stack_entry` if
we want it to be formatted...
2025-02-09 21:32:56 +00:00