Commit Graph
4627 Commits
Author SHA1 Message Date
Sebastian RittauandGitHub 3bb397055c Improve distutils and lib2to3 (#5763)
Add missing elements to distutils.util:

* run_2to3()
* copydir_run_2to3()
* Mixin2to3

Use PEP 604 and PEP 585.

Add lib2to3.refactor.
2021-07-12 20:15:54 +02:00
Sebastian RittauandGitHub 7c382c7cd8 Run mypy tests for stdlib and third-party separately (#5760) 2021-07-12 10:09:13 +02:00
Jelle ZijlstraandGitHub 7f320c6b9e Stubs for beautifulsoup4 (#5758)
Stubgen and manual fixes, don't bother with Python 2
2021-07-11 17:02:51 +03:00
AkuliandGitHub e676fcabd3 Create pygments stubs (#5759)
* run stubgen

* replace individual lexers with __getattr__ in lexers/__init__.pyi

* replace individual styles with __getattr__ in styles/__init__.pyi

* import-export each formatter into formatters/__init__.pyi

* clean up slightly with quick and dirty script

* manual fixing
2021-07-11 16:27:35 +03:00
Jelle ZijlstraandGitHub a90573feb2 tornado: add some types, set version (#5742) 2021-07-11 13:17:40 +02:00
Jelle ZijlstraandGitHub 80591d9f99 Fix aiofiles.base.AsyncBase.__iter__ (#5750)
Fixes #5725.

This doesn't actually work properly in mypy.
2021-07-11 10:58:10 +03:00
Nipunn KoorapatiandGitHub 42eec29eed Update proto stubs with latest mypy-protobuf 2.6 (#5753) 2021-07-10 17:10:39 -07:00
Nipunn KoorapatiandGitHub 276c225cd9 Remove FieldDescriptor fallback for protobuf extension methods (#5754)
It was there for compatibility to older versions of mypy-protobuf.
With modular typeshed, this sort of straddling code will no longer
be necessary! Thanks @ilevkivskyi
2021-07-11 00:28:46 +02:00
Sebastian RittauandGitHub 8d12d6f468 Use vobject stubs in caldav (#5749) 2021-07-09 16:57:16 +03:00
Bas van BeekandGitHub 5e23e2c19a Use SupportsIndex where applicable in builtins.pyi (#5739)
* Use `SupportsIndex` where applicable in `builtins.pyi`

* Remove `None` from the `int.__round__` ndigits parameter
2021-07-09 13:08:19 +03:00
0330530de0 Update pwd stub file (#5741)
Add the following properties to struct_passwd:
* n_fields
* n_sequence_fields
* n_unnamed_fields

Co-authored-by: Akuli <akuviljanen17@gmail.com>
2021-07-09 12:54:22 +03:00
c4a60ce94c Add pytest-lazyfixture stubs (#5745)
This change will add stubs for pytest-lazyfixture. It is particual useful for projects which type their tests and use pytest-lazyfixture.
The included functions and classes are the scope which can be considered documented by the module. Any other function is related to pytest hook implementations and are normally not called by an user.

Please note, that if a user uses 'pytest.lazy_fixture' these stubs will not work. As recommneded in https://github.com/TvoroG/pytest-lazy-fixture/issues/51 the package needs to imported directly.

Co-authored-by: Akuli <akuviljanen17@gmail.com>
2021-07-09 12:52:22 +03:00
Sebastian RittauandGitHub aca5952361 Wrap vobject.win32tz in platform check (#5747) 2021-07-09 11:32:57 +02:00
Nipunn KoorapatiandGitHub c5dd23ac0d Allow unicode and bytes in EnumTypeWrapper.Value (#5743) 2021-07-09 11:22:38 +02:00
fdf073627c maybe fix stubtest (#5746)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2021-07-09 12:06:26 +03:00
Sebastian RittauandGitHub a7446632f7 Add third-party vobject stubs (#5733) 2021-07-08 18:26:24 -07:00
Sebastian RittauandGitHub 788b20e326 Upgrade Pillow stubs for Pillow 8.3 (#5731)
* Upgrade Pillow stubs for Pillow 8.3

* stubtest: ignore PIL._tkinter_finder

* Annotate TiffTags.py

* Pillow: stubtest and various other fixes

* Remove tkinter modules from stubtest_allowlist
2021-07-08 18:22:07 -07:00
c968614bae fix type of FileIO.__init__ opener kwarg (#5738)
Co-authored-by: Akuli <akuviljanen17@gmail.com>
2021-07-08 13:50:56 -07:00
Anton GrübelandGitHub 0085539df3 Add missing type hints in http.client (#5734)
* Add missing type hints in http.client

* Add http.client.HTTPConnection.response_class to exclude list
2021-07-08 14:43:42 +03:00
opsyneandGitHub 9d5046ee7f polib: fix ordered_metadata return type (#5735)
Also update version in METADATA.toml.
2021-07-07 19:07:17 +02:00
AkuliandGitHub 42247feefb use Self in async context managers (#5724) 2021-07-06 08:47:49 +02:00
Peter PentchevandGitHub ff2b92f340 pathlib2: most of the methods support the "unicode" type. (#5727)
Closes: #5726
2021-07-05 12:47:18 +02:00
UnrudandGitHub 2ee7b1346b Replace IO[str] with IO[bytes] in urllib.request (#5728) 2021-07-05 09:41:59 +02:00
JoshandGitHub 2b497f7227 importlib.util.resolve_name package argument accepts None (#5730) 2021-07-05 09:21:40 +02:00
d68701c0ec Use _typeshed.Self with __enter__ (#5723)
Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
Co-authored-by: Akuli <akuviljanen17@gmail.com>
2021-07-04 21:10:01 +03:00
Fabian RaabandGitHub 1a131a489e [UserList]: Return type for slice is set to whatever self is (#5722) 2021-07-02 21:20:17 +02:00
Anton GrübelandGitHub de19554dcc Add json.py_encode_basestring stubs (#5720) 2021-07-02 11:18:35 +03:00
Anton GrübelandGitHub 8a107464a8 Use _typeshed.Self with __enter__ (#5719) 2021-07-01 23:15:13 +02:00
96e0660fba Use _typeshed.Self with __enter__ (#5717)
Co-authored-by: Akuli <akuviljanen17@gmail.com>
2021-07-01 12:32:32 +02:00
ShantanuandGitHub 04f0113d16 dataclasses: work around default factory issues (#5718) 2021-07-01 08:07:00 +02:00
Luis MarsanoandGitHub c6b78354e6 stdlib logging: specify style type as literal choice (#5716)
documented for style parameter: https://docs.python.org/3/library/logging.html#logging.Formatter
2021-06-30 14:50:21 -07:00
AkuliandGitHub b06352556d Use Literal["little", "big"] for byteorder (#5715) 2021-06-30 13:15:50 -07:00
Sebastian RittauandGitHub 1cffceb767 Add httplib2 third-party stubs (#5713) 2021-06-30 07:54:02 -07:00
2b35ea5f91 Add caldav third-party stubs (#5684)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2021-06-30 16:28:40 +02:00
Sebastian RittauandGitHub 40b127d46a Add third-party commonmark stubs (#5702) 2021-06-30 07:19:43 -07:00
kasiumandGitHub 2c97c3cab9 Flag LogRecord.args as optional (#5714)
Resolves #5710
2021-06-30 14:51:32 +02:00
Sebastian RittauandGitHub f260ea2383 Add html5lib third-party stubs (#5701) 2021-06-29 21:15:59 -07:00
bb981bd726 Merge last of PIL stubs from Pylance (#5706)
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2021-06-29 21:05:04 -07:00
Anton GrübelandGitHub c38171a0b3 Use _typeshed.Self with __enter__ (#5712) 2021-06-29 15:19:25 -07:00
Anton GrübelandGitHub 35cc7491db Add __defaults__ and __closure__ to types.MethodType (#5707) 2021-06-29 10:21:06 -07:00
Thomas GraingerandGitHub bd50dacd76 add py3.10 async contextlib.nullcontext (#5711) 2021-06-29 08:35:44 -07:00
Charly CandGitHub 389b92cb04 fix the stub files for the stdlib mmap module (#5705)
In Python 3:
- The `mmap` type is `Iterable[int]`, not `Iterable[bytes]`.
- The `read_byte` method returns an `int`, and the `write_byte` method only accepts an `int` as its first and only argument.
- The `__setitem__` method accepts any `ReadableBuffer` object, not just `bytes`.

In both Python 2 and 3:
- The `__delitem__` method always raises a `TypeError`, so the proper return type is `NoReturn`.
- The `mmap` type isn't generic, so I've simplified the stubs by removing the unnecessary `_mmap` class.
2021-06-29 08:01:32 -07:00
Thomas GraingerandGitHub 14add7520b widen _SupportsAclose (#5708)
see https://github.com/python-trio/trio-typing/issues/31#issuecomment-867534826
2021-06-28 15:29:21 -07:00
Sebastian RittauandGitHub 2b64f54008 Support @tests/requirements-stubtest.txt files (#5704) 2021-06-28 19:42:27 +02:00
6b8f047b05 Update some PIL stubs (#5692)
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
Co-authored-by: Akuli <akuviljanen17@gmail.com>
2021-06-28 10:29:17 -07:00
14d7431ff1 Recommend Self in CONTRIBUTING.md (#5699)
Part of #5676.

Co-authored-by: Akuli <akuviljanen17@gmail.com>
2021-06-27 23:17:28 +03:00
Dominic Davis-FosterandGitHub 58559e56b3 Use _typeshed.Self where __enter__ returns self (#5698) 2021-06-27 22:58:58 +03:00
1fb100dca4 Remove unused stubtest allowlist entries (#5697)
Co-authored-by: hauntsaninja <hauntsaninja@users.noreply.github.com>
2021-06-26 21:28:00 -07:00
Bas van BeekandGitHub 50f5858a56 Use SupportsIndex where applicable for 5 classes (#5694)
Use `SupportsIndex` where applicable:

* `str`
* `bytes`
* `bytearray`
* `memoryview`
* `markupsafe.Markup`
2021-06-26 19:05:40 +03:00
c522e8e53c contextlib.nullcontext is a class (#5695)
Co-authored-by: Akuli <akuviljanen17@gmail.com>
2021-06-26 08:19:03 -07:00