mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 18:58:04 +00:00
[flake8-simplify
] More precise inference for dictionaries (SIM300
) (#15164)
Co-authored-by: Micha Reiser <micha@reiser.io>
This commit is contained in:
parent
0caab81d3d
commit
0b15f17939
3 changed files with 67 additions and 42 deletions
|
@ -14,6 +14,7 @@ JediOrder.YODA == age # SIM300
|
|||
0 < (number - 100) # SIM300
|
||||
B<A[0][0]or B
|
||||
B or(B)<A[0][0]
|
||||
{"non-empty-dict": "is-ok"} == DummyHandler.CONFIG
|
||||
|
||||
# Errors in preview
|
||||
['upper'] == UPPER_LIST
|
||||
|
@ -39,4 +40,7 @@ age == JediOrder.YODA
|
|||
(number - 100) > 0
|
||||
SECONDS_IN_DAY == 60 * 60 * 24 # Error in 0.1.8
|
||||
SomeClass().settings.SOME_CONSTANT_VALUE > (60 * 60) # Error in 0.1.8
|
||||
{"non-empty-dict": "is-ok"} == DummyHandler.CONFIG
|
||||
|
||||
# https://github.com/astral-sh/ruff/issues/14761
|
||||
{"": print(1)} == print(2)
|
||||
{0: 1, **print(2)} == print(4)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue