From 65068806d846e0ca17f4f3931aeb3543c49414fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Szczepanik?= Date: Tue, 21 Nov 2023 21:23:31 +0100 Subject: [PATCH] Add an option to specify tabby encoding This relies on a not-yet-merged patch to datalad-tabby, so we call load_tabby without additional arguments unless the encoding is given. If the patch gets merged, the if-else can be removed. Related datalad-tabby change: https://github.com/psychoinformatics-de/datalad-tabby/pull/116 --- load_tabby.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/load_tabby.py b/load_tabby.py index a77de98..01bb2e9 100644 --- a/load_tabby.py +++ b/load_tabby.py @@ -289,12 +289,20 @@ def process_homepage(homepage): parser.add_argument("-c", "--catalog", type=Path, help="Catalog to add to") parser.add_argument("--set-as-super", action="store_true") parser.add_argument("--remove-first", action="store_true") +parser.add_argument("--encoding", help="encoding to use when loading tabby") args = parser.parse_args() -record = load_tabby( - args.tabby_path, # projects/project-a/example-record/dataset@tby-crc1451v0.tsv - cpaths=[Path(__file__).parent / "conventions"], -) +if args.encoding: + record = load_tabby( + args.tabby_path, + cpaths=[Path(__file__).parent / "conventions"], + encoding=args.encoding, + ) +else: + record = load_tabby( + args.tabby_path, + cpaths=[Path(__file__).parent / "conventions"], + ) expanded = jsonld.expand(record) compacted = jsonld.compact(record, ctx=cat_context)