From 6f8ce18d96049ce148b28579f79ce2e501c9b2eb Mon Sep 17 00:00:00 2001 From: Luca Weiss Date: Thu, 26 Jun 2025 11:40:40 +0200 Subject: [PATCH] ci: wiki: Resolve some pylint warnings Use resource management with urllib.request.urlopen, and move a print out of an unnecessary "else" since the line before returns anyways. Part-of: https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/6719 --- .ci/lib/check_devices_in_wiki.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.ci/lib/check_devices_in_wiki.py b/.ci/lib/check_devices_in_wiki.py index c0085c585..b6d6a14c4 100755 --- a/.ci/lib/check_devices_in_wiki.py +++ b/.ci/lib/check_devices_in_wiki.py @@ -42,7 +42,8 @@ def get_wiki_devices_html(path): else: # Download wiki page url = "http://wiki.postmarketos.org/wiki/Devices" - content = urllib.request.urlopen(url).read().decode("utf-8") + with urllib.request.urlopen(url) as f: + content = f.read().decode("utf-8") # Split into booting and not booting split = content.split("") @@ -57,7 +58,8 @@ def get_wiki_renamed_devices_html(): """:returns: HTML of the page""" # Download wiki page url = "http://wiki.postmarketos.org/wiki/Renamed_Devices" - return urllib.request.urlopen(url).read().decode("utf-8") + with urllib.request.urlopen(url) as f: + return f.read().decode("utf-8") def check_device(device, html, is_booting): @@ -126,8 +128,8 @@ def main(): print("wiki as well and make sure to add it here:") print("https://postmarketos.org/renamed") return 1 - else: - print("*** Wiki check successful!") + + print("*** Wiki check successful!") return 0