mypy icon indicating copy to clipboard operation
mypy copied to clipboard

Adds `@enum.unique` decorator support

Open sobolevn opened this issue 4 years ago • 2 comments

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

sobolevn avatar Oct 02 '21 15:10 sobolevn

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']

github-actions[bot] avatar Oct 02 '21 16:10 github-actions[bot]

Rebased!

cc @JukkaL

sobolevn avatar Nov 03 '21 08:11 sobolevn