Commit Graph
100 Commits
Author SHA1 Message Date
Jelle Zijlstra 56c8cbb314 Add GenericAlias.__typing_unpacked_tuple_args__ (#8015)
Fixes #8014 

python/cpython#92484
2022-06-03 08:26:41 +01:00
Jelle Zijlstra cb9023988d psycopg2: stub improvements (#7964)
Fixes an entry from #7928 along with a number of other improvements.

I went off the C code:
https://github.com/psycopg/psycopg2/blob/master/psycopg/connection_type.c
2022-06-02 18:02:07 -07:00
Jelle Zijlstra 1aa546d07d pyright: turn off reportPropertyTypeMismatch (#7985) 2022-05-30 09:20:28 +02:00
Jelle Zijlstra c35ec8ba89 contextlib: Remove explicit base class from ExitStack (#7963)
Fixes #7961
2022-05-27 09:19:18 -07:00
Jelle Zijlstra 7d34d75582 array: stub improvements (#7966)
- TypeVar changes from https://github.com/microsoft/pyright/issues/3501
- Fix pos-only param
- Use protocols instead of IO classes
2022-05-27 07:33:24 +01:00
Jelle Zijlstra 789c12ad90 constructors: Fix defaulted TypeVars (#7965)
From the list in https://github.com/microsoft/pyright/issues/3501
2022-05-27 07:32:56 +01:00
Jelle Zijlstra 466f9c2ad7 redis: Fix unconstrained TypeVars in a few redis commands (#7942)
Part of #7928
2022-05-26 15:53:56 +01:00
Jelle Zijlstra 84e2ea113f gettext: fix unconstrained TypeVar (#7935) 2022-05-26 07:10:47 +01:00
Jelle Zijlstra d5bc48d29b builtins, collections: Fix unconstrained overloads for container constructors (#7944)
See https://github.com/microsoft/pyright/issues/3501#issuecomment-1135979479

Related to #7928
2022-05-25 10:07:23 +01:00
Jelle Zijlstra 796a689fc1 mock: Fix unconstrained TypeVar (#7945)
The first overload covers the case where `new` is not given.

Part of #7928
2022-05-25 06:52:40 +01:00
Jelle Zijlstra 070e6c2a2d invoke: Fix unconstrained TypeVar (#7943)
Part of #7928 

https://github.com/pyinvoke/invoke/blob/f34c6c9413146a34ede3a5b529916b4cee649887/invoke/tasks.py#L328
2022-05-25 06:48:49 +01:00
Jelle Zijlstra bb119544d8 pkg_resources: Fix unconstrained TypeVars (#7941)
https://github.com/pypa/setuptools/blob/499c468a57d240e5bb450bdb6daedc3e559541dd/pkg_resources/__init__.py#L1049

Part of #7928
2022-05-24 19:49:22 -07:00
Jelle Zijlstra d950ec37ca fileinput: Fix TypeVar usage (#7934)
* fileinput: Fix TypeVar usage

Fixes #7922, part of #7928.
2022-05-24 17:55:35 +01:00
Jelle Zijlstra 158293257e optparse: fix unconstrained TypeVar (#7936)
Part of #7928
2022-05-23 19:39:31 -07:00
Jelle Zijlstra b4518bfb2b argparse: remove incorrect default in overload (#7929)
Part of #7928
2022-05-23 18:12:19 +01:00
Jelle Zijlstra 9660ee97ee codecs: add missing function, reflect runtime import * (#7918) 2022-05-22 16:06:21 -07:00
Jelle ZijlstraandAlex Waygood 18433202ba concurrent.futures: new params in 3.11 (#7919)
https://github.com/python/cpython/commit/fdc0e09c3316098b038996c428e88931f0a4fcdb

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2022-05-22 15:51:09 -07:00
Jelle Zijlstra 54c2e23a55 3.11 allowlist: move inspect._ParameterKind.description to wontfix section (#7920) 2022-05-22 12:04:11 +03:00
Jelle Zijlstra 3dcfbf3745 urllib.request: add code 308 handler for 3.11 (#7917)
https://github.com/python/cpython/commit/c379bc5ec9012cf66424ef3d80612cf13ec51006
2022-05-21 14:13:17 -07:00
Jelle Zijlstra 1220a99399 unicodedata: add UCD.is_normalized (#7915) 2022-05-21 12:59:44 -07:00
Jelle Zijlstra ddc6eda10a symtable: has_exec was removed in 3.9 (#7911) 2022-05-21 17:50:27 +02:00
Jelle Zijlstra 39c777f70c pydoc: 3.11 changes (#7910) 2022-05-21 17:49:39 +02:00
Jelle Zijlstra 237b1bb189 binascii.a2b_base64: new param in 3.11 (#7909)
https://github.com/python/cpython/commit/35b98e38b6edd63153fc8e092f94cb20725dacc1
2022-05-21 08:36:03 -07:00
Jelle Zijlstra 9c0c631e46 gettext.install: names is kw-only in 3.11 (#7908) 2022-05-21 08:22:34 -07:00
Jelle Zijlstra 8b58371278 subprocess: new params in 3.11 (#7907) 2022-05-21 16:07:50 +01:00
Jelle Zijlstra 0198d75153 types: 3.11 (and earlier) fixes (#7900)
- New attributes in 3.11
- Arguments to CodeType.__init__ are always positional (have fun)
- co_consts can use object instead of Any
2022-05-21 07:37:11 -07:00
Jelle ZijlstraandAlex Waygood 7576805aee zipfile: 3.11 fixes (#7898)
* zipfile: 3.11 fixes

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2022-05-21 09:22:32 +01:00
Jelle Zijlstra 585517b20e stubtest: put all the incorrect __get__ sigs together (#7899) 2022-05-20 09:47:02 -07:00
Jelle Zijlstra e7cbde0928 xml: stubtest fixes (#7890) 2022-05-20 13:03:45 +02:00
Jelle Zijlstra 26fa57ab78 traceback: update for py311 (#7886) 2022-05-19 19:14:12 -07:00
Jelle Zijlstra 0b7df3b2aa dataclasses: fix and sort stubtest complaints (#7888) 2022-05-19 19:13:22 -07:00
Jelle Zijlstra 4220712aab dis: add adaptive argument for 3.11 (#7889) 2022-05-19 18:27:34 -07:00
Jelle ZijlstraandShantanu 64766c8521 locale: add locale.getencoding (#7887)
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2022-05-19 18:20:16 -07:00
Jelle Zijlstra 1ffb1bdc0e wsgiref: categorise stubtest issues (#7885) 2022-05-19 18:10:56 -07:00
Jelle Zijlstra 6f2c53f3b0 _imp: fix stubtest issues, add Python 3.11 items (#7878) 2022-05-19 14:43:58 +02:00
Jelle Zijlstra 250f3d92e7 ast: fix stubtest issues (#7877)
Add annotations for `_ast.Tuple.dims` and `ast.main()`. Add allowlist comments for others.
2022-05-19 10:13:08 +01:00
Jelle Zijlstra 4191906e6e 3.11: move some stubtest entries to wontfix list (#7876) 2022-05-19 08:14:44 +02:00
Jelle Zijlstra 7998906226 re: 3.11 fixes (#7859) 2022-05-17 21:42:23 -07:00
Jelle Zijlstra bd394d2486 builtins: add BaseException.add_note in py311 (#7860) 2022-05-17 20:32:28 -07:00
Jelle Zijlstra a01f98c361 sqlite3.Blob: fix stubtest errors (#7858) 2022-05-17 19:50:19 -07:00
Jelle ZijlstraandAlex Waygood 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
eab82c838a asyncio: updates for 3.11 (#7844)
CPython changes:

- https://github.com/python/cpython/commit/13c10bfb777483c7b02877aab029345a056b809c
- https://github.com/python/cpython/commit/9523c0d84f351a610dc651b234461eb015fa3b82
- https://github.com/python/cpython/commit/9f04ee569cebb8b4c6f04bea95d91a19c5403806
- https://github.com/python/cpython/commit/d03acd7270d66ddb8e987f9743405147ecc15087
- https://github.com/python/cpython/commit/195a46d6ffd4cec6c5fb69c5890f8b1758ac91ca

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2022-05-17 18:11:29 -07:00
b00b4f3447 regex: accept buffers (#7680)
Similar to #7679

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Akuli <akuviljanen17@gmail.com>
2022-05-10 15:08:36 -07:00
Jelle Zijlstra 68a781d04e Upgrade pytype (#7823) 2022-05-10 14:47:10 -07:00
Jelle Zijlstra 5c13f8bbce ast: FormattedValue.conversion cannot be None (#7810)
```
In [4]: ast.dump(ast.parse('f"{x!r}"'))
Out[4]: "Module(body=[Expr(value=JoinedStr(values=[FormattedValue(value=Name(id='x', ctx=Load()), conversion=114)]))], type_ignores=[])"

In [5]: ast.dump(ast.parse('f"{x}"'))
Out[5]: "Module(body=[Expr(value=JoinedStr(values=[FormattedValue(value=Name(id='x', ctx=Load()), conversion=-1)]))], type_ignores=[])"
```
(On 3.9 but I don't think this has changed since 3.6.)

The stdlib also assumes this: https://github.com/python/cpython/blob/main/Lib/ast.py#L1211 (`chr(None)` doesn't work).
2022-05-08 19:42:38 -07:00
Jelle Zijlstra 6b5068b11d Add new arguments to subprocess.Popen (#7798) 2022-05-07 09:49:23 +03:00
Jelle Zijlstra 031c998055 enum: Add member and nonmember (#7795)
python/cpython#92366
2022-05-07 07:48:34 +01:00
Jelle Zijlstra 2fc719d3cf tkinter: add info_patchlevel for 3.11 (#7794) 2022-05-07 09:25:55 +03:00
Jelle Zijlstra 963b8aa2f7 add os.login_tty for 3.11 (#7800)
python/cpython#29658
2022-05-06 22:54:58 -07:00
Jelle Zijlstra 4856064ed7 sys.flags: add safe_path for 3.11 (#7797)
python/cpython#31542
2022-05-06 22:50:30 -07:00
Jelle Zijlstra ab1dcafec2 socket: add SO_INCOMING_CPU for 3.11 (#7801)
python/cpython#31237
2022-05-06 22:46:34 -07:00
Jelle Zijlstra c93f262427 Add closure argument to exec() (#7793)
python/cpython#92204
2022-05-06 22:46:01 -07:00
Jelle Zijlstra b1ccd03d51 Add GenericAlias.__unpacked__ (#7774) 2022-05-03 15:41:45 +02:00
Jelle Zijlstra d77d848975 contextlib: Use bound TypeVar (#7764) 2022-05-02 08:57:21 +02:00
Jelle Zijlstra 9effb643b3 logging.LoggerAdapter: Use a bound TypeVar (#7763) 2022-05-02 08:56:32 +02:00
Jelle Zijlstra 7e7562b95b Add socket.TCP_CONNECTION_INFO (#7755)
python/cpython#69256
2022-04-30 09:24:09 -06:00
Jelle Zijlstra e6623754e9 sqlite: Blob now uses ints in getitem/setitem (#7754)
I just merged python/cpython#92020 which implemented this change (thanks @erlend-aasland!).
2022-04-30 09:15:03 -06:00
Jelle Zijlstra 145e659482 inspect: Add positions attributes that will be new in 3.11 (#7688) 2022-04-29 17:00:37 -06:00
Jelle ZijlstraandAlex Waygood 1deb9cb806 jack: Fix MidiPort properties (#7730)
Fixes #7729 

https://github.com/spatialaudio/jackclient-python/blob/26b648a36143b1e3db6e6fc827ca927b0c93cbec/src/jack.py#L1950

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2022-04-27 22:28:17 -06:00
Jelle Zijlstra 1f2a970b94 Upgrade mypy to 0.950 (#7726) 2022-04-27 19:25:02 +02:00
Jelle Zijlstra 2299c43860 decimal: kwargs to localcontext() (#7686) 2022-04-26 13:19:29 +02:00
Jelle Zijlstra 2668cae090 Add PickleBuffer to _typeshed.WriteableBuffer (#7683)
Fixes #4362
2022-04-26 09:14:37 +02:00
Jelle Zijlstra 573539ba2a multiprocessing: add shutdown_timeout param to BaseManager (#7692)
python/cpython#32112
2022-04-25 22:12:56 -06:00
Jelle Zijlstra 85a6f0ffe9 socket: add all_errors param to create_connection (#7691)
python/cpython#91704
2022-04-25 22:10:29 -06:00
Jelle Zijlstra c8a978f756 typing: Add dataclass_transform (#7690)
python/cpython#91861
2022-04-25 22:06:32 -06:00
Jelle Zijlstra ac2b24c08f warnings: New arguments to catch_warnings() in 3.11 (#7685) 2022-04-25 21:19:29 -06:00
Jelle Zijlstra 125f9b4275 sqlite3: Add sequence methods to Blob (#7684)
python/cppython#91599
2022-04-25 20:17:09 -07:00
Jelle Zijlstra 08ae9f324b subprocess: Add _USE_VFORK and _USE_POSIX_SPAWN (#7687)
These are now documented: python/cpython#91490
2022-04-25 21:13:39 -06:00
Jelle Zijlstra 02e0c98d62 Buffer support for re (#7679) 2022-04-23 18:28:35 -07:00
Jelle Zijlstra 5dad506bf2 binascii: Improve bytes types (#7677)
Add missing arguments to b2a_hex()
2022-04-23 20:57:02 +02:00
Jelle Zijlstra 00f4031915 pickle: accept ReadableBuffer (#7678) 2022-04-23 20:54:20 +02:00
Jelle Zijlstra 66383ee8e3 unittest.mock: target must be a str (#7672)
See [the CPython source](https://github.com/python/cpython/blob/eaa85cb22fa2d9e7cd31c2eac29a56cd3a8f2f65/Lib/unittest/mock.py#L1754). It calls `_get_target`, and [that](https://github.com/python/cpython/blob/eaa85cb22fa2d9e7cd31c2eac29a56cd3a8f2f65/Lib/unittest/mock.py#L1594) does `target.rsplit('.', 1)`.
2022-04-21 14:07:55 -07:00
Jelle Zijlstra a17b3afb16 Run pytype test with --print-stderr (#7656) 2022-04-18 10:57:48 +03:00
Jelle Zijlstra a24b765388 improve type for itertools.zip_longest (#7655) 2022-04-17 15:49:05 -07:00
Jelle Zijlstra bedf520d76 typing(_extensions) updates for 3.11 (#7643) 2022-04-16 21:42:12 +02:00
Jelle ZijlstraandSebastian Rittau b0611bc031 Improve sqlite3 types (#7641)
Read through the code in CPython and made the types more precise
where possible.

Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
2022-04-16 11:20:11 -07:00
Jelle Zijlstra d802e65f67 sqlite3: add 3.11 additions (#7625)
- Blob from python/cpython#30680 (and anticipating that python/cpython#91550 will be merged)
- Aggregate window functions from python/cpython#20903
- Serialize/deserialize from python/cpython#26728
- Limit setting from python/cpython#28463
2022-04-16 16:09:26 +02:00
Jelle Zijlstra ee09d9eb19 builtins: Audit bytes arguments (#7631)
Most use the C buffer protocol, so _typeshed.ReadableBuffer is the right type. A few
check specifically for bytes and bytearray.
2022-04-16 14:16:11 +02:00
Jelle Zijlstra d09689f811 Add typing_extensions.assert_type (#7627)
Hasn't been released yet but I'd like it to be in the next mypy release.
2022-04-15 15:17:37 -07:00
Jelle Zijlstra e0654bdbc0 ExceptionGroup: make it generic (#7626) 2022-04-15 16:24:17 +02:00
Jelle Zijlstra cfb1381c2e Add types.FunctionType.__module__ (#7581)
This exists on builtins.function but not here.
2022-04-02 17:44:17 -07:00
Jelle Zijlstra 0322fb0905 errno: fix typo and add missing constants (#7553) 2022-03-25 20:30:26 +01:00
Jelle Zijlstra fa9074366b Revert "Remove google/__init__.pyi (#6106)" (#7522)
This reverts commit a11a6643a7.
2022-03-21 19:49:00 +01:00
Jelle Zijlstra b7d129f727 PEP 604: Remove some more uses of Union/Optional (#7515)
The following patterns still break mypy:

1. `type[]` at top level fails
2. `tuple[T1, T2]` at top level fails (but `tuple[T1, ...]` is fine)
3. `T1 | Callable[..., T2 | T3]` fails, but only <=3.9

This PR cleans up usage of `Union` and `Optional` outside these patterns.
2022-03-19 08:23:00 -07:00
Jelle Zijlstra d9f1f7b81f pytz: utcoffset only returns None if dt is None (#7510) 2022-03-19 08:19:09 +00:00
Jelle Zijlstra 4d23919200 Add typing.TypeVarTuple, Unpack, assert_type (#7501)
python/cpython#31021 and python/cpython#30843.
2022-03-18 18:03:45 +00:00
Jelle Zijlstra ba475a04c3 multiprocessing: args can be any Iterable (#7500)
https://github.com/python/cpython/blob/main/Lib/multiprocessing/process.py#L91
2022-03-17 01:44:25 +00:00
Jelle ZijlstraandAlex Waygood fa332220b7 Fix mypy test (#7478)
* Fix `mypy_test.py` so that it actually tests the third-party stubs
* Upgrade to mypy 0.940
* Skip running mypy on `SQLAlchemy` stubs for now, to workaround a mypy crash.

Because we didn't set mypy's clean_exit parameter, it was exiting immediately after checking the stdlib, meaning `mypy_test.py` wasn't checking the third-party stubs at all.

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2022-03-13 13:01:14 +00:00
Jelle Zijlstra 3e3cc2a6d6 dict.pop: Remove default for second argument (#7481)
The first overload takes care of the case where there is only one argument, so there should be no default in the second overload.
2022-03-13 13:11:35 +01:00
Jelle Zijlstra bd449c983a urllib3: stubs are not Python 2 compatible (#7480)
They use http.client, which is Python 3-only. Another catch from #7478.
2022-03-13 07:09:01 +00:00
Jelle Zijlstra c89236d1cf passlib: fix MutableMapping import (#7479)
Found by #7478
2022-03-12 19:18:48 -08:00
Jelle Zijlstra 9c50fe7b64 Fix overly precise typing.NewType signature (#7474)
`type` is incorrect because `NewType` can also accept another `NewType`: https://peps.python.org/pep-0484/#newtype-helper-function

The return type was also wrong; pre-3.10 `NewType()` doesn't return a type object.
2022-03-11 06:35:45 +00:00
Jelle Zijlstra 675de720d6 Add some missing items to sys.pyi and types.pyi (#7447) 2022-03-07 08:22:08 +01:00
Jelle Zijlstra 2fb9c35ff9 Put shutil.chown back on Windows (#7446)
See #7384 and https://github.com/python/typeshed/pull/7443#issuecomment-1060071944 (thanks @AlexWaygood for diagnosing).
2022-03-06 16:27:24 -08:00
Jelle Zijlstra 0a6b6b095c Add asyncio.windows_utils.Popen (#7396) 2022-03-02 12:37:54 +02:00
Jelle Zijlstra cf3ea5b6e6 ctypes.memmove and memset return ints (#7407)
They actually return pointers, but ctypes turns them into ints.

Fixes #7406
2022-02-28 18:00:16 -08:00
Jelle Zijlstra 4781dbf752 smtpd: MailmanProxy was removed in 3.11 (#7365)
python/cpython#26617
2022-02-22 17:06:39 -08:00
Jelle Zijlstra 61361ce059 contextvars, pycurl: make classes final (#7334) 2022-02-20 16:55:48 -08:00
Jelle Zijlstra 319d23a16e Add PEP 646 and 675 to typing-extensions (#7198) 2022-02-14 08:59:11 +01:00
Jelle Zijlstra 7dd2485269 New additions to typing, typing_extensions (#7169) 2022-02-08 22:40:09 -08:00