Commit Graph

4749 Commits

Author SHA1 Message Date
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
Alex Waygood
8e718d4891 pstats: delete outdated comment (#8738)
The annotation in CPython was fixed thanks to @ruancomelli in https://github.com/python/cpython/pull/96741!
2022-09-15 11:24:30 +01:00
Alex Waygood
a6c174cc7b Add new sys functions introduced to combat CVE-2020-10735 (#8733)
Co-authored-by: Akuli <akuviljanen17@gmail.com>
2022-09-13 16:01:26 +01:00
shawnbrown
266aa3b6ca sqlite3: allow passing None for the func parameter of create_function (#8728) 2022-09-12 12:47:54 +03:00
Nikita Sobolev
4905074919 tarfile.TarFile: mark OPEN_METH as a ClassVar (#8725) 2022-09-11 14:32:52 +01:00
Nikita Sobolev
d987f92e55 string.Template: Make several attributes ClassVars (#8724) 2022-09-11 14:29:31 +01:00
Ruan Comelli
04a88d5740 pstats.FunctionProfile.ncalls should be str (#8712)
Correctly annotate `pstats.FunctionProfile.ncalls` as `str` instead of `int`.

Since this change introduces a difference between typeshed and CPython, add a comment pointing that out and linking to this PR.

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2022-09-10 21:11:45 +01:00
Jukka Lehtosalo
e4d0d3d9d7 Make the return type of multiprocessing.connection.Pipe more precise (#8706)
The precise return type depends on the platform. Link to implementation:
68fb03249f/Lib/multiprocessing/connection.py (L518)

Now users no longer need to use the internal-looking class
`_ConnectionBase` in annotations, at least in code that doesn't
need to be cross-platform.
2022-09-08 13:24:49 +01:00
J. Sebastian Paez
cc7d2567f2 Add _ExtendAction to argparse (#8701)
_ExtendAction was added to argparse since python 3.8.

Reference of the addition to the standard library:
python/cpython@aa32a7e
2022-09-07 21:53:35 +01:00
Jakub Kuczys
81f8a10e9b Update traceback.clear_frames() to accept None (#8695)
`Exception.__traceback__` can potentially be None so for convenience
(and because the simplest way of implementing it will allow it anyway),
traceback.clear_frames() allows None.
2022-09-06 12:26:15 -07:00
Nikita Sobolev
d5d4bbbe7c Use ClassVar for class-level attributes in calendar (#8691)
Source: f177f6f29b/Lib/calendar.py (L418-L436)
2022-09-06 10:14:56 +01:00
James Hilton-Balfe
61831c0164 Add some undocumented constants to gzip.pyi (#8675)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2022-09-03 12:04:48 +01:00
James Hilton-Balfe
1195bbaf33 Make Struct.size and format read-only properties (#8670)
attribute 'size' of '_struct.Struct' objects is not writable
2022-09-02 14:50:47 +01:00
Pierre Riandey
70d76ecf8f Add types for unittest.loader.TestLoader._match_path (#8669) 2022-09-02 09:55:24 +02:00
Alex Waygood
3e5808a990 Bump flake8-pyi and pytype test dependencies (#8656) 2022-08-31 12:20:11 +01:00
Alex Waygood
601700d1a5 Improve some tkinter unions (#8655) 2022-08-31 13:05:51 +03:00
Anh71me
1dd533acc0 stdlib/_ast.pyi: Fix ast.ImportFrom arg module _identifier to str (#8648) 2022-08-30 12:18:28 +02:00
junkmd
1c6eb33c23 add and migrate constants from ctypes/__init__.pyi to _ctypes.pyi (#8643)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Akuli <akuviljanen17@gmail.com>
2022-08-29 15:33:47 +01:00
Kevin Kirsche
2c7ac0990f Remove ssl.SSLContext.__init__ (#8640)
Fixes: #8632
2022-08-29 13:07:59 +01:00
Nikita Sobolev
6e985ef3de stdlib mapping classes: Use better names for various pos-only parameters (#8637) 2022-08-28 23:29:00 +01:00
Nikita Sobolev
6d5fd0e290 Allow passing tuples to ipaddress.ip_network (#8634) 2022-08-27 18:38:26 +01:00
Jason Heiss
d1d9b98aff imaplib.Time2Internaldate also takes datetimes and 9-element tuples (#8630)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2022-08-27 16:11:26 +01:00