Commit Graph
100 Commits
Author SHA1 Message Date
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 Waygoodandpre-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 WaygoodandAkuli 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 WaygoodandAkuli 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 WaygoodandAkuli 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 Waygoodandpre-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 WaygoodandAkuli 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 WaygoodandAkuli 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
Alex Waygood 415d387009 Make various os functions available on Windows (#6500) 2021-12-05 22:06:22 +02:00
Alex Waygood 28803c4c4a Mark OSError.characters_written as "wontfix" (#6499) 2021-12-05 20:29:10 +02:00
Alex Waygood f43b968ab9 Clean up asyncio.__init__ (#6497) 2021-12-05 16:53:26 +02:00
Alex Waygood bb7a06c60b Add missing asyncio functions, part II (#6493) 2021-12-05 12:29:25 +02:00
Alex WaygoodandAkuli f105c79219 Harmonise UserDict.__init__ with dict.__init__ (#6490)
Co-authored-by: Akuli <akuviljanen17@gmail.com>
2021-12-04 19:50:47 +02:00
Alex Waygood 9e0ee447c6 Harmonise UserDict.fromkeys with dict.fromkeys (#6488) 2021-12-04 13:56:30 +01:00
Alex Waygood a293f1e73f Add OrderedDict.fromkeys (#6485) 2021-12-03 22:06:51 +02:00
Alex Waygood 050a77d8e3 Make NewType a class in 3.10 (#6469) 2021-12-03 13:33:44 +01:00
Alex Waygood 1fa1270e00 Bump pyright version to 1.1.192 (#6478) 2021-12-03 09:08:35 +01:00
Alex Waygood a2e4a62fac Annotate UserList.sort() .index() arguments (#6472) 2021-12-02 17:44:21 +01:00
Alex Waygood 7b24e9d89a Improve UserList comparison methods (#6471)
These functions will fail at runtime if `other` is not either a `list` or a `UserList`. The elements within `other` must also be of the same type as the elements within `self`, or the comparison will fail.
2021-12-02 16:19:50 +01:00
Alex Waygood 6246e7856c Improve BinOp comparison funcs in operator (#6462) 2021-11-30 21:38:31 -08:00
Alex Waygood 1c88ceeee9 Make example in CONTRIBUTING the same as in the stub` (#6461)
Looks like I made an argument in `datetime.pyi` positional-only a while back, and didn't realise the class was given as an example in `CONTRIBUTING.md`.
2021-11-30 13:35:44 -08:00
Alex WaygoodandAkuli f2a7d66346 Any->object in operator.contains/operator.countOf (#6459)
Co-authored-by: Akuli <akuviljanen17@gmail.com>
2021-11-30 09:57:51 -08:00
Alex Waygood c3753d3913 Use SupportsIndex in operator.index (#6460) 2021-11-30 09:38:34 -08:00
Alex Waygood 93cb52b929 Improve unary-operator functions in operator (#6452) 2021-11-30 07:38:35 -08:00
Alex Waygood 9ccfc587d8 operator.length_hint: Any -> object (#6456) 2021-11-30 17:12:29 +02:00
Alex Waygood f3632f8da5 operator.eq: Any -> object (#6457) 2021-11-30 17:10:07 +02:00
Alex Waygood 1f62ff62e7 Any -> object in simple operator funcs (#6451) 2021-11-30 15:21:51 +02:00
Alex WaygoodandAkuli 521dd430c6 Add zipimporter.find_spec() and zipimporter.invalidate_caches() (#6446)
Co-authored-by: Akuli <akuviljanen17@gmail.com>
2021-11-29 16:52:20 +02:00