changeset 4:157a5c9ea72a draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_primer_scheme_bedfiles commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
author iuc
date Sun, 22 Nov 2020 12:52:52 +0000
parents a2953ef09fe1
children be70da9dc013
files data_manager/install_primer_scheme_bedfiles.py
diffstat 1 files changed, 5 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/data_manager/install_primer_scheme_bedfiles.py	Mon Oct 12 13:47:03 2020 +0000
+++ b/data_manager/install_primer_scheme_bedfiles.py	Sun Nov 22 12:52:52 2020 +0000
@@ -135,7 +135,8 @@
         )
         exit(1)
 
-    config = json.load(open(args.galaxy_datamanager_filename))
+    with open(args.galaxy_datamanager_filename) as fh:
+        config = json.load(fh)
     output_directory = config.get("output_data", [{}])[0].get("extra_files_path", None)
     if output_directory is None:
         output_directory = args.output_directory
@@ -144,10 +145,7 @@
         os.makedirs(output_directory)
 
     data_manager_dict = {}
-    data_manager_dict["data_tables"] = json.load(
-        open(args.galaxy_datamanager_filename)
-    ).get("data_tables", {})
-    data_manager_dict["data_tables"] = data_manager_dict.get("data_tables", {})
+    data_manager_dict["data_tables"] = config.get("data_tables", {})
     data_manager_dict["data_tables"][DATA_TABLE_NAME] = data_manager_dict[
         "data_tables"
     ].get(DATA_TABLE_NAME, [])
@@ -163,5 +161,5 @@
         )
 
     data_manager_dict["data_tables"][DATA_TABLE_NAME].extend(data)
-    print(data_manager_dict)
-    json.dump(data_manager_dict, open(args.galaxy_datamanager_filename, "w"))
+    with open(args.galaxy_datamanager_filename, "w") as fh:
+        json.dump(data_manager_dict, fh, sort_keys=True)