Commit Graph

3385 Commits

Author SHA1 Message Date
Bas van Beek
a1ca55037a Update the xxhash and hashlib stubs (#6031)
* `name`, `block_size`, `digest_size` and `digestsize` attributes of hash objects were made read-only.
* It is now a type-checking error to subclass `xxhash` classes, such as `xxhash.xxh32`. Previously it was an error only at runtime.
* `xxhash` functions now accept strings as input and any object with `__index__()` method for `seed` (instead of requiring an integer). They also fail the type checking if no arguments are given.
2021-09-14 12:01:11 +03:00
Sebastian Rittau
ca38856670 Fix set annotations in concurrent.futures._base (#6034) 2021-09-14 11:50:20 +03:00
Sebastian Rittau
b562d233ae (a)next only requires __(a)next__, not Iterator (#6036) 2021-09-14 11:43:21 +03:00
Screwtapello
4c6e98ed0c Add many missing tkinter type annotations (#6002)
Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
Co-authored-by: Akuli <akuviljanen17@gmail.com>
2021-09-12 11:42:12 +03:00
Shantanu
8576b344b8 binhex: removed in py311 (#6011) 2021-09-10 15:27:24 -07:00
Sander
7bfdacb4c4 stdlib/logging use object over Any for parameter types (#6025) 2021-09-10 16:04:32 +02:00
Akuli
e69ca588ac Stubs for ttkthemes (#6024) 2021-09-10 15:59:12 +02:00
Sebastian Rittau
9295c70ec0 'module' argument to ForwardRef.__init__() added in Python 3.9.7 (#6017)
Pin Python 3.9.7 for stubtest and update 3.10.0 to rc2
2021-09-10 01:10:28 +02:00
Sebastian Rittau
2f3964e24b Return ItemsView/KeysView from Mapping methods (#6014)
* Return ItemsView/KeysView from Mapping methods

* Make RawConfigParser compatible with Mapping
2021-09-09 07:37:26 -07:00
Bas van Beek
b9e1d7d522 Replace Mapping with types.MappingProxyType (#6013)
Mark `Signature.parameters` and `.return_annotation` as read-only properties
2021-09-09 09:58:53 +02:00
Bas van Beek
d599a535b2 Allow math.trunc to only accept __trunc__-supporting objects (#6003)
Add SupportsTrunc protocol
2021-09-04 18:16:53 +02:00
Anton Grübel
3819f8e6ff add missing functions in sys (#6001) 2021-09-04 16:30:13 +02:00
Andrew Svetlov
c0030b2b12 Fix msg parameter type for asyncio Future.cancel() and Task.cancel() (#5999) 2021-09-03 09:07:20 -07:00
HunterAP23
ffaa0ea3d1 Added initial rework of the concurrent.futures module (#5646)
* Added initial rework of the concurrent.futures module

* Minor fixes

* Fixed some generics & changed to collections over typing for some types

* Switched thread to use queues instead of multiprocessing.queues

* More fixes

* More fixes following results from running tests locally

* Tmp commit of changes

* Minor flake8 fix

* Fixing some issues

* Fixed a weakref.ref issue

* Fixed one more weakref issue

* Fixed some issues with required version

* Fixed more python min version requirements

* More min version fixes

* Fixed misc error in workflow regarded outdated pip

* Replaced any usage of Optional and Union with proper form as described in the contributions guide

* Fixed issue with using Callable definition

* Fixed last seen issues as per review

* Fixed some basic issues & more proper import calls

* Update stdlib/concurrent/futures/process.pyi

Co-authored-by: Sebastian Rittau <srittau@rittau.biz>

* Update stdlib/concurrent/futures/process.pyi

Co-authored-by: Sebastian Rittau <srittau@rittau.biz>

* Minor fixes

* More minor fixes

* Fixed up some issues & cleaned up imports

* Removed usage of Union

* Changed wait method to use Set of Future to work with mypy-primer for Optuna repo

* Reverted change to wait method and DoneAndNotDoneFutures class

* Fixed DoneAndNotDoneFutures again

Co-authored-by: Akuli <akuviljanen17@gmail.com>
Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
2021-09-03 13:06:48 +02:00
Anton Grübel
1af6810b5d Improve typing in zipfile (#5991)
* Improve typing in zipfile

* fix CR suggestions
2021-09-03 13:02:11 +02:00
Carl Meyer
003f916acd Add SymbolTableFactory to symtable stub (#5998)
This is not documented API, but AFAIR the typeshed policy is now that stubs should preferably reflect reality rather than solely documented API.

See https://github.com/python/cpython/blob/main/Lib/symtable.py#L21
2021-09-03 00:15:17 -07:00
Peter Law
425a35309a Relax DictWriter.fieldnames closer to implementation (#5994)
Fixes #5993
2021-09-02 20:17:30 +02:00
Anthony Sottile
f1e367851c Fix types of enum _member_names, etc. (#5986)
Move fields onto EnumMeta
2021-09-02 11:46:57 +02:00
Torsten Wörtwein
d4f0725452 BUG: typing.final supports properties (#5985)
Fixes #5984
2021-08-31 09:07:57 +02:00
Akuli
8d5452e873 do not use mypy-specific syntax in '# type: ignore' comments (#5953) 2021-08-29 03:58:34 -07:00
Shantanu
2d4fcbc81e zipfile: py310 changes, fix open (#5979)
Co-authored-by: hauntsaninja <>
2021-08-28 22:45:01 +02:00
Shantanu
ba998cd5f9 multiprocessing.pool: fix __init__ methods (#5833)
Co-authored-by: hauntsaninja <>
2021-08-28 12:04:08 -07:00
Anton Grübel
ac2ef6e8c9 Use paramspec in no_type_check_decorator (#5942) 2021-08-26 22:46:27 +03:00
Jon Dufresne
ac39a73d38 Add type for undocumented copyreg.dispatch_table (#5959) 2021-08-26 00:59:23 +02:00
Anders Kaseorg
65a88ace0a Add email.message.Message.__iter__ (#5960)
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2021-08-25 22:43:20 +02:00
Oleg Höfling
a74624d31b Introduce generic logger type in loggeradapter (#5954) 2021-08-25 05:45:56 -07:00
Ruben Opdebeeck
e567af01e5 Fix collections.UserString __reversed__ and __iter__ (#5958) 2021-08-25 15:27:20 +03:00
Alex Nelson
d34d047002 Add DOOR, PORT, and WHT type signatures for stat module (#5955)
Signed-off-by: Alex Nelson <alexander.nelson@nist.gov>
2021-08-24 21:22:24 +02:00
Anton Grübel
29c63e0d9c add ParamSpec to importlib.util (#5944) 2021-08-21 08:24:25 -07:00
Anton Grübel
2f499c7e90 add ParamSpec to trace.runfunc (#5940) 2021-08-20 10:46:34 +02:00
Niklas Gustafsson
918c7d0b84 Add ZipInfo type hint to members argument of ZipFile.extractall (#5936) 2021-08-20 10:43:45 +02:00
Anton Grübel
c54909ab69 Use ParamSpec for unittest.signals.removeHandler() (#5905) 2021-08-19 18:32:24 +02:00
wouter bolsterlee
757d962237 Improve ssl module annotations (#5934)
This improves the type annotations for the ‘ssl’ module:

- Various APIs taking file names (e.g. keyfile=, certfile=, cafile=,
  capath=, ...) were annotated as accepting only strings, while actually
  they accept str, bytes, and os.PathLike (such as pathlib.Path).
  CPython's _ssl.c module has always used PyUnicode_FSConverter to
  handle (normalize) these. Change the annotations accordingly using the
  internal _typeshed.StrOrBytesPath alias.

- Tighten the ‘purpose=’ argument in various functions to use the
  already defined ‘Purpose’ enum instead of accepting ‘Any’.
2021-08-18 08:23:31 -07:00
Nathan Naze
34b3f0bf7c Add missing attributes to IncompleteRead (#5933) 2021-08-17 21:27:09 -07:00
Jeremy Nation
0e62c8ab06 Add missing stub for _CursesWindow.noutrefresh (#5928) 2021-08-14 23:55:43 +02:00
Oleg Höfling
ff63953188 Switch to PEP-604 syntax in python2 stubs (#5915)
Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
2021-08-14 11:12:30 +02:00
Rebecca Chen
431c4f7fc1 Improve a few types in xml.dom.minidom. (#5923)
* Changes the return type of getDOMImplementation from implicit Any to
  DOMImplementation | None.
* DOMImplementation.createDocument() and createDocumentType() allow None for all arguments.
2021-08-13 23:28:47 +02:00
Rebecca Chen
774da45449 Add some missing properties to xml.dom.minidom.Node. (#5919) 2021-08-13 21:57:22 +02:00
jack1142
e415a7fad8 Make ChainMap's new_child() and parents return subclass (#5922) 2021-08-13 19:30:48 +02:00
Gabe Joseph
92aecadf6b Memoryview.cast: shape= can be tuple of any number of ints (#5918) 2021-08-13 00:04:35 +02:00
Anton Grübel
ae86a93f45 add ParamSpec to atexit (#5896)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2021-08-11 20:49:30 -07:00
Oleg Höfling
64f481189f drop ellipsis assignments from module vars, classvars and instance attrs (#5914)
Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
2021-08-11 19:26:58 +02:00
Sténio Jacinto
32a6257de0 Add missing stdlib xml stubs (#5895) 2021-08-09 22:41:55 +02:00
Akuli
9af9cca7f3 lowercase list and dict in the rest of stdlib (#5892) 2021-08-09 00:13:08 +02:00
Bas van Beek
7edad1034e Use a typevar in object.__new__ (#5891) 2021-08-08 20:45:22 +02:00
Hasan Ramezani
8b9d771b67 Add filters to stdlib/warnings.pyi (#5889) 2021-08-08 21:18:47 +03:00
Akuli
24780a3e03 imaplib, nntplib, plistlib, poplib: use lower-case list and dict (#5890) 2021-08-08 18:46:23 +02:00
Akuli
ce11072dbe Big diff: use lower-case list and dict (#5888) 2021-08-08 09:26:35 -07:00
Akuli
b1d1551bbc tkinter.Canvas: types for addtag_foo() and find_foo() methods (#5886) 2021-08-08 17:14:45 +03:00
Kyle Altendorf
4b77d454bd dataclasses: Allow Any keys for the metadata field (#5823) 2021-08-08 15:50:52 +02:00