Alex Waygood
1371a1e1fe
unittest deprecations have been deferred until 3.12 ( #7131 )
...
See https://github.com/python/cpython/pull/30935
2022-02-04 15:52:30 -08:00
Alex Waygood
51cdd2c6be
Backport many Self-related changes to the Python-2 stdlib ( #7128 )
2022-02-04 10:10:05 -08:00
Alex Waygood
26e8959279
Use _typeshed.Self in docutils.VersionInfo and os.sched_param ( #7117 )
2022-02-02 23:30:39 +01:00
Alex Waygood
15d76b072a
Improve classmethods in paramiko stubs ( #7113 )
2022-02-02 22:15:26 +01:00
Alex Waygood
b4e97a1909
Improve __enter__ & constructor methods ( #7114 )
2022-02-02 22:14:59 +01:00
Alex Waygood
7ccbbdb30a
stdlib: Improve many __iter__ and constructor methods ( #7112 )
2022-02-02 19:14:57 +01:00
Alex Waygood and pre-commit-ci[bot]
27c7aece10
Update asyncio.trsock to reflect methods removed in 3.11 ( #7110 )
...
* Update `asyncio.trsock` to reflect methods removed in 3.11
These were all removed in https://bugs.python.org/issue43232
* [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-02-02 09:44:26 -08:00
Alex Waygood and Sebastian Rittau
806c26045e
Improve itertools stubs ( #7109 )
...
There are quite a few `__iter__` methods in `itertools` that return `self` at runtime. They should do so in the stubs as well.
Co-authored-by: Sebastian Rittau <srittau@rittau.biz >
2022-02-02 08:37:41 -08:00
Alex Waygood
f50255025a
calendar.different_locale.__enter__ returns None, not _LocaleType (#7108 )
2022-02-02 16:28:18 +01:00
Alex Waygood
584336a41e
Fix several methods that should be async def, but aren't ( #7107 )
2022-02-02 15:18:14 +01:00
Alex Waygood
3e6375e606
Delete commented-out pydoc.Scanner class ( #7100 )
2022-02-01 19:46:51 +02:00
Alex Waygood
023e21dedf
Delete SupportsAnyComparison type in _typeshed ( #7098 )
2022-02-01 14:32:20 +01:00
Alex Waygood
f86f096e1c
Use literal types in lzma ( #7095 )
2022-01-31 10:46:26 -08:00
Alex Waygood and Akuli
45a2dad83c
Reduce use of Any in equality methods ( #7081 )
...
Co-authored-by: Akuli <akuviljanen17@gmail.com >
2022-01-30 00:59:00 +02:00
Alex Waygood
d59fb394e7
Remove unused TypeVar ( #7079 )
...
Flagged by https://github.com/PyCQA/flake8-pyi/pull/161
2022-01-29 11:36:02 -08:00
Alex Waygood
99cec2d16b
Reduce duplication of code between typing and typing_extensions ( #7075 )
2022-01-29 07:44:42 -08:00
Alex Waygood
7e79706ddd
Clarify why some module-level objects in typing have default values ( #7037 )
2022-01-28 17:38:25 -08:00
Alex Waygood
33ecb68603
Fix return annotations of several methods that return self at runtime ( #7070 )
2022-01-28 17:37:49 -08:00
Alex Waygood
390634b96b
Improve weakref.WeakValueDictionary.__init__ ( #7068 )
2022-01-28 12:35:26 +01:00
Alex Waygood
dbb5488b31
Do not use True or False as default values in assignments ( #7060 )
2022-01-27 13:51:36 -08:00
Alex Waygood
0e185f4087
Improve inspect stubs ( #7050 )
2022-01-27 09:04:48 -08:00
Alex Waygood
f7a7e0b386
Improve unittest.removeHandler in Python 2 ( #7055 )
...
This brings the signature in line with the signature of `removeHandler` in Python 3:
https://github.com/python/typeshed/blob/a54e21992c26485edb374e1287a7e9c073d6a9ae/stdlib/unittest/signals.pyi#L11-L14
2022-01-27 09:04:18 -08:00
Alex Waygood
2d8decd237
Backport many ParamSpec-related changes to Python 2 ( #7054 )
2022-01-27 07:57:26 -08:00
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