Commit Graph

4647 Commits

Author SHA1 Message Date
Anton Grübel
af9b46a9a1 add missing type hints in http.cookiejar (#5797)
Co-authored-by: Akuli <akuviljanen17@gmail.com>
2021-07-22 16:21:36 +03:00
Vasily Zakharov
0baeef09a2 Fixed a bug in OpenSSL.crypto stub (#5796)
Co-authored-by: Vasily Zakharov <v.zakharov@wwpass.com>
2021-07-21 15:58:17 -07:00
Anton Grübel
966858fd4c add missing type hints in zipfile (#5795) 2021-07-20 18:23:19 +02:00
Anton Grübel
9f34ccd864 Add missing type hints in http.server (#5785) 2021-07-19 23:31:06 +02:00
Jukka Lehtosalo
2d3bde439e Stubs for mysqlclient (#5791) 2021-07-19 10:28:00 +02:00
Nipunn Koorapati
6d6250f109 Supported repeated field containers for extensions (#5788)
See https://github.com/dropbox/mypy-protobuf/issues/244 for the
inspiration for this. Repeated extensions are allowed by protobuf,
and they generate to extension values with repeated fields.

Notably map fields (ScalarMap and MessageMap) are NOT allowed to be
extension values - producing errors as such - so those are omitted.

testproto/test_extensions3.proto:19:6: Map fields are not allowed to be extensions.
2021-07-16 10:11:42 -07:00
Nipunn Koorapati
5199ed5bd8 Upper bound protobuf containers based on scalar/composite (#5787) 2021-07-15 22:28:16 -07:00
Jukka Lehtosalo
a0f199727b Stubs for psycopg2 (#5783) 2021-07-15 17:29:56 +02:00
Jukka Lehtosalo
937d31df69 Stubs for jsonschema (#5784) 2021-07-15 17:28:57 +02:00
Jukka Lehtosalo
6d7159c822 Stubs for prettytable (#5782) 2021-07-15 14:34:59 +02:00
Jukka Lehtosalo
2a4cc03307 Add stubs for jmespath (#5780) 2021-07-15 13:26:53 +02:00
Jukka Lehtosalo
b3b8daed2e Fix import sorting in create_baseline_stubs script (#5781)
Run isort before black since changes made by isort don't follow stub
conventions.
2021-07-15 13:24:46 +02:00
Jukka Lehtosalo
e2fe224b52 Stubs for psutil (#5776)
I generated these using stubgen and made various manual tweaks to fix issues
reported by stubtest.

Some of the submodules with underscore prefixes are used by open source code,
so I'm including them.

Various definitions are platform-specific. I added some sys.platform checks, but
it's hard to get these right. We may need to iterate on them later.
2021-07-15 11:37:53 +01:00
Jukka Lehtosalo
d85c54dc47 Add simple tool for creating baseline stubs (#5777)
This tool is a simple wrapper around stubgen and other tools that simplifies the
creation of "baseline" stubs with minimal annotation coverage. These stubs allow
basic type checking (e.g. number of arguments, whether X is valid as a base class),
and once we have baseline stubs, it's easy to contribute incremental changes that
add type annotations.

Here's a summary of what the tool does:
1. Check that the package is installed
2. Run stubgen
3. Copy generated stubs to the correct directory under `stubs/`
4. Run black
5. Run isort
6. Generate basic metadata with correct package version
7. Update pyright exclusions (needed since there are missing types)
8. Print suggestions about next steps needed to contribute stubs to typeshed

For example, to generate stubs for `iso8601`, you can run it like this:
```
python scripts/create_baseline_stubs.py iso8601
```

Sometimes the project name is different from the runtime package name. In
this case run the tool with `--package <runtime-package>`.
2021-07-15 11:22:28 +01:00
Sebastian Rittau
ad3f0c8e34 Allow non-types dependencies (#5769)
Remove the check in check_consistency that ensures that only other
type packages from typeshed are being depended on. Instead, add an
explanation to CONTRIBUTING that spells out the requirements. This
adds a higher, but reasonable burden on maintainers to check the
dependencies manually.

Part of #5768
2021-07-14 14:29:53 +02:00
Vanessa Ung
607aa37ee9 Babel stubs (#5775)
Basic stubs made with stubgen & manual fixes. Also, reorder 
pyrightconfig.stricter.json, I didn't realise it was mostly ordered 
when I added to it previously.
2021-07-14 09:24:19 +01:00
Nipunn Koorapati
4765978f6c Support arbitrary values for extension values (#5774)
Proto itself supports primitives, not just messages.
See https://github.com/dropbox/mypy-protobuf/issues/244 for an example
motivating this change.

Test Plan: I was able to use MYPYPATH to test an updated version of
mypy-protobuf with this change.
2021-07-13 21:13:45 -07:00
Shiva Raisinghani
0cd4ee39a2 Stubs for stripe (#5770)
A library that provides convenient access to the Stripe API from applications. 
It includes a pre-defined set of classes for API resources that initialize themselves 
dynamically from API responses.

I started with stubgen, then cleaned up to address missing functions. Testing plan 
is to keep an eye on CI and fix any issues that arise.
2021-07-13 15:11:27 +01:00
Vanessa Ung
80f61d2209 Stubs for oauthlib (#5766)
This was generated with stubgen, with a touch of manual intervention to clean up and 
have it pass tests.
2021-07-13 09:54:50 +01:00
Shiva Raisinghani
ce94e8bba6 Add stubs for slumber (#5764) 2021-07-12 21:03:08 +02:00
Sebastian Rittau
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 Rittau
7c382c7cd8 Run mypy tests for stdlib and third-party separately (#5760) 2021-07-12 10:09:13 +02:00
Jelle Zijlstra
7f320c6b9e Stubs for beautifulsoup4 (#5758)
Stubgen and manual fixes, don't bother with Python 2
2021-07-11 17:02:51 +03:00
Akuli
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 Zijlstra
a90573feb2 tornado: add some types, set version (#5742) 2021-07-11 13:17:40 +02:00
Jelle Zijlstra
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 Koorapati
42eec29eed Update proto stubs with latest mypy-protobuf 2.6 (#5753) 2021-07-10 17:10:39 -07:00
Nipunn Koorapati
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 Rittau
8d12d6f468 Use vobject stubs in caldav (#5749) 2021-07-09 16:57:16 +03:00
Bas van Beek
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
Nsukami _
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
kasium
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 Rittau
aca5952361 Wrap vobject.win32tz in platform check (#5747) 2021-07-09 11:32:57 +02:00
Nipunn Koorapati
c5dd23ac0d Allow unicode and bytes in EnumTypeWrapper.Value (#5743) 2021-07-09 11:22:38 +02:00
Akuli
fdf073627c maybe fix stubtest (#5746)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2021-07-09 12:06:26 +03:00
Sebastian Rittau
a7446632f7 Add third-party vobject stubs (#5733) 2021-07-08 18:26:24 -07:00
Sebastian Rittau
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
Thomas Grainger
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übel
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
opsyne
9d5046ee7f polib: fix ordered_metadata return type (#5735)
Also update version in METADATA.toml.
2021-07-07 19:07:17 +02:00
Akuli
42247feefb use Self in async context managers (#5724) 2021-07-06 08:47:49 +02:00
Peter Pentchev
ff2b92f340 pathlib2: most of the methods support the "unicode" type. (#5727)
Closes: #5726
2021-07-05 12:47:18 +02:00
Unrud
2ee7b1346b Replace IO[str] with IO[bytes] in urllib.request (#5728) 2021-07-05 09:41:59 +02:00
Josh
2b497f7227 importlib.util.resolve_name package argument accepts None (#5730) 2021-07-05 09:21:40 +02:00
Anton Grübel
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 Raab
1a131a489e [UserList]: Return type for slice is set to whatever self is (#5722) 2021-07-02 21:20:17 +02:00
Anton Grübel
de19554dcc Add json.py_encode_basestring stubs (#5720) 2021-07-02 11:18:35 +03:00
Anton Grübel
8a107464a8 Use _typeshed.Self with __enter__ (#5719) 2021-07-01 23:15:13 +02:00
Anton Grübel
96e0660fba Use _typeshed.Self with __enter__ (#5717)
Co-authored-by: Akuli <akuviljanen17@gmail.com>
2021-07-01 12:32:32 +02:00
Shantanu
04f0113d16 dataclasses: work around default factory issues (#5718) 2021-07-01 08:07:00 +02:00