Commit Graph

86 Commits

Author SHA1 Message Date
Nikita Sobolev
64bc0590a6 Remove un-needed __hash__ methods from stdlib (#8465) 2022-08-06 14:55:27 +01:00
Alex Waygood
ea7bbbdad7 Move Match and Pattern to re.pyi; move ContextManager protocols to contextlib.pyi (#8447) 2022-07-31 15:27:47 +02:00
Sebastian Rittau
91fd79c158 Updates for Python 3.11.0b4 (#8288) 2022-07-13 13:10:20 +02:00
Sebastian Rittau
faae950ade Use error codes for type ignores (#8280)
Disable reportSelfClsParameterName for pytype as this is out of typeshed's
control

Closes: #7497
2022-07-12 20:15:49 +02:00
Alex Waygood
edc0ecd857 Remove Python 3.6 branches from typeshed (#8269) 2022-07-11 10:55:17 +02:00
KotlinIsland
35a59f6aa7 typing.AwaitableGenerator: add type_check_only (#8115) 2022-06-20 21:01:09 -07:00
Alex Waygood
1be5918baa Use _typeshed.IdentityFunction more consistently (#8063) 2022-06-12 16:56:14 -07:00
Alex Waygood
e7a5b7a762 Fix various __all__-related errors and omissions (#8031) 2022-06-07 23:29:55 +01:00
Sebastian Rittau
214bf15dce Use "all +=" instead of duplicating the branches (#7865) 2022-06-07 13:32:19 +02:00
Jelle Zijlstra
c8a978f756 typing: Add dataclass_transform (#7690)
python/cpython#91861
2022-04-25 22:06:32 -06:00
Jelle Zijlstra
02e0c98d62 Buffer support for re (#7679) 2022-04-23 18:28:35 -07:00
Alex Waygood
7ce4607dee Upgrade flake8-pyi to 22.4.0, enable Y026 in .flake8 config (#7650) 2022-04-17 01:23:35 +01:00
Jelle Zijlstra
bedf520d76 typing(_extensions) updates for 3.11 (#7643) 2022-04-16 21:42:12 +02:00
Alex Waygood
1ceb486b75 Replace Union with union operator (#7596) 2022-04-05 23:07:31 +02:00
Alex Waygood
5c44ae4f8c Improve various signatures that shouldn't be async def, but currently are (#7491)
Co-authored-by: Thomas Grainger <tagrain@gmail.com>
2022-03-18 20:54:39 -07:00
Jelle Zijlstra
4d23919200 Add typing.TypeVarTuple, Unpack, assert_type (#7501)
python/cpython#31021 and python/cpython#30843.
2022-03-18 18:03:45 +00:00
Jelle Zijlstra
9c50fe7b64 Fix overly precise typing.NewType signature (#7474)
`type` is incorrect because `NewType` can also accept another `NewType`: https://peps.python.org/pep-0484/#newtype-helper-function

The return type was also wrong; pre-3.10 `NewType()` doesn't return a type object.
2022-03-11 06:35:45 +00:00
Aaron Kau
a3e62d56fc change Change IO/IOBase.__exit__ return type to None (#7471) 2022-03-10 15:57:05 +01:00
Alex Waygood
f4ae363b56 stdlib: correct many pos-or-kw arg names in dunder methods (#7451) 2022-03-07 16:40:03 +01:00
Alex Waygood
947724a5cb stdlib: Add several missing @abstractmethod decorators (#7443) 2022-03-06 16:41:13 -08:00
Alex Waygood
bc72b25a2a Make more miscellaneous fields read-only, annotate _json.make_encoder (#7439) 2022-03-06 15:41:49 -08:00
Alex Waygood
3bbc36c92d Add two missing ForwardRef attributes (#7402)
These look somewhat like implementation details, but no more so than any of the other dunder attributes that are already on the class.
2022-02-28 21:44:28 -08:00
Alex Waygood
6a743348ca Add __all__ for most modules beginning with 't' (#7373) 2022-02-23 18:25:28 -08:00
Shantanu
0eb6baa663 typing: don't accidentally use typing.Self (#7318)
We can switch to it when all type checkers have support

Co-authored-by: hauntsaninja <>
2022-02-19 19:53:30 -08:00
Alex Waygood
1091521f60 stdlib: Add several missing __(deep)copy__ methods (#7242) 2022-02-16 18:57:41 -08:00
Alex Waygood
5e8a2a9364 Fix various pos-only stubtest complaints previously allowlisted (#7228) 2022-02-15 17:51:34 +01:00
Shantanu
a6d9b83263 Add @final to several more stdlib classes (#7215)
Co-authored-by: hauntsaninja <>
2022-02-14 15:12:40 -08:00
Jelle Zijlstra
7dd2485269 New additions to typing, typing_extensions (#7169) 2022-02-08 22:40:09 -08:00
Joshua Bronson
9a257c18bb Add missing type hint for AbstractSet._hash(). (#7153) 2022-02-08 06:18:52 -08:00
Alex Waygood
398a5807a1 Return Self from MutableSequence.__iadd__ (#7162) 2022-02-08 06:15:37 -08:00
Alex Waygood
b1b3471c76 Improve in-place BinOp methods for sets (#7161) 2022-02-08 14:57:50 +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
970b8a676c Use async def instead of def ... -> Awaitable in typing (#7105) 2022-02-02 13:14:08 +01:00
Shantanu
b88a6f19cd Upgrade black version (#7089) 2022-01-30 16:27:06 -08: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
Alex Waygood
99cec2d16b Reduce duplication of code between typing and typing_extensions (#7075) 2022-01-29 07:44:42 -08:00
Alex Waygood
7e79706ddd Clarify why some module-level objects in typing have default values (#7037) 2022-01-28 17:38:25 -08:00
Sebastian Rittau
b87ebc5375 Don't use a literal for TYPE_CHECKING (#7062)
Partly addresses #7061
2022-01-27 23:51:22 -08:00
Alex Waygood
dbb5488b31 Do not use True or False as default values in assignments (#7060) 2022-01-27 13:51:36 -08:00
Alex Waygood
5d07ebc864 Use PEP 585 syntax in typing and typing_extensions, and remove module-level defaults where possible (#7036) 2022-01-25 16:13:36 +01:00
Akuli
a22ca2ec51 make the default positional-or-keyword in Mapping.get and MutableMapping.pop (#6694) 2022-01-22 07:19:01 -08:00
Jelle Zijlstra
1f000d2881 Improve type for setdefault() (#6941)
- With one argument, it may return None
- With two arguments, it returns the default's type or the dict's value type.
- Also remove incorrect `= ...` from `pop()`. The one-argument case has its own overload.

Context: https://github.com/python/typing/discussions/1033#discussioncomment-1986359

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2022-01-19 21:44:15 -08:00
Alex Waygood
2170693e11 Add various __*or__ methods, and improve dict.__ior__ (#6961) 2022-01-19 12:24:16 +01:00
Jelle Zijlstra
ea93779c92 Fix TypeVar argument annotations (#6943)
Arguments like bound= accept type forms like unions, which are not themselves types.
2022-01-18 00:14:40 -08:00
Alex Waygood
af8e37d273 Add # noqa comments to typing.AnyStr (#6925)
Co-authored-by: Akuli <akuviljanen17@gmail.com>
2022-01-16 14:23:22 +02:00
Alex Waygood
96c9abb058 Always use _typeshed.Self, where applicable (#6880)
* Always use `_typeshed.Self`, where applicable

* Revert changes to `google-cloud-ndb` (ambiguous)

* Remove empty line added by script

* Revert changes to `stubs/python-dateutil/dateutil/relativedelta.pyi`

* Manually add a few more that the script missed

* Improve `filelock` annotation

Source code here: 79ec7b2826/src/filelock/_api.py (L207)

* Improve `opentracing/scope` annotation

Source code here: 3e1d357a34/opentracing/scope.py (L71)

* Improve `redis/client` stub

Source code here: 15f315a496/redis/client.py (L1217)

* Improve `redis/lock` annotation

Source code here: 15f315a496/redis/lock.py (L155)

* Improve `requests/models` annotation

Source code here: d718e75383/requests/models.py (L653)
2022-01-09 19:16:19 -08:00
Alex Waygood
4e046163b5 Delete many redundant method redefinitions (#6877) 2022-01-09 11:21:03 -08:00
Sebastian Rittau
f4ce1ebaf8 Use positional-only arguments for IO (#6851) 2022-01-08 20:49:29 +02:00
Joseph Young
d43cd997a4 re.Match.lastgroup is str rather than AnyStr (#6776) 2022-01-01 15:14:23 +02:00
Akuli
38a08fcf04 List returned from re.split() can contain Nones (#6763) 2021-12-30 13:27:39 -06:00