mypy
mypy copied to clipboard
Adds `@enum.unique` decorator support
Right now it uses ast to tell which values are non unique.
It does not support function that return Literal values, Final constants, etc.
But, it works!
After #11247 is merged, I am going to add the support for Literal and Final values.
Refs https://github.com/python/mypy/issues/11248
Closes #10858
Diff from mypy_primer, showing the effect of this PR on open source code:
core (https://github.com/home-assistant/core.git)
+ [1, 2, 3]
+ [0, 1, 2, 3]
pydantic (https://github.com/samuelcolvin/pydantic.git)
+ [0, 1, 2, 3, 4, 5]
mypy (https://github.com/python/mypy.git)
+ [0, 1, 2, 3, 4, 5]
+ [0, 1, 2, 3]
+ ['s', 'd', 'b']
SinbadCogs (https://github.com/mikeshardmind/SinbadCogs.git)
+ [0, 1, 2, 4, 8, 16]
xarray (https://github.com/pydata/xarray.git)
+ [0, 1, 2, 3]
arviz (https://github.com/arviz-devs/arviz.git)
+ [0, 1, 2, 3]
schemathesis (https://github.com/schemathesis/schemathesis.git)
+ [1, 2, 3, 4, 5, 6]
+ [1, 2, 3]
+ ['$url', '$method', '$statusCode', '$request', '$response']
Rebased!
cc @JukkaL