Alex Waygood
5b39d07cd9
Add ParamSpec to decorator.contextmanager ( #7051 )
...
There may be other places in this package where `ParamSpec` could be used, but this one is the most clear-cut.
2022-01-27 07:35:19 -08:00
Alex Waygood
e01fc81497
Improve contextvars.Context ( #7052 )
...
Similar changes to the ones @sobolevn made in #6942
2022-01-27 07:33:53 -08:00
Alex Waygood
5d07ebc864
Use PEP 585 syntax in typing and typing_extensions, and remove module-level defaults where possible ( #7036 )
2022-01-25 16:13:36 +01:00
Alex Waygood
a9ae6b246c
Remove many checks from check_new_syntax.py ( #7023 )
...
These are now checked by the flake8-pyi plugin, which is better tested and more comprehensive. Removing these checks from `check_new_syntax.py` will reduce the risk of a contributor getting two nearly identical error messages for the same line in a PR.
2022-01-24 07:30:27 -08:00
Alex Waygood
6346464aed
Use import instead of type alias in email/message.pyi ( #7022 )
2022-01-24 13:00:29 +01:00
Alex Waygood
049a260acb
Use class-based syntax for TypedDict in Flask-Cors/flask_cors/core.pyi ( #6995 )
...
Refs https://github.com/PyCQA/flake8-pyi/pull/133
2022-01-22 08:46:15 -08:00
Alex Waygood
d053d8ffea
Make mapping attribute read-only on dict views classes ( #6991 )
2022-01-22 11:49:59 +02:00
Alex Waygood
76af72831a
Use the Literal["foo", "bar"] syntax consistently ( #6984 )
2022-01-20 20:16:04 +02:00
Alex Waygood
bcd9ca47f6
Remove unneeded # noqa comment ( #6979 )
2022-01-20 14:11:23 +01:00
Alex Waygood
aea52b35d1
Remove nearly all __str__ and __repr__ methods from typeshed ( #6968 )
2022-01-20 00:45:11 +01:00
Alex Waygood
fe6233a8c3
Add Y027 to list of ignored .flake8 error codes ( #6962 )
...
Refs https://github.com/PyCQA/flake8-pyi/pull/104
2022-01-19 07:17:30 -08:00
Alex Waygood
2170693e11
Add various __*or__ methods, and improve dict.__ior__ ( #6961 )
2022-01-19 12:24:16 +01:00
Alex Waygood
90d92aa0a5
Use _typeshed.Self in protobuf/google/protobuf/message.pyi ( #6955 )
2022-01-18 12:54:09 -08:00
Alex Waygood
cd93461225
Use PEP 585 syntax in @python2/_ast, convert more TypeVars to _typeshed.Self, & # noqa a SQLAlchemy line ( #6954 )
...
* Manual fixes for `_ast` and `SQLAlchemy`
* Change more `TypeVar`s to `Self`, using script
2022-01-18 11:15:34 -08:00
Alex Waygood
8af5e0d340
Use PEP 585 syntax in Python 2, protobuf & _ast stubs, where possible ( #6949 )
2022-01-18 07:14:03 -08:00
Alex Waygood
1eadf1ab35
Use int | Any for types.FrameType.f_lineno ( #6935 )
2022-01-17 11:32:20 +02:00
Alex Waygood
6a88d5e7ae
Use _typeshed.Self in Python 2, too ( #6932 )
2022-01-16 14:44:51 -08:00
Alex Waygood
425ba77bb2
Remove even more unused TypeVars ( #6928 )
2022-01-16 08:07:32 -08:00
Alex Waygood
dbcb38a605
Add more missing methods to os._Environ ( #6926 )
2022-01-16 06:45:11 -08:00
Alex Waygood and Akuli
af8e37d273
Add # noqa comments to typing.AnyStr ( #6925 )
...
Co-authored-by: Akuli <akuviljanen17@gmail.com >
2022-01-16 14:23:22 +02:00
Alex Waygood
7d33ff330a
Clean up several version-dependent modules ( #6885 )
2022-01-10 05:57:08 -08:00
Alex Waygood
96c9abb058
Always use _typeshed.Self, where applicable ( #6880 )
...
* Always use `_typeshed.Self`, where applicable
* Revert changes to `google-cloud-ndb` (ambiguous)
* Remove empty line added by script
* Revert changes to `stubs/python-dateutil/dateutil/relativedelta.pyi`
* Manually add a few more that the script missed
* Improve `filelock` annotation
Source code here: https://github.com/tox-dev/py-filelock/blob/79ec7b2826e33b982fe83b057f359448b9d966ba/src/filelock/_api.py#L207
* Improve `opentracing/scope` annotation
Source code here: https://github.com/opentracing/opentracing-python/blob/3e1d357a348269ef54d67f761302fab93dbfc0f7/opentracing/scope.py#L71
* Improve `redis/client` stub
Source code here: https://github.com/redis/redis-py/blob/15f315a496c3267c8cbcc6d6d9c6005ea4d4a4d5/redis/client.py#L1217
* Improve `redis/lock` annotation
Source code here: https://github.com/redis/redis-py/blob/15f315a496c3267c8cbcc6d6d9c6005ea4d4a4d5/redis/lock.py#L155
* Improve `requests/models` annotation
Source code here: https://github.com/psf/requests/blob/d718e753834b84018014a23d663369ac27d1ab9c/requests/models.py#L653
2022-01-09 19:16:19 -08:00
Alex Waygood
3351f0c0b9
Remove unused requests allowlist entry ( #6882 )
2022-01-10 00:18:23 +01:00
Alex Waygood and pre-commit-ci[bot]
a0b5deda40
All instance attributes on memoryview are read-only ( #6878 )
...
* All instance attributes on `memoryview` are read-only
* [pre-commit.ci] auto fixes from pre-commit.com hooks
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-01-09 12:07:09 -08:00
Alex Waygood
4e046163b5
Delete many redundant method redefinitions ( #6877 )
2022-01-09 11:21:03 -08:00
Alex Waygood
a40d79a4e6
Use lowercase type everywhere ( #6853 )
2022-01-08 16:09:29 +01:00
Alex Waygood
9558b36a45
range and slice: start, stop, step are read-only ( #6849 )
2022-01-07 19:17:28 +02:00
Alex Waygood
df6f701ba4
builtins: Fix from_bytes() and fromhex() return type ( #6842 )
2022-01-07 00:43:04 +02:00
Alex Waygood
2268955701
Remove several unused TypeVars ( #6829 )
2022-01-05 17:58:03 +02:00
Alex Waygood and Akuli
beedc1d039
Improve sys stubs ( #6816 )
...
Co-authored-by: Akuli <akuviljanen17@gmail.com >
2022-01-05 17:37:40 +02:00
Alex Waygood
6ff9020603
Clean up os.statvfs_result ( #6828 )
2022-01-05 14:53:12 +02:00
Alex Waygood
3112f0e525
_typeshed.structseq: Use Final instead of ClassVar (#6825 )
2022-01-05 14:16:57 +02:00
Alex Waygood
582f1e9c5f
Make os.path.join() first parameter pos-only ( #6812 )
2022-01-04 15:38:46 +01:00
Alex Waygood
e655282e87
sys.version_info is a structseq class (#6786 )
2022-01-02 22:04:27 +02:00
Alex Waygood
505ea72641
Never explicitly inherit from object in Python 3-only stubs ( #6777 )
2022-01-02 07:24:48 +01:00
Alex Waygood and Akuli
e434b23741
Allowlists: move entries relating to __all__ weirdness to their own section ( #6767 )
...
Co-authored-by: Akuli <akuviljanen17@gmail.com >
2021-12-31 14:31:18 +02:00
Alex Waygood
7b4241b03f
Allowlists: mark several entries as wontfix, add note to inspect.Parameter entries ( #6756 )
2021-12-30 18:26:48 +02:00
Alex Waygood
496313d875
Add various missing os constants ( #6753 )
2021-12-30 15:21:30 +02:00
Alex Waygood
048f4fe720
curses is not available on Windows (#6749 )
2021-12-29 21:29:13 +01:00
Alex Waygood
7a1770d825
syslog is not available on Windows (#6745 )
2021-12-29 21:48:06 +02:00
Alex Waygood
620b1bf12f
spwd is not available on Windows (#6744 )
2021-12-29 21:47:48 +02:00
Alex Waygood
007bfad80c
pwd is not available on Windows (#6742 )
2021-12-29 21:47:36 +02:00
Alex Waygood
cacd658a74
pty is not available on Windows (#6741 )
2021-12-29 21:46:57 +02:00
Alex Waygood
912f6306b1
grp is not available on Windows (#6740 )
2021-12-29 21:46:49 +02:00
Alex Waygood
2b90495f8b
fcntl is not available on Windows (#6739 )
2021-12-29 21:46:06 +02:00
Alex Waygood
8baa56b054
crypt is not available on Windows (#6738 )
2021-12-29 21:45:18 +02:00
Alex Waygood
34a7e753aa
_posixsubprocess is not available on Windows (#6737 )
2021-12-29 21:44:36 +02:00
Alex Waygood
53cfcdcbb1
resource is not available on Windows (#6736 )
2021-12-29 21:44:14 +02:00
Alex Waygood
418c277dc9
readline is not available on Windows (#6743 )
2021-12-29 21:35:18 +02:00
Alex Waygood
9a180024c5
tty is not available on Windows (#6747 )
2021-12-29 21:30:27 +02:00
Alex Waygood
d76355d57c
termios is not available on Windows (#6746 )
2021-12-29 21:22:58 +02:00
Alex Waygood
a82a4bc62b
email: add Message methods ( #6731 )
...
Add `email.message.Message` methods, mark `email.iterators.walk` as wontfix
2021-12-29 10:40:06 -06:00
Alex Waygood
ab893c91fd
pygments: remove outdated TODOs ( #6725 )
2021-12-28 22:23:23 +02:00
Alex Waygood
8d5d2520ac
Use PEP 585 syntax wherever possible ( #6717 )
2021-12-28 11:31:43 +01:00
Alex Waygood
975b3e901b
Always alias collections.abc.Set ( #6712 )
2021-12-27 17:09:47 +01:00
Alex Waygood
a54e21992c
Remove ParamSpec-related # type: ignores ( #6703 )
2021-12-26 15:27:57 +01:00
Alex Waygood
0e75580381
Add missing attributes to contextlib._(Async)GeneratorContextManager ( #6676 )
2021-12-26 14:05:49 +01:00
Alex Waygood
1ec2387da1
Fix 'object.__reduce__' ( #6662 )
...
Reverts regressions introduced by #6292 . Fixes #6661 .
2021-12-22 12:08:43 -08:00
Alex Waygood
a7c9788948
Improve stub for enum.property ( #6648 )
2021-12-21 21:11:07 -08:00
Alex Waygood
64b3dd875f
Increase pyright strictness for some xml files ( #6649 )
2021-12-21 18:31:30 +01:00
Alex Waygood
519d70097b
Update enum.pyi ( #6629 )
2021-12-20 17:51:48 -08:00
Alex Waygood
2173c44117
Correct return type of asynccontextmanager in 3.10 ( #6634 )
2021-12-20 17:58:13 +01:00
Alex Waygood
e6911530d4
collections: remove redundant method redefinitions (#6630 )
2021-12-19 23:38:42 +01:00
Alex Waygood
5dcca3fe46
Improve stubs for email.policy ( #6631 )
...
* Add the ABCMeta metaclass, present at runtime.
* Add missing attributes from the allowlist, which are documented.
* Annotate the __init__ methods according to the documentation.
2021-12-19 23:38:08 +01:00
Alex Waygood
12b79f64d7
Remove incorrect deque method overloads ( #6628 )
...
As the current comment in the source code states, these methods don't really take slices. It's surely better just to add `# type: ignore` comments, rather than have an incorrect stub.
2021-12-18 12:00:03 -08:00
Alex Waygood
4f7f30a8c4
Use SupportsKeysAndGetItem in most Mapping constructors ( #6626 )
2021-12-18 11:33:00 -08:00
Alex Waygood
ae725c3f10
Add test to ensure certain names are not imported from typing_extensions ( #6619 )
2021-12-17 14:50:25 -08:00
Alex Waygood and Akuli
0b75d71303
Add a structseq class to _typeshed ( #6560 )
...
Co-authored-by: Akuli <akuviljanen17@gmail.com >
2021-12-17 13:42:09 -08:00
Alex Waygood
c164d21225
Add timeout attribute to _socket.socket ( #6607 )
2021-12-16 13:50:43 +01:00
Alex Waygood
4e1656dadf
Correct sre_parse.State.opengroup ( #6608 )
2021-12-16 14:24:49 +02:00
Alex Waygood and pre-commit-ci[bot]
6baf64c431
dis: rename private-to-typeshed aliases (#6598 )
...
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2021-12-16 14:03:11 +02:00
Alex Waygood
3d9599cec1
Improve stubs for email.headerregistry ( #6588 )
...
* Add max_count class vars
* Add init() methods
* Fix ContentDispositionHeader.content_disposition return type
2021-12-16 12:42:07 +01:00
Alex Waygood
5670ca2f75
Add SupportsRichComparison type to _typeshed ( #6583 )
...
Use it to improve types of `max()` and other functions.
Also make some other tweaks to types related to comparison dunders.
Fixes #6575
2021-12-14 14:12:23 +00:00
Alex Waygood
f3026dc3ab
Improve enum.StrEnum ( #6580 )
...
A `StrEnum` can only have strings as values.
2021-12-13 17:59:31 +01:00
Alex Waygood
cc054efa79
Make name and value read-only for Enums, part II ( #6578 )
2021-12-13 17:00:28 +01:00
Alex Waygood
0f2e87e42a
Make name and value read-only for Enums ( #6576 )
2021-12-13 16:08:49 +01:00
Alex Waygood
c3cd88ba91
Add EnumMeta.__new__ & EnumMeta.__call__ ( #6572 )
2021-12-13 12:33:54 +01:00
Alex Waygood
a774e52fae
Correct builtins.help ( #6571 )
2021-12-12 17:09:34 +02:00
Alex Waygood
c7efc3741e
Allowlists: mark email.contentmanager entries as "wontfix" ( #6570 )
2021-12-12 17:07:27 +02:00
Alex Waygood
84fd495b65
Update importlib to reflect recent changes ( #6557 )
2021-12-10 14:32:55 +01:00
Alex Waygood
e330a74dc3
Allowlists: mark cgi entries as "wontfix" ( #6559 )
2021-12-10 14:27:58 +01:00
Alex Waygood
bbde06867c
Allowlists: add note to abstractstaticmethod/abstractstaticmethod entries ( #6553 )
2021-12-09 06:37:17 -08:00
Alex Waygood
65f0e8b770
Improve pydoc stubs ( #6554 )
2021-12-09 14:28:35 +01:00
Alex Waygood
64fa02ae2c
Allowlists: mark profile.Profile entries as "wontfix" ( #6548 )
2021-12-08 09:32:23 -08:00
Alex Waygood
1718b77a1a
Remove redundant method redefinitions in builtins ( #6545 )
2021-12-08 16:29:07 +01:00
Alex Waygood
ba2bfae4f9
Add xml.etree.ElementInclude.LimitedRecursiveIncludeError ( #6547 )
2021-12-08 16:27:56 +01:00
Alex Waygood and Akuli
1fdd7e40af
Add missing objects to xml.etree.ElementTree ( #6540 )
...
Co-authored-by: Akuli <akuviljanen17@gmail.com >
2021-12-08 15:02:54 +02:00
Alex Waygood
c6b32eb904
allowlists: delete redundant collections.abc entries ( #6542 )
2021-12-08 00:56:33 -08:00
Alex Waygood
1d5857e1e0
Add xml.dom.InvalidCharacterErr ( #6538 )
...
* Update __init__.pyi
* Update py3_common.txt
2021-12-07 13:32:24 -08:00
Alex Waygood
3aab6f1348
Add missing properties to xml.dom.minidom ( #6526 )
2021-12-07 18:40:33 +02:00
Alex Waygood
4ce28b015a
Allowlists: mark Pickler.memo as wontfix, note that pkg.ImpLoader is deprecated ( #6536 )
2021-12-07 18:27:19 +02:00
Alex Waygood
14f2e0feb9
Allowlists: mark WindowsRegistryFinder entries as "wontfix" ( #6534 )
2021-12-07 16:36:34 +02:00
Alex Waygood
10fe37fe64
Allowlists: mark wsgiref entries as "wontfix" ( #6532 )
2021-12-07 16:11:59 +02:00
Alex Waygood
d27bc8d176
Update allowlist notes ( #6528 )
...
The note next to `asyncore` and `asynchat` is no longer strictly accurate following the decision of the steering Council to revert the removal of these modules in 3.11: https://github.com/python/steering-council/issues/86#issuecomment-987412171
2021-12-07 00:36:09 -08:00
Alex Waygood
a69ef8f1ad
Clean up threading.pyi ( #6525 )
...
- Adds comments to aliases in the `threading` module to indicate that they're deprecated.
- Adds two missing aliases, for consistency.
- Closes #6494
2021-12-06 16:21:27 -08:00
Alex Waygood and Akuli
6b2218846c
Add stub for xml.dom.expatbuilder ( #6517 )
...
Co-authored-by: Akuli <akuviljanen17@gmail.com >
2021-12-06 20:39:01 +02:00
Alex Waygood
956ee62173
Allowlists: move distutils entries to their own section ( #6513 )
...
`distutils` is deprecated in its entirety, slated for removal in 3.12. It makes sense to move these entries to their own section.
2021-12-06 16:28:59 +02:00
Alex Waygood
8a7c23624e
Clean up signal.pyi ( #6504 )
...
This PR proposes purely cosmetic changes to make `signal.pyi` a bit neater.
2021-12-06 09:24:01 +01:00
Alex Waygood
ff4bd7c465
Add __(r)or__ to various typing classes ( #6498 )
...
- `__or__` was added to `TypeVar` in Python 3.10: https://bugs.python.org/issue41428 (this PR: https://github.com/python/cpython/pull/21515 )
- `__or__` was added to `ForwardRef` in Python 3.11: https://bugs.python.org/issue45489
2021-12-05 15:16:19 -08:00
Alex Waygood
3f316b0ffb
Correct signal.CTRL_C_EVENT and signal.CTRL_BREAK_EVENT ( #6503 )
2021-12-06 00:01:09 +02:00