Commit Graph

5420 Commits

Author SHA1 Message Date
Nikita Sobolev d3a87eb45d Improve types and bytes usage of pathlib (#9016) 2022-10-28 21:45:41 +02:00
Shantanu 093c58bfa2 ast: parse accepts PathLike filename (#9020) 2022-10-28 11:18:38 -07:00
Jelle Zijlstra 05acb6c5c3 _msi: improve types (#9008) 2022-10-28 15:36:57 +02:00
Jelle Zijlstra 287fce4872 ssl, socket, array: Improve bytes handling (#8997) 2022-10-28 15:35:51 +02:00
Jelle Zijlstra bcd876f77e _codecs: Fix buffer parameters (#9003) 2022-10-28 11:25:21 +02:00
Jelle Zijlstra f792b14e7f _tcl: fix bytes usage (#9010) 2022-10-28 11:07:56 +02:00
Jelle Zijlstra cb90e9d3a5 bz2: fix bytes parameters (#9015) 2022-10-28 11:01:03 +02:00
Jelle Zijlstra 97d8519f33 base64: fix a85decode param type (#9014) 2022-10-27 21:07:10 -07:00
Jelle Zijlstra 6438c7355c _winapi: takes a ReadableBuffer (#9011) 2022-10-27 20:24:45 -07:00
Jelle Zijlstra e8e69efd2b antigravity: takes a ReadableBuffer (#9012) 2022-10-27 20:19:24 -07:00
Jelle Zijlstra 51c92d8975 _posixsubprocess: improve types (#9009) 2022-10-27 20:00:21 -07:00
Jelle Zijlstra e0aa539854 _curses: improve bytes handling (#9007) 2022-10-27 19:48:08 -07:00
Jelle Zijlstra 5bcd4c1a93 ast: parse takes a ReadableBuffer (#9002)
parse() is basically just a wrapper around compile(), which we
already have as taking ReadableBuffer.
2022-10-27 13:28:02 -07:00
Alex Waygood 8d941f0e53 Remove unnecessary pyright: ignore (#9000) 2022-10-27 08:27:28 -07:00
Jelle Zijlstra 739711e947 lzma: Takes ReadableBuffer, not bytes (#8996) 2022-10-27 07:02:57 -07:00
Shantanu 86ada9e41a io: use ReadableBuffer for BytesIO (#8995) 2022-10-27 11:42:11 +02:00
LeeeeT cf9bdc2d98 Make the first argument of float.__new__ positional-only (#8991)
Closes #8990
2022-10-26 15:42:17 -07:00
Nikita Sobolev 5bbba5d008 Collection is Sized (#8977) 2022-10-25 06:08:28 -07:00
Alex Waygood 8b9b96c9f8 datetime.timedelta: Remove explicit inheritance from SupportsAbs (#8972)
Fixes #8971
2022-10-23 15:28:44 -07:00
Nikita Sobolev 327ae91627 ValuesView is a Collection, not Iterable (#8953)
See https://github.com/python/cpython/issues/98500 and https://github.com/python/cpython/blob/49f61068f49747164988ffc5a442d2a63874fc17/Lib/_collections_abc.py#L893
2022-10-21 09:47:44 -07:00
Nikita Sobolev 7ed599e848 Remove parts of tkinter from pyright exclude (#8958) 2022-10-21 19:18:04 +03:00
Stanislav Zmiev ae34688034 Add pathlib.Path.walk() (#8921) 2022-10-18 21:22:08 +01:00
Jelle Zijlstra 1b04ef2673 bytes, bytearray constructors: support buffers (#8924) 2022-10-18 19:20:20 +01:00
Alex Waygood 928f006318 typing.pyi: Improve comments for IO/TextIO (#8913)
#8726 proposed to make these properties abstract, but it would have broken half the typed-Python ecosystem, and we've since decided that it's not worth taking action on this (https://github.com/python/typeshed/issues/2146#event-7450564547). This PR rephrases the comments to make clear that there isn't really anything actionable that can be done here.
2022-10-17 12:44:40 +02:00
Nikita Sobolev e6682a5fa7 Remove ABCMeta from tzinfo (#8910) 2022-10-17 09:12:52 +01:00
Nikita Sobolev 9c5a588078 datetime.tzinfo is abstract (#8908) 2022-10-16 16:20:31 -07:00
Nikita Sobolev ce4668a132 Use Incomplete instead of Any in __getattr__ (#8903) 2022-10-15 18:54:21 +01:00
Nikita Sobolev e6b00f1eb6 pydoc.ispath is a TypeGuard (#8899) 2022-10-14 22:36:07 +01:00
Anton Grübel ccd468fd86 urllib.parse: extend unquote type hint and replace _Str with str | bytes (#8877) 2022-10-13 20:54:07 -07:00
Candy a702daa631 Fixed ctypes pointer typing errors (#8880) 2022-10-13 20:18:00 -07:00
Allison Karlitskaya c88c9dd18d asyncio: fix SubprocessTransport.send_signal return type (#8890) 2022-10-13 13:17:48 +02:00
Shantanu 33e1a34e3c subprocess: use narrower types for TimeoutExpired.std* (#8886)
See https://github.com/python/cpython/pull/97685

The union type should be acceptable given https://github.com/python/cpython/issues/87597#issuecomment-1207402415. In general I'd like us to be able to type this, since these being bytes can be surprising if you pass text=True, but we'll see what mypy_primer says
2022-10-11 21:20:44 -07:00
Marc Mueller 93075bf2fc Use general type ignore for asyncio.Task (#8861) 2022-10-07 02:51:14 +01:00
Marc Mueller f5369536b9 Update for typing_extensions 4.4.0 (#8821)
* TypeVarLike default parameters (PEP 696)
* TypeVarLike auto_inference parameter (PEP 695)
* Add typing_extensions.override (PEP 698)
* Add typing_extensions.Any

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-10-06 16:17:57 -07:00
Nikita Sobolev 1459adcac5 ZoneInfo.clear_cache can have Optional input (#8856) 2022-10-06 13:38:52 +02:00
Nikita Sobolev 6e84b56016 Add metaclasses for string.Template and dataclasses.InitVar (#8852) 2022-10-05 14:41:24 -07:00
Sam Bull 493e35b15e Make asyncio.Task covariant (#8781) 2022-10-03 14:44:59 -07:00
Alex Waygood 78ca9c7390 Bump mypy to 0.982 (#8831) 2022-10-03 10:34:44 -07:00
Nikita Sobolev 380022c650 Remove empty __init__ methods (#8816) 2022-09-30 13:08:41 +01:00
Alex Waygood deff426b6f Fix multiprocessing.DictProxy.values() (#8815)
Fixes #8814
2022-09-30 13:37:53 +02:00
Akuli 11a14f58a3 Delete builtins._StandardError (#8806) 2022-09-29 09:32:11 +01:00
Nikita Sobolev 133e2d860d Use Mapping instead of dict in inspect.py (#8803) 2022-09-28 08:39:21 -07:00
Klas Eskilson 26ea6b8b4d Add __init__ definition for AttributeError (#8801)
Since Python 3.10, AttributeError supports keyword arguments for name
and obj.
2022-09-28 13:22:10 +01:00
layday 40223373db Update importlib.resources types (#8658)
* Replace `Str[OrBytes]Path` with `str`

A filesystem path is not valid as an abstract resource.

`TraversableResources` cannot only accept strings if `ResourceReader`
accepts both bytes and strings.  `importlib.resources` does not work
with bytes in any case and `ResourceReader` is typed as taking
a `typing.Text` object in `importlib.resources`' source code.

* Update `joinpath` signature from Python 3.11
2022-09-27 20:31:33 +01:00
Alex Waygood 48e76e8a56 Bump mypy to 0.981 (#8796) 2022-09-26 17:14:33 -07:00
Shantanu 2969922b68 Fix intransitive subtyping issue with SupportsGetItem (#8785)
See https://github.com/python/mypy/issues/13713 for details
2022-09-23 13:25:15 -07:00
Shane Harvey 1a2914adc5 Use Callable[..., Any] instead of Callable[..., object] in unittest (#8399) 2022-09-21 13:46:38 +01:00
François Conzelmann 7eb277e451 Add type to some asyncio.transports methods (#8756)
`WriteTransport.write`, `WriteTransport.writelines` and `DatagramTransport.sendto` methods only accept `bytes` trying an other type raises an exception

`BaseTransport._extra` is a dictionary with string as key
2022-09-20 19:14:59 -07:00
Chris Cotter 1a3ae3efc7 socket: sendmsg can accept None for the address (#8771)
Per the Python docs and socketmodule.c source, the address argument can
be None.

https://docs.python.org/3/library/socket.html#socket.socket.sendmsg
2022-09-20 14:15:47 +01:00
Alex Waygood 20bc8fa4e3 Fix stubtest errors on macOS / Python 3.11 (#8743) 2022-09-15 15:27:42 -07:00