From 7815dcfd1e009290b9ad6cee922732c771ea1a7b Mon Sep 17 00:00:00 2001 From: Albert Snow Date: Mon, 24 Jun 2024 13:15:45 -0500 Subject: [PATCH] Making a few protected functions public to run the ingestion process --- src/pfb/importers/gen3dict.py | 4 ++-- src/pfb/importers/json.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pfb/importers/gen3dict.py b/src/pfb/importers/gen3dict.py index 598fc55..9322a86 100644 --- a/src/pfb/importers/gen3dict.py +++ b/src/pfb/importers/gen3dict.py @@ -20,13 +20,13 @@ def from_dict(ctx, url_or_path): """ try: with ctx.obj["writer"] as writer: - _from_dict(writer, url_or_path) + write_from_dict(writer, url_or_path) except Exception: click.secho("Failed!", fg="red", bold=True, err=True) raise -def _from_dict(writer, url_or_path): +def write_from_dict(writer, url_or_path): if writer.isatty: click.secho("Error: cannot output to TTY.", fg="red", bold=True, err=True) return diff --git a/src/pfb/importers/json.py b/src/pfb/importers/json.py index b4d71c0..b72ad81 100644 --- a/src/pfb/importers/json.py +++ b/src/pfb/importers/json.py @@ -74,11 +74,11 @@ def _from_json(metadata, path, program, project): if isinstance(json_data, dict): json_data = [json_data] for json_record in json_data: - record = _convert_json(node_name, json_record, program, project, link_dests) + record = convert_json(node_name, json_record, program, project, link_dests) yield record -def _convert_json(node_name, json_record, program, project, link_dests): +def convert_json(node_name, json_record, program, project, link_dests): relations = [] try: node_id = json_record["submitter_id"]