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 Zijlstra and Alex 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 Zijlstra and Alex 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 Zijlstra and Sebastian 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 Zijlstra and Alex 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
Jelle Zijlstra
c1e3be1248
zip.__iter__ and reversed.__iter__ return self ( #7123 )
2022-02-05 15:53:29 +02:00
Jelle Zijlstra
2b72dea679
Allow ExitStack.push callbacks to return None ( #7090 )
2022-01-31 08:21:32 +01:00
Jelle Zijlstra
3b29006a3e
email.generator: Use protocols instead of TextIO/BinaryIO ( #7082 )
2022-01-30 14:02:11 +01:00
Jelle Zijlstra
d5101dced7
Fix float.__rpow__ ( #7047 )
...
Fixes #7046 .
2022-01-26 19:18:42 -08:00
Jelle Zijlstra
c8471ea631
use flake8-pyi 22.1.0 ( #7004 )
2022-01-23 12:43:48 -08:00
Jelle Zijlstra
3d28f0981f
bs4: Expose bs4.SoupStrainer and bs4.Tag ( #7002 )
2022-01-23 19:11:38 +02:00
Jelle Zijlstra
de5ec6a0d1
fix incorrect tuple[T] ( #6996 )
...
Found from PyCQA/flake8-pyi#135 .
2022-01-22 09:37:14 -08:00
Jelle Zijlstra and Shantanu
1f000d2881
Improve type for setdefault() ( #6941 )
...
- With one argument, it may return None
- With two arguments, it returns the default's type or the dict's value type.
- Also remove incorrect `= ...` from `pop()`. The one-argument case has its own overload.
Context: https://github.com/python/typing/discussions/1033#discussioncomment-1986359
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com >
2022-01-19 21:44:15 -08:00
Jelle Zijlstra
30580a3732
disable Y026 in typing.pyi too ( #6959 )
2022-01-18 20:14:55 -08:00
Jelle Zijlstra
65a8825e2f
Disable Y026 from flake8-pyi ( #6958 )
...
Dependent on PyCQA/flake8-pyi#101 .
2022-01-18 20:07:34 -08:00
Jelle Zijlstra
a0d748de2f
Revert "Temporarily fix redis version to 4.1.0" ( #6957 )
...
This reverts commit 7d2de33bba .
2022-01-18 15:09:19 -08:00
Jelle Zijlstra
ea93779c92
Fix TypeVar argument annotations ( #6943 )
...
Arguments like bound= accept type forms like unions, which are not themselves types.
2022-01-18 00:14:40 -08:00
Jelle Zijlstra
01f3f8abf6
Remove staticmethod.__new__ and classmethod.__new__ ( #6934 )
2022-01-17 09:50:04 +01:00
Jelle Zijlstra
0949e9e90d
remove quoted strings ( #6933 )
2022-01-16 14:29:13 -08:00
Jelle Zijlstra and pre-commit-ci[bot]
85318d1b21
Cleanup: do not quote types unnecessarily ( #6931 )
...
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-01-16 20:18:17 +02:00
Jelle Zijlstra
339bfbbfaa
remove "= ..." from top-level values ( #6930 )
2022-01-16 18:38:00 +02:00
Jelle Zijlstra
e53aa04eb2
Add typing_extensions.is_typeddict ( #6923 )
2022-01-15 17:02:23 -08:00
Jelle Zijlstra
1a0e0a4023
urllib3: allow allowed_methods to be False ( #6909 )
2022-01-13 15:26:56 +01:00
Jelle Zijlstra
a4b30c4360
fix typo in _SplitCondition definition ( #6903 )
2022-01-12 19:51:24 +02:00
Jelle Zijlstra
49d2fa5f9d
put redis.client._ScoreCastFuncReturn back ( #6876 )
...
#6829 removed it as unused but #6790 added a usage.
2022-01-09 19:03:51 +02:00
Jelle Zijlstra and Sebastian Rittau
b0453811ed
add (Base)ExceptionGroup ( #6655 )
...
Co-authored-by: Sebastian Rittau <srittau@rittau.biz >
2021-12-22 07:56:35 -08:00
Jelle Zijlstra
85712073ac
Remove duplicate type from ArgumentParser.add_argument ( #6652 )
2021-12-22 08:59:23 +01:00
Jelle Zijlstra
14268f64e5
Widen MutableMapping.update type ( #6653 )
2021-12-22 08:54:05 +01:00
Jelle Zijlstra
e3ea71c018
Add comment to LogRecord.message ( #6654 )
2021-12-22 08:49:35 +01:00
Jelle Zijlstra and Sebastian Rittau
5205efcaa4
Fix Redis.zpopmin and zpopmax ( #6642 )
...
Co-authored-by: Sebastian Rittau <srittau@rittau.biz >
2021-12-21 07:57:46 -08:00
Jelle Zijlstra
183a43a7e0
Fixes to curses stubs ( #6620 )
2021-12-17 18:39:00 +01:00
Jelle Zijlstra
868732098e
inspect._ParameterKind.description is a property ( #6587 )
2021-12-15 13:39:42 +02:00
Jelle Zijlstra
88c8a5829e
More precise return type for sum() ( #6573 )
...
It returns 0 on an empty iterable, and that's the only int it can return for arbitrary iterables.
2021-12-12 16:58:01 -08:00
Jelle Zijlstra
943dc5f61d
More permissive type for random.choice and related functions ( #6562 )
2021-12-10 19:50:02 +01:00
Jelle Zijlstra
7d4d58925a
typing: update comments ( #6558 )
2021-12-09 21:15:27 -08:00
Jelle Zijlstra
384e309f53
pytz: rework stubs ( #6551 )
2021-12-09 09:24:44 +01:00
Jelle Zijlstra and Alex Waygood
72ee95bc0b
operator: make Protocol parameters positional-only ( #6519 )
...
pyanalyze checks parameter names for protocols strictly, so `float` didn't match these protocols.
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com >
2021-12-06 10:49:24 -08:00
Jelle Zijlstra
57e211b306
dependency upgrades ( #6505 )
2021-12-06 01:27:53 +02:00
Jelle Zijlstra
178b6bb8f4
csv: Make _Writer.write positional-only ( #6475 )
...
At runtime it only uses positional parameters.
I think this works fortuitously in mypy and pyright because mypy ignores parameter names in protocols and pyright has a bug that allows passing positional-only to pos-or-keyword params (microsoft/pyright#2652 ) and the parameter to `io.TextIO.write` happens to be `__s`.
2021-12-02 13:27:21 -08:00