Skip to content

Commit

Permalink
Add an option to specify tabby encoding
Browse files Browse the repository at this point in the history
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:
psychoinformatics-de/datalad-tabby#116
  • Loading branch information
mslw committed Nov 21, 2023
1 parent c9a9431 commit 6506880
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions load_tabby.py
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
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)
Expand Down

0 comments on commit 6506880

Please sign in to comment.