Commit Graph

4691 Commits

Author SHA1 Message Date
Bas van Beek 7edad1034e Use a typevar in object.__new__ (#5891) 2021-08-08 20:45:22 +02:00
Hasan Ramezani 8b9d771b67 Add filters to stdlib/warnings.pyi (#5889) 2021-08-08 21:18:47 +03:00
Akuli 24780a3e03 imaplib, nntplib, plistlib, poplib: use lower-case list and dict (#5890) 2021-08-08 18:46:23 +02:00
Akuli ce11072dbe Big diff: use lower-case list and dict (#5888) 2021-08-08 09:26:35 -07:00
Akuli b1d1551bbc tkinter.Canvas: types for addtag_foo() and find_foo() methods (#5886) 2021-08-08 17:14:45 +03:00
Kyle Altendorf 4b77d454bd dataclasses: Allow Any keys for the metadata field (#5823) 2021-08-08 15:50:52 +02:00
Akuli 1409f6e892 change ast files to use new union syntax (#5880) 2021-08-08 15:47:33 +02:00
Akuli c12c93ebe4 use new union syntax in stdlib/types.pyi (#5882) 2021-08-08 15:46:09 +02:00
Akuli 1395318faa use new union syntax in ctypes/__init__.pyi (#5883) 2021-08-08 15:45:28 +02:00
Akuli df6a211855 Use new union syntax in rest of stdlib (#5884) 2021-08-08 15:44:30 +02:00
Akuli ebacd320a3 support passing coordinate tuples to tkinter.Canvas.create_foobar() (#5885) 2021-08-08 15:43:28 +02:00
Matt Vollrath 753cb4caba Override argument type of DatagramProtocol.connection_made() (#5873) 2021-08-08 11:16:26 +02:00
Akuli ef5b4b6820 setattr: Any --> object (#5877) 2021-08-08 11:12:23 +02:00
Akuli ee487304d7 Big diff: Use new "|" union syntax (#5872) 2021-08-08 11:05:21 +02:00
Ron Frederick 309e7bda32 Update builtins.pyi (#5874)
Change getattr/hasattr first argument from Any to object

Fixes #5848
2021-08-07 20:46:03 -07:00
Akuli e3f662b648 switch to lower-case "# undocumented" comments (#5871) 2021-08-07 08:00:41 -07:00
Anton Grübel 39ede0242c add missing type hints for __class_getitem__ (#5869) 2021-08-07 16:12:53 +02:00
Akuli 1cd719ba8d Add types to some untyped tkinter.Canvas methods (#5868)
* coords
* gettags
* itemconfigure, itemconfig
* tag_raise, tag_lower, their aliases
* dtag

Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
2021-08-07 17:01:56 +03:00
Akuli 9301131976 fix tkinter.Canvas tags option (#5866) 2021-08-07 15:53:46 +02:00
Anton Grübel 25e9733389 add missing type hints in trace (#5865)
* Parameter func in Trace.runfunc() became positional only in Python 3.9
* Add is_ignored_filename()
2021-08-07 15:53:26 +02:00
Akuli 36799fd63c tkinter.Canvas: fix dash (#5867) 2021-08-07 15:38:05 +02:00
Henry Schreiner ae51d5264b fix: standalone logger functions do not accept arbitrary keywords (#5862) 2021-08-06 23:58:24 +02:00
Henry Schreiner 4965e95f84 fix: arbitrary keyword arguments are not accepted in logging functions (#5849)
While the implementation uses `**kwargs`, this is just forwarded to `_log()`, which accepts a fixed set of arguments.
2021-08-06 10:59:43 +02:00
Maarten ter Huurne 9bba8a4b83 Correct annotation of headers parameter of HTTP event handlers (#5854)
* Use HTTPMessage for the headers parameter of HTTP event handlers

While the documentation of `BaseHandler.http_error_default()` describes
the `hdrs` (`headers` in most other handlers) as "a mapping object with
the headers of the error", the implementation that is located in
`URLopener._open_generic_http()` will pass `response.msg` instead,
which is of type `http.client.HTTPMessage`.

* Use Message for the headers parameter of HTTPError

When the standard library constructs `HTTPError`, it will
pass an `http.client.HTTPMessage`, which is a subclass of
`email.message.Message`. Picking the superclass for the
annotations gives users the flexibility to for example
the result of the `email.message_from_X()` functions.

The only thing unique to `HTTPMessage` is the undocumented
`getallmatchingheaders()` method, which is only called by
`http.server.CGIHTTPRequestHandler.run_cgi()`. That class
gets its headers from `http.client.parse_headers()` and not
from `HTTPError`, so I think it's safe to use `Message`
as the annotation.
2021-08-06 10:55:49 +02:00
an onion f30d6f6fd0 Add stubs for posix_spawn and posix_spawnp (#5846) 2021-08-05 18:55:26 -07:00
Anton Grübel 34d94d780c add ssl.get_ciphers (#5838) 2021-08-04 15:39:46 -07:00
Sebastian Rittau 840df19501 Switch to Python 3.10.0-rc.1 in CI (#5845)
* Switch to Python 3.10.0-rc.1 in CI

* Add module argument to ForwardRef.__init__()
2021-08-04 07:14:38 -07:00
Jon Dufresne b2e429cd41 Add typing for TarFile._extract_member method (#5841)
Refs: #2673
2021-08-03 08:53:35 +02:00
Bas van Beek 475417fa97 Mark final and unhashable classes in types as such (#5837) 2021-08-02 13:46:14 -07:00
Sebastian Rittau acc576659a Use Python 3.10 beta 4 instead of beta 1 in CI (#5839)
Quote all Python versions to make sure they are interpreted as strings,
not floats.
2021-08-02 07:30:32 -07:00
Oleg Höfling 836690e150 Add attribute types to code.InteractiveInterpreter and code.InteractiveConsole (#5830)
* mark undocumented attributes
* use pep 585 generics, replace optional types with pep 604-style hints
2021-08-02 14:04:42 +02:00
Ran Benita 2d0f3c5211 python2/tempfile: dir argument can be None (#5836) 2021-08-02 11:36:19 +02:00
Oleg Höfling 41630486e3 Add Typeguard back to inspect.isclass() return type (#5829) 2021-08-02 09:19:11 +02:00
Eric Traut ea4be02bab Redefined dataclasses.KW_ONLY (#5826)
Redefined dataclasses.KW_ONLY so it's a type alias rather than a class instance. Class instances are illegal to use within a type annotation.
2021-08-01 08:06:48 -07:00
Jelle Zijlstra e1b9ab3372 Remove redundant import from typing (#5827)
Fixes quora/pyanalyze#221.
2021-07-30 22:55:33 -07:00
Rebecca Chen 8da23e0634 Broaden the signature of subprocess.list2cmdline. (#5824)
Although the parameter is called 'seq', the implementation shows that it
can be anything that can be passed to map(), which takes iterables:
https://github.com/python/cpython/blob/0f42b726c87f72d522893f927b4cb592b8875641/Lib/subprocess.py#L565.
2021-07-30 12:15:27 -07:00
Bas van Beek 95a45eb4ab Improve the annotations of types.MappingProxyType (#5822)
* Annotate three previously missing `MappingProxyType` methods

* `__hash__`
* `__reversed__`
* `__class_getitem__`

* Improve 5 `MappingProxyType` methods

The assumption here is that the underlying mapping is a `dict`,
just is done for `MappingProxyType.copy`

* Make the value type of `types.MappingProxyType` covariant
2021-07-30 17:05:15 +02:00
MapleCCC 089dd43eb7 Update stdblib/shelve.pyi (#5816)
Several things done:

1. Replace all occurrences of `Any` by respective concrete types.
2. Make `Shelf` and its subclassses generic. (Fixes #5815)
3. `shelve.open` should return a general `Shelf` object, not `DbfilenameShelf`. The documentation does not expose such implementation detail.
4. The argument `dict` is annotated with an abstract type `MutableMapping` rather than concrete type `Dict`.
5. Remove unnecessary methods. Some of them are inherited from `MutableMapping`, so no need to repeat them here.
6. Use builtin-in generics instead of importing from `typing`.
2021-07-30 06:50:27 -07:00
Anton Grübel 1e39a5899a refactor enum type hints in ssl (#5806) 2021-07-29 20:41:45 -07:00
Bas van Beek 7c37d6117d Allow reversed to take any object implementing __len__ and __getitem__ (#5820)
`reversed` is currently annotated as accepting either a `Sequence` or objects implementing the `__reversed__` protocol.
This however is too strict as, per its [docs](https://docs.python.org/3/library/functions.html#reversed), it can take any object that implements `__len__` and `__getitem__`.
2021-07-29 07:48:14 -07:00
MapleCCC 65b3a4b09d Add type annotation for multiprocessing.SimpleQueue.close() method (#5814) 2021-07-28 09:43:27 -07:00
Sebastian Rittau 2410c4f751 Add missing items for distutils.command.* (#5773)
This was mostly generated by running stubgen. Existing annotations were
kept, but converted to use PEP 604 and PEP 585.
2021-07-24 14:04:17 -07:00
Anton Grübel 7c5d76aca0 add missing protocol version 5 in pickle (#5801) 2021-07-24 13:42:11 -07:00
Oleg Höfling a6a744a9d0 Add type hint for linecache.cache dict (#5805) 2021-07-24 14:59:33 +02:00
an onion c4faf466b3 Add type stubs for xml.dom.pulldom (#5803)
Co-authored-by: Stephanie Ding <sym@fb.com>
2021-07-24 14:53:03 +02:00
Anton Grübel af9b46a9a1 add missing type hints in http.cookiejar (#5797)
Co-authored-by: Akuli <akuviljanen17@gmail.com>
2021-07-22 16:21:36 +03:00
Anton Grübel 966858fd4c add missing type hints in zipfile (#5795) 2021-07-20 18:23:19 +02:00
Anton Grübel 9f34ccd864 Add missing type hints in http.server (#5785) 2021-07-19 23:31:06 +02:00
Sebastian Rittau 3bb397055c Improve distutils and lib2to3 (#5763)
Add missing elements to distutils.util:

* run_2to3()
* copydir_run_2to3()
* Mixin2to3

Use PEP 604 and PEP 585.

Add lib2to3.refactor.
2021-07-12 20:15:54 +02:00
Bas van Beek 5e23e2c19a Use SupportsIndex where applicable in builtins.pyi (#5739)
* Use `SupportsIndex` where applicable in `builtins.pyi`

* Remove `None` from the `int.__round__` ndigits parameter
2021-07-09 13:08:19 +03:00