Build custom container images / build (map[base_image:php:8-fpm-alpine build_args:PHP_VERSION=8
context:php8-pgsql fingerprint_command:{ apk info -v | LC_ALL=C sort; find /usr/local/lib/php/extensions /usr/local/etc/php/conf.d -type f -exec sha256sum {} + | LC_ALL=C sort; }
name:ph… (push) Successful in 48s
Build custom container images / build (map[base_image:postgres:18 build_args:PG_VERSION=18
POSTGIS_VERSION=3
VCHORD_VERSION=0.5.3
context:postgres fingerprint_command:{ dpkg-query -W -f='${binary:Package}=${Version}\n' | LC_ALL=C sort; find /usr/lib/postgresql -type f -exec sha256su… (push) Successful in 55s
Build custom container images / build (map[base_image:python:3 build_args:PYTHON_VERSION=3
context:python-tools fingerprint_command:{ dpkg-query -W -f='${binary:Package}=${Version}\n' | LC_ALL=C sort; pip freeze | LC_ALL=C sort; }
name:python-tools oci_labels:org.opencontainers.ima… (push) Successful in 54s
Build custom container images / build (map[base_image:python:3.12-slim build_args:PYTHON_VERSION=3.12-slim
context:linkki-tiedotus fingerprint_command:{ dpkg-query -W -f='${binary:Package}=${Version}\n' | LC_ALL=C sort; pip freeze | LC_ALL=C sort; }
name:linkki-tiedotus oci_labels:… (push) Successful in 39s
36 lines
1.2 KiB
Python
36 lines
1.2 KiB
Python
import re
|
|
|
|
from linkki_poster.models import LANGUAGE_DISPLAY_NAMES, LanguageAssets
|
|
|
|
|
|
def prompt_language_order(languages: list[LanguageAssets], input_fn=input) -> list[LanguageAssets]:
|
|
if len(languages) <= 1:
|
|
return languages
|
|
|
|
print("Language order:")
|
|
for index, language_assets in enumerate(languages, start=1):
|
|
print(f"{index}. {LANGUAGE_DISPLAY_NAMES[language_assets.language]}")
|
|
|
|
expected = list(range(1, len(languages) + 1))
|
|
while True:
|
|
raw = input_fn("Enter language order: ")
|
|
if raw.strip() == "":
|
|
return languages
|
|
parsed = parse_order_input(raw, len(languages))
|
|
if parsed is None:
|
|
print(f"Invalid order. Press Enter for default order {expected}, or enter digits {expected}.")
|
|
continue
|
|
return [languages[index - 1] for index in parsed]
|
|
|
|
|
|
def parse_order_input(raw_text: str, language_count: int) -> list[int] | None:
|
|
digits = [int(item) for item in re.findall(r"\d", raw_text)]
|
|
if len(digits) != language_count:
|
|
return None
|
|
|
|
expected = set(range(1, language_count + 1))
|
|
if set(digits) != expected:
|
|
return None
|
|
|
|
return digits
|