Skip to content

Commit

Permalink
Remove unused function, rename 'config' to 'source_config'
Browse files Browse the repository at this point in the history
  • Loading branch information
jonavellecuerdo committed Apr 5, 2024
1 parent 383c788 commit 5a22944
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
6 changes: 3 additions & 3 deletions dsaps/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -236,7 +236,7 @@ def reconcile(ctx, metadata_csv, output_directory, content_directory):
* updated-<metadata-csv>.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"],
Expand Down
10 changes: 0 additions & 10 deletions dsaps/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 5a22944

Please sign in to comment.