Skip to content

Commit 5a22944

Browse files
Remove unused function, rename 'config' to 'source_config'
1 parent 383c788 commit 5a22944

File tree

2 files changed

+3
-13
lines changed

2 files changed

+3
-13
lines changed

dsaps/cli.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def main(ctx, config_file, url, email, password):
8787
dspace_client = dspace.DSpaceClient(url)
8888
dspace_client.authenticate(email, password)
8989
ctx.obj["dspace_client"] = dspace_client
90-
ctx.obj["config"] = source_config
90+
ctx.obj["source_config"] = source_config
9191
logger.info("Initializing S3 client")
9292
ctx.obj["s3_client"] = S3Client.get_client()
9393
ctx.obj["start_time"] = perf_counter()
@@ -134,7 +134,7 @@ def additems(
134134
(i.e., files) associated with the item are read from the metadata CSV file, and
135135
uploaded to the newly created item on DSpace.
136136
"""
137-
mapping = ctx.obj["config"]["mapping"]
137+
mapping = ctx.obj["source_config"]["mapping"]
138138
dspace_client = ctx.obj["dspace_client"]
139139

140140
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):
236236
* updated-<metadata-csv>.csv: Entries from the metadata CSV file with a
237237
corresponding file in the content directory.
238238
"""
239-
source_settings = ctx.obj["config"]["settings"]
239+
source_settings = ctx.obj["source_config"]["settings"]
240240
bitstreams = helpers.get_files_from_s3(
241241
s3_path=content_directory,
242242
s3_client=ctx.obj["s3_client"],

dsaps/helpers.py

-10
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,6 @@ def create_csv_from_list(list_name, output):
2525
writer.writerow([item])
2626

2727

28-
def get_bitstreams_from_csv(metadata_csv):
29-
bitstreams = {}
30-
with open(metadata_csv, "r") as csvfile:
31-
reader = csv.DictReader(csvfile)
32-
for row in reader:
33-
if bitstream := row.get("bitstreams"):
34-
bitstreams[row["item_identifier"]] = ast.literal_eval(bitstream)
35-
return dict(sorted(bitstreams.items()))
36-
37-
3828
def get_files_from_s3(
3929
s3_path: str,
4030
s3_client,

0 commit comments

Comments
 (0)