Use simplified Python 3.8 syntax (MR 2327)

This commit was generated with:

    ruff check --fix --extend-select=UP .
This commit is contained in:
Hugo Osvaldo Barrera 2024-06-23 14:38:19 +02:00 committed by Oliver Smith
parent fa2a7c502d
commit f3f392ef66
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
13 changed files with 51 additions and 60 deletions

View file

@ -417,9 +417,9 @@ def ask_for_device(context: Context):
codenames = []
if new_vendor:
logging.info(
"The specified vendor ({}) could not be found in"
f"The specified vendor ({vendor}) could not be found in"
" existing ports, do you want to start a new"
" port?".format(vendor)
" port?"
)
if not pmb.helpers.cli.confirm(default=True):
continue
@ -451,7 +451,7 @@ def ask_for_device(context: Context):
continue
# New port creation confirmed
logging.info("Generating new aports for: {}...".format(device))
logging.info(f"Generating new aports for: {device}...")
pmb.aportgen.generate(f"device-{device}", False)
pmb.aportgen.generate(f"linux-{device}", False)
elif any("archived" == x for x in device_path.parts):
@ -551,7 +551,7 @@ def ask_for_mirror():
json_path = pmb.helpers.http.download(
"https://postmarketos.org/mirrors.json", "pmos_mirrors", cache=False
)
with open(json_path, "rt") as handle:
with open(json_path) as handle:
s = handle.read()
logging.info("List of available mirrors:")
@ -635,7 +635,7 @@ def ask_build_pkgs_on_install(default: bool) -> bool:
def get_locales():
ret = []
list_path = f"{pmb.config.pmb_src}/pmb/data/locales"
with open(list_path, "r") as handle:
with open(list_path) as handle:
for line in handle:
ret += [line.rstrip()]
return ret