Commit Graph
100 Commits
Author SHA1 Message Date
Alex Waygood b0f2bd68b0 Improve tempfile.SpooledTemporaryFile (#7196) 2022-02-13 17:41:54 -08:00
Alex Waygood 65002d2e69 threading: Semaphore.__exit__ & _RLock.__exit__ always return None (#7195)
`_RLock.__exit__`: https://github.com/python/cpython/blob/1d6ce67c29aa2166ef326952cb605b908fb4f987/Lib/threading.py#L199
`Semaphore.__exit__`: https://github.com/python/cpython/blob/1d6ce67c29aa2166ef326952cb605b908fb4f987/Lib/threading.py#L487
2022-02-13 17:41:17 -08:00
Alex Waygood cabfaabd76 optparse.HelpFormatter: format_heading and format_usage are abstract methods (#7194)
The [docstrings state](https://github.com/python/cpython/blob/0ae40191793da1877a12d512f0116d99301b2c51/Lib/optparse.py#L255-L259) "Subclasses must implement", and the [docs for optparse](https://docs.python.org/3/library/optparse.html) explicitly state that `TitledHelpFormatter` and `IndentedHelpFormatter` are provided as "concrete implementations" of `optparse.HelpFormatter`.
2022-02-13 17:41:00 -08:00
Alex Waygood 68e2a74a79 pathlib.Path.__exit__ always returns None (#7192)
Source code here: https://github.com/python/cpython/blob/0ae40191793da1877a12d512f0116d99301b2c51/Lib/pathlib.py#L893

It has always returned `None`, by the looks of things.
2022-02-13 17:14:13 -08:00
Alex Waygood 0109a371d6 Improve webbrowser stubs (#7190)
- `BaseBrowser.open` is an abstract method that should be overridden in all subclasses.
- `UnixBrowser.open` only accepts 0, 1 or 2 for the `new` parameter.
2022-02-13 17:10:43 -08:00
Alex Waygood 7f472e94e5 Improve collections.UserString (#7189) 2022-02-13 17:09:06 -08:00
Alex Waygood 63489c305d asyncio: make AbstractServer abstract and remove unnecessary metaclass=ABCMeta (#7185) 2022-02-13 23:34:19 +02:00
Alex Waygood 03dbe2206c Improve pathlib stubs (#7181) 2022-02-12 18:42:04 -08:00
Alex Waygood da7604a968 Add stubs for pyflakes (#7175) 2022-02-11 12:21:28 +01:00
Alex Waygood 4b75ecbbe2 Use Self in Python 2's array.__imul__ (#7167) 2022-02-08 10:54:16 -08:00
Alex Waygood 5f830d023f Backport more Self-related changes to Python 2 (#7166) 2022-02-08 09:52:43 -08:00
Alex Waygood 398a5807a1 Return Self from MutableSequence.__iadd__ (#7162) 2022-02-08 06:15:37 -08:00
Alex Waygood b1b3471c76 Improve in-place BinOp methods for sets (#7161) 2022-02-08 14:57:50 +01:00
Alex Waygood 494481a0ae Improve a bunch of __(deep)copy__ methods (#7148) 2022-02-06 15:40:44 -08:00
Alex Waygood a62fd92fb0 Improve some in-place BinOp methods (#7149) 2022-02-06 15:36:57 -08:00
Alex Waygood 348c38a0dd Improve __all__ definitions for threading and _dummy_threading modules (#7135) 2022-02-05 08:07:02 -08:00
Alex Waygood 287c8c3d79 Add __all__ to copyreg stubs (#7137) 2022-02-05 07:28:15 -08:00
Alex Waygood 004f12a1eb Add __all__ to _osx_support (#7136) 2022-02-05 07:27:01 -08:00
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 Waygoodandpre-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 WaygoodandSebastian 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 WaygoodandAkuli 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 WaygoodandAkuli 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 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