Commit Graph

4701 Commits

Author SHA1 Message Date
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
github-actions[bot]
b9adb7a874 Remove unused stubtest allowlist entries (#5875)
Co-authored-by: hauntsaninja <hauntsaninja@users.noreply.github.com>
2021-08-07 21:06:25 -07: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
Sebastian Rittau
b4385fa127 Modernize orjson stub (#5870)
* Use | instead of Union and Optional
* Import Callable from collections.abc, not typing
* Set version in METADATA
* Remove redundant "bytearray" from argument type
* Add obsolete_since metadata field
2021-08-07 08:10: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
Jukka Lehtosalo
bd416902f7 Fix annotation in selenium.webdriver.remove.webdriver (#5859)
Docstring description of the argument includes this text:

"Either a string representing URL of the remote server or
a custom remote_connection.RemoteConnection object."
2021-08-06 17:25:25 +01:00
Sebastian Rittau
6ccf5e7d65 Upgrade pytype (#5858) 2021-08-06 17:27:02 +02:00
Eric Traut
620a7ceeb8 Remove selenium.webdriver.EdgeOptions for now (#5855)
We can add it back when selenium 4 is released.
2021-08-06 07:15:31 -07: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
Jacob Walls
5e0012569d Change stub of Pillow.Image.new() to accept str for color argument (#5851) 2021-08-06 10:56:12 +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
Eric Traut
59624ff09c Updated pyright version to 1.1.160 (#5857)
* Updated pyright version to 1.1.160. Older versions contained a bug that prevented multiple third-party stub packages from having the same top-level module name.

* Disabled "reportUnsupportedDunderAll" diagnostic check for now.

Co-authored-by: Eric Traut <erictr@microsoft.com>
2021-08-06 09:21:57 +02:00
Shantanu
76eeeee4c4 [minor] Clearer formatting for stubtest_third_party output (#5856)
Co-authored-by: hauntsaninja <>
2021-08-05 20:16:46 -07:00
an onion
f30d6f6fd0 Add stubs for posix_spawn and posix_spawnp (#5846) 2021-08-05 18:55:26 -07:00
Sebastian Rittau
74c3d9a093 Modernize freezegun stubs, set version (#5843) 2021-08-04 15:57:12 -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
Stephen Rosen
6a9c7aff99 Add missing exceptions to requests __init__.pyi (#5840) 2021-08-02 07:29:28 -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
Sebastian Rittau
eb431196fa CI: use mypy version from requirements for primer (#5834) 2021-08-02 00:51:46 -07:00
Oleg Höfling
41630486e3 Add Typeguard back to inspect.isclass() return type (#5829) 2021-08-02 09:19:11 +02:00
Anton Grübel
1f3c703993 add missing type hints in tabulate (#5825) 2021-08-02 09:07:49 +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:
0f42b726c8/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
MapleCCC
7ce0b9d670 Update urllib3.util.retry.Retry.__init__() to match the latest version released on PyPI (#5817) 2021-07-29 20:35:24 -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
Anton Grübel
3ed0bb0880 add missing type hints in termcolor (#5813) 2021-07-28 17:51:41 +02:00
Ethan Corey
69c56b9496 Fix for _SimpleStrainable type def (#5810)
Modified definitions of _SimpleStrainable and _SimpleNormalizedStrainable to include Callable[[Tag], bool] (see https://www.crummy.com/software/BeautifulSoup/bs4/doc/#a-function)
2021-07-26 20:08:43 -07:00
Sebastian Rittau
955a3e5d9d Remove PyJWT (#5767)
Closes: #4856
2021-07-24 14:08:20 -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
Vanessa Ung
2b4bbec0d7 Stubs for humanfriendly (#5790)
Autogenerated with stubgen + manual adjustments to fix e.g. namedtuple, Python versioning, removing unneeded imports, required stubtest packages/allowlist.
2021-07-24 14:01:26 -07:00
Shiva Raisinghani
e24f940c7d Stubs for braintree (#5789)
A library that provides integration access to the Braintree Gateway.

I started with stubgen, then cleaned up to address missing functions. Testing plan is to keep an eye on CI and fix any issues that arise.
2021-07-24 13:47:14 -07:00
Jukka Lehtosalo
1ad4b79139 Stubs for selenium (#5792)
These were generated using stubgen, with manual fixes. I tried to remove
exported names that are clearly not part of the public interface, but in many
cases this wasn't obvious so I left the exports, just in case.

I had to do major changes to exported names in `selenium.webdriver` to 
make it work as expected (this was originally implemented by @ilevkivskyi 
in our internal stubs).

Selenium has been working on adding inline type annotations, but it's not clear
when these will be released. The release will be 4.x, and having stubs for 3.x 
could still be valuable for users on older versions.
2021-07-24 13:43:24 -07:00
Anton Grübel
7c5d76aca0 add missing protocol version 5 in pickle (#5801) 2021-07-24 13:42:11 -07:00