Commit Graph

5645 Commits

Author SHA1 Message Date
Nikita Sobolev
c42bfc5710 Add __all__ to runpy (#7140) 2022-02-05 20:23:47 +02:00
Alex Waygood
348c38a0dd Improve __all__ definitions for threading and _dummy_threading modules (#7135) 2022-02-05 08:07:02 -08:00
Nikita Sobolev
bdef0a70a6 Improve sched typings (#7138) 2022-02-05 07:36:43 -08:00
Alex Waygood
287c8c3d79 Add __all__ to copyreg stubs (#7137) 2022-02-05 07:28:15 -08:00
Alex Waygood
004f12a1eb Add __all__ to _osx_support (#7136) 2022-02-05 07:27:01 -08:00
Jelle Zijlstra
c1e3be1248 zip.__iter__ and reversed.__iter__ return self (#7123) 2022-02-05 15:53:29 +02:00
Sebastian Rittau
7179fee2d8 is_zipfile() also accepts bytes paths (#7106)
Use a protocol for is_zipfile(), instead of IO
2022-02-04 21:27:02 -08:00
Stephen Rosen
38d32a916c Use enum trick for dataclasses.MISSING (#7127)
The goal of this change is to fix the behavior of
`dataclasses.Field`. Several attributes of a `Field` may have a value
of `MISSING` (a sentinel value). As a result, attributes of Field may
be checked against `MISSING` as in

     [f for f in fields(obj) if f.default is MISSING]

`default`, `default_factory`, and `kw_only` are the attributes
which may have a value of `MISSING`.

This workaround of defining `_MISSING_TYPE` as an enum, and `MISSING`
as its only member, allows `... | Literal[_MISSING_TYPE.MISSING]` to
be used in type annotations for these attributes. This is very
slightly inaccurate -- primarily in that `_MISSING_TYPE` isn't really
an enum -- but this allows for use in `Literal`.
After PEP 661 (Sentinel Values), there may be a more accurate way of
writing this, but for now this works.

This adjustment is only applied to the attributes of Field, not the
arguments to functions and methods.
2022-02-04 21:21:12 -08:00
Nikita Sobolev
819f8dfc10 Improve ipaddress module (#7129) 2022-02-04 21:19:34 -08:00
Eric Traut
90695fadd1 Updated pyright to latest version (#7132) 2022-02-04 21:09:00 -08:00
Eric Traut
7dc5bed72c Changed typing_extensions.pyi to declare its own private version of Protocol (#7133)
Changed typing_extensions.pyi to declare its own private version of `Protocol` and `runtime_checkable` rather than re-exporting the symbols imported from `typing`. This allows pyright to warn users about runtime exceptions when they attempt to use typing.Protocol on versions of Python prior to 3.7.
2022-02-04 21:02:58 -08:00
Alex Waygood
1371a1e1fe unittest deprecations have been deferred until 3.12 (#7131)
See https://github.com/python/cpython/pull/30935
2022-02-04 15:52:30 -08:00
Aaron Sykes
ebcdcfa24e Makes DESCRIPTOR non nullable again (#7125)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-02-04 22:05:58 +02:00
Alex Waygood
51cdd2c6be Backport many Self-related changes to the Python-2 stdlib (#7128) 2022-02-04 10:10:05 -08:00
Thomas Grainger
57b2bae031 correct asyncio.locks._ContextManagerMixin and _ContextManager types (#7124)
Co-authored-by: Akuli <akuviljanen17@gmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2022-02-04 18:30:55 +02:00
Thomas Grainger
4e67419b1f most asyncio lock methods always return True (#7122) 2022-02-04 11:18:17 +02:00
Shantanu
4d21d5a87d codecs: allow str to bytes decoding for "hex", fix overloads (#7118)
Fixes #7115

Co-authored-by: hauntsaninja <>
2022-02-03 14:20:11 -08:00
Roman Joost
fc60d02c3e Fix mistyped get_by_id class methods (#7120)
The types for these class methods were mixed up. The async method
returned an optional `Model`, while the synchronous method returned a
`Future`. It's the other way around.

Fixes #7103
2022-02-02 15:59:02 -08:00
Alex Waygood
26e8959279 Use _typeshed.Self in docutils.VersionInfo and os.sched_param (#7117) 2022-02-02 23:30:39 +01:00
PabloLION
0ccbc29919 fix: enable encode/decode from/to hex string (#7115) 2022-02-02 23:05:16 +01:00
Alex Waygood
15d76b072a Improve classmethods in paramiko stubs (#7113) 2022-02-02 22:15:26 +01:00
Alex Waygood
b4e97a1909 Improve __enter__ & constructor methods (#7114) 2022-02-02 22:14:59 +01:00
Alex Waygood
7ccbbdb30a stdlib: Improve many __iter__ and constructor methods (#7112) 2022-02-02 19:14:57 +01:00
klaerik
b327f64d9a Add iterable and ServerPool types to ldap3 Connection.server parameter (#7101) 2022-02-02 18:59:53 +01:00
Alex Waygood
27c7aece10 Update asyncio.trsock to reflect methods removed in 3.11 (#7110)
* Update `asyncio.trsock` to reflect methods removed in 3.11

These were all removed in https://bugs.python.org/issue43232

* [pre-commit.ci] auto fixes from pre-commit.com hooks

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-02-02 09:44:26 -08:00
Alex Waygood
806c26045e Improve itertools stubs (#7109)
There are quite a few `__iter__` methods in `itertools` that return `self` at runtime. They should do so in the stubs as well.

Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
2022-02-02 08:37:41 -08:00
Alex Waygood
f50255025a calendar.different_locale.__enter__ returns None, not _LocaleType (#7108) 2022-02-02 16:28:18 +01:00
Sebastian Rittau
2dc53caffe Improve abc module and builtin function decorators (#5703) 2022-02-02 16:22:32 +01:00
Alex Waygood
584336a41e Fix several methods that should be async def, but aren't (#7107) 2022-02-02 15:18:14 +01:00
Nikita Sobolev
1b99812621 Require coroutines for create_task() (#6779) 2022-02-02 13:35:00 +01:00
Nikita Sobolev
970b8a676c Use async def instead of def ... -> Awaitable in typing (#7105) 2022-02-02 13:14:08 +01:00
Nipunn Koorapati
90f5422df7 Add/fix types to a bunch of non-generated protobuf files (#7017) 2022-02-02 12:30:39 +01:00
Ilya Kulakov
f2ce1d1d21 bisect: insort_* expects x to match type of elements of a (#7102) 2022-02-02 12:21:11 +01:00
Rajiv Bakulesh Shah
beac964588 Redis: Annotate .lolwut() (#7104) 2022-02-02 11:18:11 +01:00
Gabe R
7e053ac5bd Add some missing type hints to tkinter (#6359)
Co-authored-by: Akuli <akuviljanen17@gmail.com>
2022-02-02 10:29:11 +02:00
Alex Waygood
3e6375e606 Delete commented-out pydoc.Scanner class (#7100) 2022-02-01 19:46:51 +02:00
Alex Waygood
023e21dedf Delete SupportsAnyComparison type in _typeshed (#7098) 2022-02-01 14:32:20 +01:00
Sebastian Rittau
54fde0c2a1 Improve protocol return types (#7093)
* Dunder comparisons must return bool.
* write() return type should be ignored.
* Use custom comparison protocols in _operator.pyi
2022-02-01 08:59:07 +01:00
Ilya Kulakov
587d15a9bc bisect: fix type of x when key is present (#7097) 2022-01-31 17:49:58 -08:00
Alex Waygood
f86f096e1c Use literal types in lzma (#7095) 2022-01-31 10:46:26 -08:00
UncleOwen
8631ed9e57 requests.Session: Accept hooks and lists of hooks (#7094) 2022-01-31 11:29:05 +01:00
Sebastian Rittau
cb3c1bb638 Replace IO with protocols (#7092) 2022-01-31 11:39:56 +02:00
Rajiv Bakulesh Shah
064317a72e Redis: Annotate .pttl(), .dump(), and .getdel() (#7091) 2022-01-31 08:30:46 +01:00
Jelle Zijlstra
2b72dea679 Allow ExitStack.push callbacks to return None (#7090) 2022-01-31 08:21:32 +01:00
Shantanu
b88a6f19cd Upgrade black version (#7089) 2022-01-30 16:27:06 -08:00
Nikita Sobolev
9854926289 function argument in shutil.register_unpack_format must be Callable (#7083) 2022-01-30 11:29:36 -08:00
D. Spindel
136592666b FileFinder takes a class, not an instance (#7085) (#7086)
The FileFinder takes a tuple of (class, arguments) to instantiate for
each time, rather than an existing instance.

Fixes #7085
2022-01-30 08:44:01 -08:00
Nikita Sobolev
1a71371dda Use dbm._TFlags in shelve.open (#7084) 2022-01-30 14:05:52 +01:00
Jelle Zijlstra
3b29006a3e email.generator: Use protocols instead of TextIO/BinaryIO (#7082) 2022-01-30 14:02:11 +01:00
Alex Waygood
45a2dad83c Reduce use of Any in equality methods (#7081)
Co-authored-by: Akuli <akuviljanen17@gmail.com>
2022-01-30 00:59:00 +02:00