Commit Graph

98 Commits

Author SHA1 Message Date
Shantanu
a3ce512095 typing: remove metaclass from Sized (#9058)
as per https://github.com/python/typeshed/pull/8977#issuecomment-1297872394
2022-11-01 18:38:52 -07:00
Nikita Sobolev
5bbba5d008 Collection is Sized (#8977) 2022-10-25 06:08:28 -07:00
Nikita Sobolev
327ae91627 ValuesView is a Collection, not Iterable (#8953)
See https://github.com/python/cpython/issues/98500 and 49f61068f4/Lib/_collections_abc.py (L893)
2022-10-21 09:47:44 -07: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
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
Nikita Sobolev
6e985ef3de stdlib mapping classes: Use better names for various pos-only parameters (#8637) 2022-08-28 23:29:00 +01:00
Shantanu
93ee41bcd9 typing: add _type_repr (#8624) 2022-08-26 12:15:11 +02:00
Aron Bierbaum
ef6bacab92 Update ForwardRef._evaluate for Python 3.11 (#8600)
recursive_guard argument was added in https://github.com/python/cpython/pull/21553
2022-08-23 18:05:55 -07:00
Alex Waygood
2c052651e9 Normalise use of Never vs NoReturn (#8549) 2022-08-17 21:53:40 +01:00
Alex Waygood
cf0b3a2596 Improve .keys(), .values(), .items() methods for TypedDicts (#8532) 2022-08-12 20:02:43 -07:00
Alex Waygood
556f6a10f6 Enable flake8-pyi's Y034 check in stdlib/typing.pyi (#8530) 2022-08-11 10:57:31 +02:00
Alex Waygood
7eaedd44dd Add missing TypedDict methods and ClassVars (#8512) 2022-08-10 10:29:40 +01:00
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