# HG changeset patch # User iuc # Date 1606049156 0 # Node ID 19b6a2f0dbe23d60e3403122e892304abd94cd01 # Parent edacc4bcd3cbcdeb04ede3aee1aafab4990ca39d "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165" diff -r edacc4bcd3cb -r 19b6a2f0dbe2 data_manager/kraken2_build_database.py --- a/data_manager/kraken2_build_database.py Sun Dec 22 11:57:46 2019 -0500 +++ b/data_manager/kraken2_build_database.py Sun Nov 22 12:45:56 2020 +0000 @@ -292,14 +292,15 @@ parser.add_argument('--clean', dest='clean', action='store_true', help='Clean up extra files') args = parser.parse_args() - data_manager_input = json.loads(open(args.data_manager_json).read()) + with open(args.data_manager_json) as fh: + data_manager_input = json.load(fh) target_directory = data_manager_input['output_data'][0]['extra_files_path'] try: - os.mkdir( target_directory ) + os.mkdir(target_directory) except OSError as exc: - if exc.errno == errno.EEXIST and os.path.isdir( target_directory ): + if exc.errno == errno.EEXIST and os.path.isdir(target_directory): pass else: raise @@ -354,7 +355,8 @@ else: sys.exit("Invalid database type") - open(args.data_manager_json, 'w').write(json.dumps(data_manager_output, sort_keys=True)) + with open(args.data_manager_json, 'w') as fh: + json.dump(data_manager_output, fh, sort_keys=True) if __name__ == "__main__":