-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Labels
bugSomething isn't workingSomething isn't workingfixesRelated to suggested fixes for violationsRelated to suggested fixes for violations
Description
I know fixing UP031 is unsafe, but in this case we can do better:
"%.2X" % 1 is converted to "{:.2X}".format(1) but should probably be converted to "{:02X}".format(1)
>>> "%.2X" % 1
'01'
>>> "%02X" % 1
'01'
>>> "{:02X}".format(1)
'01'
>>> "{:.2X}".format(1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: Precision not allowed in integer format specifier
Command: ruff check --select UP031 --fix --unsafe-fixes test.py
Ruff Version: 0.5.3
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingfixesRelated to suggested fixes for violationsRelated to suggested fixes for violations