api: Conform to `cros lint'
Fix formatting issues that cause pylint to complain and preupload hooks
to fail.
BUG=none
TEST=for f in $(find . -path "./gen*" -prune -o -iname "*.py" -print);
do cros lint $f; done
TEST=unit, just for comfort of confirmation
Change-Id: Id770ca57a96c6691b8dce22f019f2f95d7eb2a49
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/3277512
Auto-Submit: Lizzy Presland <zland@google.com>
Commit-Queue: Lizzy Presland <zland@google.com>
Tested-by: Lizzy Presland <zland@google.com>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
diff --git a/api/controller/test.py b/api/controller/test.py
index ba4baf2..9856dee 100644
--- a/api/controller/test.py
+++ b/api/controller/test.py
@@ -200,9 +200,7 @@
allowed_chars = set(string.ascii_letters+string.digits+'-_.')
invalid_chars = set(tag) - allowed_chars
if invalid_chars:
- return 'saw one or more invalid characters: [{}]'.format(
- ''.join(invalid_chars),
- )
+ return f'saw one or more invalid characters: {"".join(invalid_chars)}'
# Finally, max tag length is 128 characters
if len(tag) > 128:
@@ -222,14 +220,12 @@
allowed_chars = set(string.ascii_lowercase+string.digits+'-.')
invalid_chars = set(key) - allowed_chars
if invalid_chars:
- return 'saw one or more invalid characters: [{}]'.format(
- ''.join(invalid_chars),
- )
+ return f'saw one or more invalid characters: {"".join(invalid_chars)}'
# Repeated . and - aren't allowed
for char in '.-':
if char*2 in key:
- return "'{}' can\'t be repeated in label key".format(char)
+ return f'"{char}" can\'t be repeated in label key'
@faux.success(_BuildTestServiceContainersResponse)
@@ -249,7 +245,7 @@
tags = ','.join(input_proto.tags)
labels = (
- '{}={}'.format(key, value) for key, value in input_proto.labels.items()
+ f'{key}={value}' for key, value in input_proto.labels.items()
)
for human_name, build_script in TEST_CONTAINER_BUILD_SCRIPTS.items():