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
83 lines
1.7 KiB
Python
83 lines
1.7 KiB
Python
from dataclasses import dataclass
|
|
from enum import Enum
|
|
from pathlib import Path
|
|
from typing import Literal
|
|
|
|
|
|
class Language(str, Enum):
|
|
FI = "fi"
|
|
SV = "sv"
|
|
EN = "en"
|
|
|
|
|
|
LANGUAGE_DISPLAY_NAMES: dict[Language, str] = {
|
|
Language.FI: "Finnish",
|
|
Language.SV: "Swedish",
|
|
Language.EN: "English",
|
|
}
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class Config:
|
|
bot_token: str
|
|
chat_id: str
|
|
channel_username: str
|
|
discussion_group_id: str = ""
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class LanguageAssets:
|
|
language: Language
|
|
text_file: Path
|
|
text_raw: str
|
|
images: list[Path]
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class ScanResult:
|
|
global_images: list[Path]
|
|
languages: list[LanguageAssets]
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class PlaceholderToken:
|
|
label: str
|
|
target_lang: Language
|
|
source_span: tuple[int, int]
|
|
|
|
|
|
@dataclass
|
|
class PostedMessageRef:
|
|
language: Language
|
|
text_message_id: int | None
|
|
caption_message_id: int | None
|
|
message_url: str
|
|
had_placeholders: bool
|
|
text_mode: Literal["message", "caption", "none"]
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class TextSegmentBinding:
|
|
message_id: int
|
|
mode: Literal["message", "caption"]
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class LanguageBinding:
|
|
language: Language
|
|
image_message_ids: list[int]
|
|
text_segments: list[TextSegmentBinding]
|
|
primary_message_id: int | None
|
|
primary_message_url: str
|
|
discussion_message_id: int | None = None
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class PublishBinding:
|
|
global_message_ids: list[int]
|
|
global_attached_to_language: Language | None
|
|
languages: dict[Language, LanguageBinding]
|
|
discussion_message_ids: dict[int, int]
|
|
global_primary_message_id: int | None = None
|
|
global_discussion_message_id: int | None = None
|