Commit Graph

5615 Commits

Author SHA1 Message Date
Oleh Prypin b2f68ec2fe Use MaybeNone (alias to Any) when applicable (#12855) 2024-10-18 14:07:52 -07:00
Avasam de4842db26 Replace Any with Incomplete in distutils (#12842) 2024-10-18 17:26:08 +02:00
Stephen Morton 281dd351a2 Remove redundant inheritances from Iterator in itertools (#12816) 2024-10-18 12:24:01 +02:00
Avasam 81138321d9 distutils: Add some return types for setuptools to pass ANN201 (#12841) 2024-10-18 12:09:34 +02:00
Avasam 559ae9730b Restore os.path methods overload workaround (#12837)
Revert "Remove obsolete mypy bug workaround in `abspath()` (#12208)"

This reverts commit 271df8ef04.
2024-10-17 13:51:50 -07:00
Jelle Zijlstra a2ee32ba5d unittest: make protocol parameter positional-only (#12834) 2024-10-17 16:55:50 +02:00
bersbersbers b78b3f10ba slice is hashable starting with Python 3.12 (#12832) 2024-10-17 09:17:38 +02:00
Stephen Morton 56078f574f csv.Dialect doesn't actually subclass _csv.Dialect (#12808)
It does a weird wrapping thing instead:
https://github.com/python/cpython/blob/2a5cdb251674ce8d9a824c102f7cd846d944cfa4/Lib/csv.py#L114
2024-10-16 22:12:47 -07:00
Stephen Morton 2412c7cea6 Remove unneeded Iterable base class from asyncio.Future (#12827) 2024-10-16 22:11:05 -07:00
Jelle Zijlstra 2370b8b9d1 memoryview: re-add inheritance from Sequence, set index and count to None (#12800)
This reverts commit f625e92ae5.
2024-10-16 07:27:56 -07:00
Brian Schubert ab8e0e1ca1 Fix return type of logging.config.BaseConfigurator.as_tuple (#12817) 2024-10-15 19:54:48 +01:00
Stephen Morton aedf65abe9 remove unneeded AsyncIterator base class from asyncio.StreamReader (#12815) 2024-10-15 11:25:40 -07:00
Stephen Morton 816b47c231 remove unneeded Interator base class from sqlite3.Cursor (#12813) 2024-10-15 11:25:21 -07:00
Stephen Morton 1fb6ebf62b Remove redundant inheritances from Iterator (#12814) 2024-10-15 19:17:34 +01:00
Stephen Morton f08d769f7c remove unneeded Iterable base class from CookieJar (#12812) 2024-10-15 19:47:56 +02:00
Stephen Morton a871efd90c remove unecessary Iterable base classes (#12810) 2024-10-15 00:53:35 +01:00
Stephen Morton e7e9c13c1c clean inheritance for OrderedDict related classes (#12809)
Reversible is protocol-like, plus it subclasses dict which is itself
Reversible on all supported python versions now.
2024-10-14 16:05:04 -07:00
Stephen Morton 7b794ef343 remove unneeded fake base classes from mmap.mmap (#12807) 2024-10-14 23:38:35 +01:00
Stephen Morton 16bab543a3 make os._wrap_close not inherit from TextIOWrapper (#12774) 2024-10-14 11:39:30 +02:00
Thomas Grainger cf9aa45d69 fix weakref.KeyedRef and weakref.ref constructor type (#12803) 2024-10-14 10:07:53 +02:00
Brian Schubert a5174d8150 Set literal default for bz2.BZ2Compressor.__init__ (#12798) 2024-10-13 07:54:34 -07:00
Brian Schubert 01036d2a5d Set literal default arguments for pickle.Pickler.__init__ and pickle.Unpickler.__init__ (#12797) 2024-10-13 16:28:16 +02:00
Brian Schubert 88a0f58c67 Reuse hashlib._Hash in hmac (#12793) 2024-10-13 14:50:11 +02:00
Max Muoto 5fcd375815 Set default for enumerate's start argument (#12796) 2024-10-13 06:01:00 +02:00
Avasam 352cfc9773 Add missing 3.13 source kw-only param to code.InteractiveInterpreter.showsyntaxerror (#12792) 2024-10-12 21:10:00 +01:00
Brian Schubert 28f0d6899b Add slice overload to traceback.FrameSummary.__getitem__ (#12783) 2024-10-11 23:42:49 +01:00
Trim21 f625e92ae5 memoryview: remove inheritance from Sequence (#12781)
It doesn't have `index`, `count` or `__reversed__` methods
2024-10-11 17:47:51 +01:00
Stephen Morton 03fe755ec1 move _operator classes to operator (#12745) 2024-10-11 14:16:47 +02:00
Sebastian Rittau 17d2e5a862 Clean up common stubtest allowlist (#12770)
* Move all platform and installation differences into a separate
  section.
* Split sections for missing items into "should be fixed" and "should
  not be fixed".
* Add "TODO" markers to appropriate sections.
2024-10-10 07:53:26 -07:00
Sebastian Rittau c490871c32 Add 'nis' to stubtest allowlist (#12769) 2024-10-10 16:36:07 +02:00
Jun Komoda 1939ed1dc1 ctypes.POINTER(None) returns ctypes.c_void_p (#12754) 2024-10-10 12:29:37 +02:00
Stephen Morton f83b6fadbe add _asyncio (#12766)
improves naming and inheritance for asyncio.Future and asyncio.Task

related to https://github.com/python/typeshed/issues/3968
2024-10-09 20:55:28 -07:00
Stephen Morton 42ebc89d8c remove redundant methods from _io classes (#12761) 2024-10-09 20:32:54 -07:00
Stephen Morton 4b6869d572 remove SupportsInt from bases of ipaddress._BaseAddress (#12765)
added in 2017: https://github.com/python/typeshed/pull/1361

This use case no longer requires the protocol to be an actual base
class.
2024-10-09 20:32:06 -07:00
Stephen Morton f42ebdfa61 make shlex.shlex Iterator (#12756) 2024-10-08 21:48:44 -07:00
Stephen Morton 2b1c7d55b9 re-sort io classes into _io (#12755)
This version keeps it simple and clean: No changes to class bodies.
The only changes here are moving between files and updating the
naming and inheritance.

Related to #3968 and split from #12740.
2024-10-08 21:32:10 -07:00
Stephen Morton 3e29e05e4a Experiment: remove IntFlag from enum.auto (#12760)
comments in https://github.com/python/typeshed/issues/10384 suggest
that type checkers should special case enum.auto rather than
relying on the IntFlag hack. It's been a while since then, do we
still need it?
2024-10-08 21:24:31 -07:00
Avasam 1f4031cc96 Add __code__ to types.MethodType (#12749) 2024-10-08 10:30:49 +02:00
Stephen Morton dbd0d35217 add contextlib._BaseExitStack (#12750)
Improves the MRO of ExitStack and AsyncExitStack

related to https://github.com/python/typeshed/issues/3968
2024-10-06 19:08:27 -07:00
Stephen Morton f318894924 update _CursesWindow to the runtime name "window" (#12744)
Prior to 3.8 the underlying C class was not given a name in
python, so typeshed added _CursesWindow to use it as a type.
Now that it has a name in python, typeshed should use that name.

We can keep _CursesWindow as an alias, for anyone using that
already.
2024-10-06 19:04:55 -07:00
Stephen Morton dbc71c9951 re-sort decimal classes (#12743)
They call themselves "decimal.*" at runtime, so move them into
decimal.pyi so typshed's name matches.

related to #3968
2024-10-06 13:19:22 -07:00
Stephen Morton 1a0b507ae7 add unittest.mock.Base to MagicMixin and MagicProxy (#12747)
This matches the runtime.
2024-10-06 13:17:42 -07:00
Tomas R. 04f3f77ee5 Remove outdated comment regarding tokenize.generate_tokens (#12748) 2024-10-06 14:54:33 +01:00
Stephen Morton f30d367c7a move socket.error classes from _socket to socket (#12746)
They're implemented in C, but consider themselves to live in
socket.
2024-10-05 18:19:34 -07:00
Stephen Morton 77510ae6a4 resort _ast and ast modules (#11162)
The classes imported from the _ast module are defined in C,
but set their __module__ to ast. This arrangement ensures that
the type stubs have the same.

related to https://github.com/python/typeshed/issues/3968
and the discussion in https://github.com/python/typeshed/issues/11141
2024-10-04 17:33:45 -07:00
Stephen Morton 39650b43b5 add _sqlite3 module (#11174)
This aligns with the implementation while giving greater fidelity
to runtime naming and inheritance

Related to https://github.com/python/typeshed/issues/3968 and https://github.com/python/typeshed/issues/11141
2024-10-04 17:28:26 -07:00
Philipp Hahn 277202cf7e Xmlrpc: accept data:str|bytes and require method:str (#12734)
Declared <https://github.com/python/cpython/blob/main/Lib/xmlrpc/server.py#L622>

Inside
[`do_POST()`](https://github.com/python/cpython/blob/main/Lib/xmlrpc/server.py#L493)
`data: bytes`, where `decode_request_content()` only handles `gzip`
compression.
The `result` is then written to `self.wfile`, which uses `bytes`.

But for
[CGI](https://github.com/python/cpython/blob/main/Lib/xmlrpc/server.py#L636)
`str` is used: [`handle_xmlrpc(self,
request_text)`](https://github.com/python/cpython/blob/main/Lib/xmlrpc/server.py#L642)
calls the argument `request_text`, which is read from `sys.stdin` as
type `str` and then passed to `_marshaled_dispatch()`, which internally calls
[`xmlrpc.client.loads()`](https://github.com/python/cpython/blob/main/Lib/xmlrpc/server.py#L257)
to parse the XML using Expat, which accepts both `str` and `bytes`; the
later defaults to encoding `utf-8`, but other encodings can be
used when explicitly specified:

>>> xmlrpc.client.loads('<params><param><value><string>ä</string></value></param></params>')
(('ä',), None)
>>> xmlrpc.client.loads('<params><param><value><string>ä</string></value></param></params>'.encode("utf-8"))
(('ä',), None)
>>> xmlrpc.client.loads('<params><param><value><string>ä</string></value></param></params>'.encode("iso-8859-1"))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.11/xmlrpc/client.py", line 1029, in loads
    p.feed(data)
  File "/usr/lib/python3.11/xmlrpc/client.py", line 451, in feed
    self._parser.Parse(data, False)
xml.parsers.expat.ExpatError: not well-formed (invalid token): line 3, column 15
>>> xmlrpc.client.loads('<?xml version="1.0" encoding="utf-8"?><params><param><value><string>ä</string></value></param></params>'.encode("iso-8859-1"))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.11/xmlrpc/client.py", line 1029, in loads
    p.feed(data)
  File "/usr/lib/python3.11/xmlrpc/client.py", line 451, in feed
    self._parser.Parse(data, False)
xml.parsers.expat.ExpatError: not well-formed (invalid token): line 1, column 68
>>> xmlrpc.client.loads('<?xml version="1.0" encoding="iso-8859-1"?><params><param><value><string>ä</string></value></param></params>'.encode("iso-8859-1"))
(('ä',), None)

Signed-off-by: Philipp Hahn <hahn@univention.de>
Reviewed-By: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-10-04 07:12:02 -07:00
sobolevn d16fe74e1f Fix _csv.Dialect.__init__ (#12320) 2024-10-03 11:33:56 +02:00
Sebastian Rittau 975760281c tarfile.open(): Handle all modes (#12181) 2024-10-02 20:35:56 -07:00
Alex Waygood 45f96fe343 Move multiprocessing test-case file to the right place (#12727) 2024-10-02 16:36:24 +01:00