From 35ccbbabd5411ecd76e689d7517d34cce68eede4 Mon Sep 17 00:00:00 2001 From: Jonathan de Bruin Date: Fri, 23 May 2025 23:49:13 +0200 Subject: [PATCH 1/2] Increase performance of parser --- rispy/config.py | 9 ++++----- tests/test_writer.py | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/rispy/config.py b/rispy/config.py index a66e088..8677c17 100644 --- a/rispy/config.py +++ b/rispy/config.py @@ -1,6 +1,5 @@ """Define default mappings.""" - -LIST_TYPE_TAGS = [ +LIST_TYPE_TAGS = { "A1", "A2", "A3", @@ -9,7 +8,7 @@ "KW", "N1", "UR", -] +} DELIMITED_TAG_MAPPING = { "UR": ";", @@ -141,7 +140,7 @@ "VIDEO": "Video recording", } -WOK_LIST_TYPE_TAGS = [ +WOK_LIST_TYPE_TAGS = { "RI", "CR", "AF", @@ -150,7 +149,7 @@ "AU", "CA", "GP", -] +} WOK_TAG_KEY_MAPPING = { "FN": "file_name", diff --git a/tests/test_writer.py b/tests/test_writer.py index 809a965..8094c20 100644 --- a/tests/test_writer.py +++ b/tests/test_writer.py @@ -67,7 +67,7 @@ def test_dumps_multiple_unknown_tags_ris(tmp_path): def test_custom_list_tags(): filepath = DATA_DIR / "example_custom_list_tags.ris" list_tags = deepcopy(rispy.LIST_TYPE_TAGS) - list_tags.append("SN") + list_tags.add("SN") expected = { "type_of_reference": "JOUR", From 13d98089a6db89ce8e52e0a742b241803c475ebb Mon Sep 17 00:00:00 2001 From: Jonathan de Bruin Date: Sat, 24 May 2025 00:03:56 +0200 Subject: [PATCH 2/2] Happy format --- rispy/config.py | 1 + 1 file changed, 1 insertion(+) diff --git a/rispy/config.py b/rispy/config.py index 8677c17..6a19e61 100644 --- a/rispy/config.py +++ b/rispy/config.py @@ -1,4 +1,5 @@ """Define default mappings.""" + LIST_TYPE_TAGS = { "A1", "A2",