From 9f2131c258df9187edd6de481836a732d1348e1e Mon Sep 17 00:00:00 2001 From: san-e <67925673+san-e@users.noreply.github.com> Date: Sun, 6 Nov 2022 16:36:55 +0100 Subject: [PATCH 1/3] add constants.ini parsing --- flint/interface.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/flint/interface.py b/flint/interface.py index 8ace6d5..34ff9ad 100644 --- a/flint/interface.py +++ b/flint/interface.py @@ -34,6 +34,11 @@ def html_to_rdl(html: str) -> str: return result +@cached +def get_constants() -> dict: + path = paths.inis["constants"] + return {header: attributes for header, attributes in ini.parse(path)} + # A lookup table mapping RDL (Render Display List) tags to HTML(4). Freelancer, to my eternal horror, uses these for # formatting for strings inside these resource DLLs. Based on work by adoxa and cshake. # More information can be found in this thread: From 2793f9c3768094778720435c49ae6484d6876194 Mon Sep 17 00:00:00 2001 From: san-e <67925673+san-e@users.noreply.github.com> Date: Sun, 6 Nov 2022 16:54:36 +0100 Subject: [PATCH 2/3] import paths, cached --- flint/interface.py | 1 + 1 file changed, 1 insertion(+) diff --git a/flint/interface.py b/flint/interface.py index 34ff9ad..96accca 100644 --- a/flint/interface.py +++ b/flint/interface.py @@ -8,6 +8,7 @@ Interface-related functions, such as routines for translating RDL. """ import xml.etree.ElementTree as xml +from . import paths, cached def rdl_to_html(rdl: str) -> str: From e8cb0cd2ba5eb8ae44cdd7b2693a51d2d5b4e63e Mon Sep 17 00:00:00 2001 From: san-e <67925673+san-e@users.noreply.github.com> Date: Sat, 19 Nov 2022 13:05:16 +0100 Subject: [PATCH 3/3] use dict() instead of dict comprehension --- flint/interface.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flint/interface.py b/flint/interface.py index 96accca..781e4fe 100644 --- a/flint/interface.py +++ b/flint/interface.py @@ -38,7 +38,7 @@ def html_to_rdl(html: str) -> str: @cached def get_constants() -> dict: path = paths.inis["constants"] - return {header: attributes for header, attributes in ini.parse(path)} + return dict(ini.parse(path)) # A lookup table mapping RDL (Render Display List) tags to HTML(4). Freelancer, to my eternal horror, uses these for # formatting for strings inside these resource DLLs. Based on work by adoxa and cshake.