Alex Waygood
23249c07a9
Update enum for py312 ( #10670 )
2023-09-11 11:26:18 +01:00
Alex Waygood
4ae6d38f96
Use latest Python for stubtest in CI ( #10641 )
2023-08-30 18:50:11 +02:00
Alex Waygood
74aac1aa89
Don't pretend EnumMeta inherits from ABCMeta ( #10577 )
2023-08-14 21:59:53 +01:00
Alex Waygood
230a8f7c6c
Fix stubtest for Python 3.12.0rc1 ( #10541 )
2023-08-07 12:41:31 -07:00
Alex Waygood
03b4bb9cce
Stdlib: add many missing __hash__ and __eq__ methods ( #10464 )
2023-07-17 14:21:02 +02:00
Nikita Sobolev
a8051fb2c4
Add _generate_next_value_ to StrEnum ( #10390 )
...
Fixes https://github.com/python/typeshed/issues/10384
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com >
2023-07-01 18:28:09 +01:00
Alex Waygood
4a692fc546
Fix stubtest for py312b3 ( #10343 )
2023-06-21 15:46:50 +01:00
Alex Waygood
e816acffdd
Avoid unnecessary forward refs in class definitions ( #10124 )
2023-05-01 07:50:50 -07:00
Alex Waygood
257e287fec
Stdlib: correct many parameter names ( #9815 )
2023-03-04 09:53:12 +00:00
Alex Waygood
6ba28ae547
Remove unused type: ignore comments ( #9801 )
2023-02-23 12:59:50 -08:00
Alex Waygood
9ed39d8796
Use typing_extensions.Self in the stdlib ( #9694 )
2023-02-09 09:12:13 +00:00
Alex Waygood
33a62ae42d
Add more defaults to the stdlib ( #9606 )
...
Continuing work towards #8988 .
The first five commits were created using stubdefaulter on various Python versions; the following commits were all created manually by me to fix various problems. The main things this adds that weren't present in #9501 are:
- Defaults in Windows-only modules and Windows-only branches (because I'm running a Windows machine)
- Defaults in non-py311 branches
- Defaults for float parameters
- Defaults for overloads
2023-01-29 01:51:23 +00:00
Jelle Zijlstra
ddfaca3200
stdlib: add argument default values ( #9501 )
2023-01-18 09:37:34 +01:00
Avasam
c70d303985
Audit stdlib object annotations ( #9519 )
2023-01-17 15:40:00 +00:00
Nikita Sobolev
0480550fc3
Adds missing __dir__ definitions ( #8479 )
2022-08-04 12:21:43 +02:00
Nikita Sobolev
b19d447721
Remove Enum.__hash__, improve Enum.__reduce_ex__ ( #8477 )
2022-08-03 18:19:49 +01:00
Alex Waygood
a57e182608
enum: Correct IntFlag mro on 3.11+ (#8334 )
2022-07-19 21:47:37 +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
Alex Waygood
e88a182573
Simplify __all__ definitions in modules beginning with 'a' to 'l' ( #8026 )
2022-06-07 15:40:48 +02:00
Alex Waygood
04dde4d000
enum: More changes for 3.11 (#7862 )
2022-05-18 19:35:22 -07:00
Jelle Zijlstra
031c998055
enum: Add member and nonmember ( #7795 )
...
python/cpython#92366
2022-05-07 07:48:34 +01:00
fedor
e8e74ba26f
Use object for value annotation in Enum.__new__ ( #7752 )
...
This pull request reverts part of #2539 that brought back a bug discussed in https://github.com/python/mypy/issues/5788 and initially fixed in #2539
In short, the issue was that the following program always resulted
in an error when running mypy with the `--disallow-any-expr` flag:
from enum import Enum
class MyEnum(Enum):
FOO = 1
BAR = 2
blah = MyEnum # Error here
The root issue was that because the signature of Enum's
`__new__` method was typed as:
def __new__(self: Type[T], value: Any) -> T: ...
This caused mypy to decide that the type of `MyEnum` was
`(Any) -> MyEnum`. This is correct based on the current
type signature, but unfortunately means that it becomes
impossible to ever use enums with the `--disallow-any-expr` flag.
2022-04-30 12:36:35 -06:00
Alex Waygood
740193a8fc
Use TypeAlias where possible for type aliases ( #7630 )
2022-04-15 18:01:00 -07:00
Alex Waygood
b63c963077
Use conditional overloads to simplify several stdlib functions ( #7540 )
2022-03-25 08:47:03 +01:00
Alex Waygood
3ab250eec8
Use PEP 604 syntax wherever possible ( #7493 )
2022-03-16 16:01:33 +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
4f0d8c593e
Delete EnumMeta.__setattr__ and EnumMeta.__delattr__ ( #7388 )
2022-02-26 17:55:53 -08:00
Alex Waygood
2d6ab4d3bf
Fix several mypy errors when run on the 3.11 stdlib ( #7389 )
2022-02-26 17:49:36 -08:00
Alex Waygood
1610949c66
Improve enum stubs ( #7362 )
...
- Improve TypeVar names
- `object` -> `Any` in `Enum.__new__` (there _are_ restrictions on the kinds of objects that can be passed in, they're just not expressable in the stubs.
- Delete pointless `Self | int` unions, since `Self` is a subtype of `int` for these methods.
2022-02-22 20:17:55 +01:00
Alex Waygood
a37d5f4849
Add enum module features new in 3.11 ( #7358 )
2022-02-22 08:42:03 -08:00
Alex Waygood
953f815f6b
Add EnumMeta.__prepare__ ( #7243 )
2022-02-20 15:57:21 -08:00
Alex Waygood
2fe519c3a7
Add __all__ for modules beginning with 'e', 'f' and 'g' ( #7325 )
2022-02-20 15:08:14 -08:00
Alex Waygood
fbc279e3f5
stdlib: Add many missing dunder overrides ( #7231 )
2022-02-16 06:25:47 -08:00
Alex Waygood
5972da2e2d
Add EnumMeta.__bool__ ( #7206 )
...
Most Python objects evaluate as falsey if they have length 0, but an enum class is truthy even if it has length 0.
Source code: 841c77d802/Lib/enum.py (L353)
2022-02-14 13:03:17 -08:00
Shantanu
b88a6f19cd
Upgrade black version ( #7089 )
2022-01-30 16:27:06 -08:00
Akuli
b2375ddaeb
Enable pyright for Python 3.11 ( #6904 )
2022-01-12 20:07:57 +01: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
Alex Waygood
a40d79a4e6
Use lowercase type everywhere ( #6853 )
2022-01-08 16:09:29 +01:00
Alex Waygood
8d5d2520ac
Use PEP 585 syntax wherever possible ( #6717 )
2021-12-28 11:31:43 +01:00
Alex Waygood
a7c9788948
Improve stub for enum.property ( #6648 )
2021-12-21 21:11:07 -08:00
Alex Waygood
519d70097b
Update enum.pyi ( #6629 )
2021-12-20 17:51:48 -08:00
Alex Waygood
f3026dc3ab
Improve enum.StrEnum ( #6580 )
...
A `StrEnum` can only have strings as values.
2021-12-13 17:59:31 +01:00
Alex Waygood
cc054efa79
Make name and value read-only for Enums, part II ( #6578 )
2021-12-13 17:00:28 +01:00
Alex Waygood
0f2e87e42a
Make name and value read-only for Enums ( #6576 )
2021-12-13 16:08:49 +01:00
Alex Waygood
c3cd88ba91
Add EnumMeta.__new__ & EnumMeta.__call__ ( #6572 )
2021-12-13 12:33:54 +01:00
Nikita Sobolev
b1f0271da6
Add EnumType to enum.pyi on Python 3.11 ( #6568 )
2021-12-11 19:13:32 +02:00
Akuli
a5bc1e037f
Add mypy error codes to '# type: ignore' comments ( #6379 )
2021-11-26 07:07:56 +01:00
Jake Bailey
b9ea346c14
Use overrides for IntFlag dunder-r methods ( #6114 )
2021-10-04 18:00:36 -07:00