Commit Graph

53 Commits

Author SHA1 Message Date
Jelle Zijlstra
56c8cbb314 Add GenericAlias.__typing_unpacked_tuple_args__ (#8015)
Fixes #8014 

python/cpython#92484
2022-06-03 08:26:41 +01:00
Jelle Zijlstra
0198d75153 types: 3.11 (and earlier) fixes (#7900)
- New attributes in 3.11
- Arguments to CodeType.__init__ are always positional (have fun)
- co_consts can use object instead of Any
2022-05-21 07:37:11 -07:00
Carl Meyer
7ca8303672 CodeType.co_linetable is of type bytes (#7856)
Although the specific format of the bytes is opaque and undocumented, the fact that it will be bytes is stable.

This is necessary in order for type checkers to allow creating one code object from another, since the `lnotab`
positional argument to `__init__` is typed as bytes.
2022-05-17 11:49:12 -07:00
Jelle Zijlstra
b1ccd03d51 Add GenericAlias.__unpacked__ (#7774) 2022-05-03 15:41:45 +02:00
Alex Waygood
54af68c789 Add a few # noqas to unblock PyCQA/flake8-pyi#213 (#7658) 2022-04-18 17:57:48 +02:00
Alex Waygood
97a74bc1aa Import from collections.abc wherever possible (#7635) 2022-04-18 12:50:37 +02:00
Jelle Zijlstra
cfb1381c2e Add types.FunctionType.__module__ (#7581)
This exists on builtins.function but not here.
2022-04-02 17:44:17 -07:00
Alex Waygood
a3245db63c Remove unneeded # noqa comments, fix broken # noqa comments (#7561) 2022-03-28 23:17:44 +02:00
Alex Waygood
4308915e06 Make __hash__ a ClassVar for several classes where it is set to None (#7485) 2022-03-19 05:59:10 -07:00
Jelle Zijlstra
675de720d6 Add some missing items to sys.pyi and types.pyi (#7447) 2022-03-07 08:22:08 +01:00
Alex Waygood
1ebedcc2b4 Mark fields as readonly in builtins.pyi and types.pyi (#7392)
Add FunctionType.__builtins__
2022-02-28 13:23:34 +01:00
Alex Waygood
d2ddda00cf Fix various __all__-related typos and omissions (#7378) 2022-02-25 15:10:00 +02:00
Alex Waygood
6a743348ca Add __all__ for most modules beginning with 't' (#7373) 2022-02-23 18:25:28 -08:00
Shantanu
075b8e02eb Update stubtest for async and dunder pos only checking (#7333)
Co-authored-by: hauntsaninja <>
2022-02-21 15:54:16 -08:00
Alex Waygood
5e7909d9b3 Fix positional-only differences in types (#7220) 2022-02-15 06:27:09 -08:00
Alex Waygood
690975b55d types: Add several missing __(qual)name__ attributes (#7216) 2022-02-15 08:07:39 +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
Nikita Sobolev
e6cf110100 Improve FunctionType.__get__ with @overload (#7005) 2022-01-23 12:38:09 -08:00
Alex Waygood
1eadf1ab35 Use int | Any for types.FrameType.f_lineno (#6935) 2022-01-17 11:32:20 +02:00
Jelle Zijlstra
0949e9e90d remove quoted strings (#6933) 2022-01-16 14:29:13 -08:00
Alex Waygood
a40d79a4e6 Use lowercase type everywhere (#6853) 2022-01-08 16:09:29 +01:00
Alex Waygood
2268955701 Remove several unused TypeVars (#6829) 2022-01-05 17:58:03 +02:00
Joseph Young
ff64deb331 Add missing function attributes to builtins.function (#6804)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2022-01-04 20:41:59 +02:00
Julien Danjou
1bfcf30a50 FrameType.f_lineno can be None (#6769) 2022-01-02 16:26:58 +01:00
Alex Waygood
8d5d2520ac Use PEP 585 syntax wherever possible (#6717) 2021-12-28 11:31:43 +01:00
Alex Waygood
a54e21992c Remove ParamSpec-related # type: ignores (#6703) 2021-12-26 15:27:57 +01:00
Alex Waygood
4f7f30a8c4 Use SupportsKeysAndGetItem in most Mapping constructors (#6626) 2021-12-18 11:33:00 -08:00
Alex Waygood
aee90a0e82 Add CodeType.co_lines() and CodeType.co_linetable (#6445)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Akuli <akuviljanen17@gmail.com>
2021-11-29 16:49:30 +02:00
Alex Waygood
80425e8fcd Add missing __class_getitem__ method to types.AsyncGeneratorType (#6390) 2021-11-26 21:50:20 +02:00
Akuli
a5bc1e037f Add mypy error codes to '# type: ignore' comments (#6379) 2021-11-26 07:07:56 +01:00
Pavel Karateev
42fa8434f0 Add codeobject.co_positions() for Python 3.11 (#6339) 2021-11-18 11:36:41 -08:00
Alex Waygood
aa7e277adb Harmonise return type of builtins.__import__ and importlib.import_module (#6302)
builtins.__import__ now returns ModuleType instead of Any. In addition, add __getattr__() to ModuleType to ease using imported modules.
2021-11-15 16:21:46 +01:00
KotlinIsland
b8cbac800f Make types.coroutine return Awaitable (#6255) 2021-11-08 12:34:42 +01:00
Oz Anani
4601581e83 Update ModuleType.__file__ to be Optional (#6186)
Per the Python documentation, `ModuleType.__file__` is `Optional`: https://docs.python.org/3/reference/import.html#file__
2021-11-07 06:03:01 -08:00
Eric Werner
fd35084768 Update ModuleType to have __path__ (#6200)
Co-authored-by: Akuli <akuviljanen17@gmail.com>
2021-10-25 23:21:05 +03:00
Akuli
994b69ef8f Use lowercase tuple where possible (#6170) 2021-10-14 17:18:19 -07:00
KotlinIsland
b7d1d099d9 add TypeGuard to coroutines.iscoroutine (#6105)
make CoroutineType extend Coroutine
2021-10-09 17:01:36 +02:00
Kumar Aditya
25ae5b8871 Add __await__, name, qualname to CoroutineType (#6087) 2021-09-29 14:07:09 +02:00
Akuli
ce11072dbe Big diff: use lower-case list and dict (#5888) 2021-08-08 09:26:35 -07:00
Akuli
c12c93ebe4 use new union syntax in stdlib/types.pyi (#5882) 2021-08-08 15:46:09 +02:00
Bas van Beek
475417fa97 Mark final and unhashable classes in types as such (#5837) 2021-08-02 13:46:14 -07:00
Bas van Beek
95a45eb4ab Improve the annotations of types.MappingProxyType (#5822)
* Annotate three previously missing `MappingProxyType` methods

* `__hash__`
* `__reversed__`
* `__class_getitem__`

* Improve 5 `MappingProxyType` methods

The assumption here is that the underlying mapping is a `dict`,
just is done for `MappingProxyType.copy`

* Make the value type of `types.MappingProxyType` covariant
2021-07-30 17:05:15 +02:00
Anton Grübel
35cc7491db Add __defaults__ and __closure__ to types.MethodType (#5707) 2021-06-29 10:21:06 -07:00
Jelle Zijlstra
bfc83c365a Use PEP 604 in types.pyi (#5553) 2021-05-29 11:09:50 -07:00
Andrey
dbaaa3a103 PEP 604: Add ror operator and modify isinstance and subclass (#5509)
Add operators or and ror for types.Union and ror to the type class.
Also, add modified isinstance and issubclass signatures to support old-style and new-style unions inside.
2021-05-21 16:30:27 -07:00
Jelle Zijlstra
bce19fc206 make GeneratorType inherit from Generator (#5474)
Fixes #5496
2021-05-18 13:31:14 -07:00
Akuli
e66b7fa660 delete _importlib_modulespec (#5350)
* delete _importlib_modulespec

* use typing_extensions.runtime_checkable
2021-05-06 17:13:35 +03:00
hatal175
c9d996fe55 Various stubtest exceptions (#5227) 2021-04-17 07:03:28 -07:00