mirror of
https://github.com/esphome/esphome.git
synced 2026-10-07 03:16:37 +00:00
[ruff] Enable FURB rules for code modernization (#9896)
This commit is contained in:
@@ -27,8 +27,7 @@ SetDecelerationAction = stepper_ns.class_("SetDecelerationAction", automation.Ac
|
||||
def validate_acceleration(value):
|
||||
value = cv.string(value)
|
||||
for suffix in ("steps/s^2", "steps/s*s", "steps/s/s", "steps/ss", "steps/(s*s)"):
|
||||
if value.endswith(suffix):
|
||||
value = value[: -len(suffix)]
|
||||
value = value.removesuffix(suffix)
|
||||
|
||||
if value == "inf":
|
||||
return 1e6
|
||||
@@ -48,8 +47,7 @@ def validate_acceleration(value):
|
||||
def validate_speed(value):
|
||||
value = cv.string(value)
|
||||
for suffix in ("steps/s", "steps/s"):
|
||||
if value.endswith(suffix):
|
||||
value = value[: -len(suffix)]
|
||||
value = value.removesuffix(suffix)
|
||||
|
||||
if value == "inf":
|
||||
return 1e6
|
||||
|
||||
Reference in New Issue
Block a user