11import json
22import logging
33import os
4- import xmltodict
54import subprocess
65
6+ import xmltodict
7+
78logger = logging .getLogger (__name__ )
89
910
@@ -40,9 +41,7 @@ def rsync_is_running(src):
4041def submit_background_process (command_str : str ):
4142 """Submit a command string as a background process."""
4243
43- background_process = subprocess .Popen (
44- command_str , stdout = subprocess .PIPE , shell = True
45- )
44+ subprocess .Popen (command_str , stdout = subprocess .PIPE , shell = True )
4645
4746
4847def parse_metadata_files (files ):
@@ -52,10 +51,10 @@ def parse_metadata_files(files):
5251 for file_path in files :
5352 try :
5453 if file_path .endswith (".json" ):
55- with open (file_path , "r" ) as f :
54+ with open (file_path ) as f :
5655 metadata [os .path .basename (file_path )] = json .load (f )
5756 elif file_path .endswith (".xml" ):
58- with open (file_path , "r" ) as f :
57+ with open (file_path ) as f :
5958 xml_content = xmltodict .parse (
6059 f .read (), attr_prefix = "" , cdata_key = "text"
6160 )
@@ -71,10 +70,10 @@ def parse_metadata_files(files):
7170
7271
7372def check_exit_status (file_path ):
74- """Check the exit status from a given file.
73+ """Check the exit status from a given file.
7574 Return True if exit code is 0, else False."""
7675 if os .path .exists (file_path ):
77- with open (file_path , "r" ) as f :
76+ with open (file_path ) as f :
7877 exit_code = f .read ().strip ()
7978 if exit_code == "0" :
8079 return True
0 commit comments