Fix linter feedback.

This commit is contained in:
Christ van Willegen 2024-05-24 13:16:43 +02:00
parent 2d9d207848
commit 13d470a3bc

View file

@ -71,16 +71,18 @@ def validate_speed(value):
def validate_rotation(value): def validate_rotation(value):
value = cv.string(value) value = cv.string(value)
if value == "both": if value in ("both"):
return 0 return 0
if value == "cw" or value == "clockwise": if value in ("cw", "clockwise"):
return 1 return 1
if value == "ccw" or value == "counterclockwise" or value == "counter-clockwise": if value in ("ccw", "counterclockwise", "counter-clockwise"):
return -1 return -1
raise cv.Invalid(f"Expected rotation as 'both', 'cw', 'ccw', 'clockwise', 'counterclockwise', 'counter-clockwise', got {value}") raise cv.Invalid(
f"Expected rotation as 'both', 'cw', 'ccw', 'clockwise', 'counterclockwise', 'counter-clockwise', got {value}"
)
STEPPER_SCHEMA = cv.Schema( STEPPER_SCHEMA = cv.Schema(