From 5a229448324b6b13e08d3acd6b5c237e511f8cc9 Mon Sep 17 00:00:00 2001 From: jonavellecuerdo Date: Fri, 5 Apr 2024 14:26:55 -0400 Subject: [PATCH] Remove unused function, rename 'config' to 'source_config' --- dsaps/cli.py | 6 +++--- dsaps/helpers.py | 10 ---------- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/dsaps/cli.py b/dsaps/cli.py index dedb8ca..f51ded7 100644 --- a/dsaps/cli.py +++ b/dsaps/cli.py @@ -87,7 +87,7 @@ def main(ctx, config_file, url, email, password): dspace_client = dspace.DSpaceClient(url) dspace_client.authenticate(email, password) ctx.obj["dspace_client"] = dspace_client - ctx.obj["config"] = source_config + ctx.obj["source_config"] = source_config logger.info("Initializing S3 client") ctx.obj["s3_client"] = S3Client.get_client() ctx.obj["start_time"] = perf_counter() @@ -134,7 +134,7 @@ def additems( (i.e., files) associated with the item are read from the metadata CSV file, and uploaded to the newly created item on DSpace. """ - mapping = ctx.obj["config"]["mapping"] + mapping = ctx.obj["source_config"]["mapping"] dspace_client = ctx.obj["dspace_client"] if "collection_uuid" not in ctx.obj and collection_handle is None: @@ -236,7 +236,7 @@ def reconcile(ctx, metadata_csv, output_directory, content_directory): * updated-.csv: Entries from the metadata CSV file with a corresponding file in the content directory. """ - source_settings = ctx.obj["config"]["settings"] + source_settings = ctx.obj["source_config"]["settings"] bitstreams = helpers.get_files_from_s3( s3_path=content_directory, s3_client=ctx.obj["s3_client"], diff --git a/dsaps/helpers.py b/dsaps/helpers.py index 2153d79..c98e0db 100644 --- a/dsaps/helpers.py +++ b/dsaps/helpers.py @@ -25,16 +25,6 @@ def create_csv_from_list(list_name, output): writer.writerow([item]) -def get_bitstreams_from_csv(metadata_csv): - bitstreams = {} - with open(metadata_csv, "r") as csvfile: - reader = csv.DictReader(csvfile) - for row in reader: - if bitstream := row.get("bitstreams"): - bitstreams[row["item_identifier"]] = ast.literal_eval(bitstream) - return dict(sorted(bitstreams.items())) - - def get_files_from_s3( s3_path: str, s3_client,