Skip to content

Commit 70d997c

Browse files
committed
Fix pylint issues
1 parent 18ef029 commit 70d997c

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

tests/ci/docker_images_check.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def get_changed_docker_images(
5858
images_dict = {}
5959
path_to_images_file = os.path.join(repo_path, image_file_path)
6060
if os.path.exists(path_to_images_file):
61-
with open(path_to_images_file, "r") as dict_file:
61+
with open(path_to_images_file, "rb") as dict_file:
6262
images_dict = json.load(dict_file)
6363
else:
6464
logging.info(
@@ -159,10 +159,7 @@ def build_and_push_one_image(
159159
image.full_path,
160160
)
161161
build_log = os.path.join(
162-
TEMP_PATH,
163-
"build_and_push_log_{}_{}".format(
164-
str(image.repo).replace("/", "_"), version_string
165-
),
162+
TEMP_PATH, f"build_and_push_log_{image.repo.replace('/', '_')}_{version_string}"
166163
)
167164
push_arg = ""
168165
if push:
@@ -172,7 +169,7 @@ def build_and_push_one_image(
172169
if child:
173170
from_tag_arg = f"--build-arg FROM_TAG={version_string} "
174171

175-
with open(build_log, "w") as bl:
172+
with open(build_log, "wb") as bl:
176173
cmd = (
177174
"docker buildx build --builder default "
178175
f"{from_tag_arg}"
@@ -247,7 +244,7 @@ def process_test_results(
247244
build_url = s3_client.upload_test_report_to_s3(
248245
build_log, s3_path_prefix + "/" + os.path.basename(build_log)
249246
)
250-
url_part += '<a href="{}">build_log</a>'.format(build_url)
247+
url_part += f'<a href="{build_url}">build_log</a>'
251248
if url_part:
252249
test_name = image + " (" + url_part + ")"
253250
else:
@@ -353,7 +350,7 @@ def main():
353350
if len(description) >= 140:
354351
description = description[:136] + "..."
355352

356-
with open(changed_json, "w") as images_file:
353+
with open(changed_json, "w", encoding="utf-8") as images_file:
357354
json.dump(result_images, images_file)
358355

359356
s3_helper = S3Helper("https://s3.amazonaws.com")
@@ -367,8 +364,8 @@ def main():
367364

368365
url = upload_results(s3_helper, pr_info.number, pr_info.sha, test_results, [], NAME)
369366

370-
print("::notice ::Report url: {}".format(url))
371-
print('::set-output name=url_output::"{}"'.format(url))
367+
print(f"::notice ::Report url: {url}")
368+
print(f'::set-output name=url_output::"{url}"')
372369

373370
if args.no_reports:
374371
return

0 commit comments

Comments
 (0)