1111import smart_open
1212
1313# Package imports
14- from map_clean .constants import INPUT_DIR , OUTPUT_DIR , OUTPUT_FNAME
14+ from map_clean .constants import INPUT_DIR , OUTPUT_DIR
1515from map_clean .utils import configure_cloudflare_request_params , LoggerFactory
1616
1717
@@ -156,10 +156,15 @@ def get_document(row: pd.Series) -> str:
156156 # Parse command line arguments
157157 parser = argparse .ArgumentParser ()
158158 parser .add_argument (
159- "object_key " ,
159+ "input_object_key " ,
160160 type = str ,
161161 help = "The path to the input file in the storage directory or bucket." ,
162162 )
163+ parser .add_argument (
164+ "output_object_key" ,
165+ type = str ,
166+ help = "The path to the output file in the storage directory or bucket." ,
167+ )
163168 parser .add_argument (
164169 "--input_bucket" ,
165170 type = str ,
@@ -179,14 +184,21 @@ def get_document(row: pd.Series) -> str:
179184 )
180185 args = parser .parse_args ()
181186
182- # Validate object key argument received
183- if not args .object_key :
187+ # Validate positional arguments received
188+ if not args .input_object_key :
184189 logger .error (
185190 "Missing positional argument for the path to the "
186191 "input file in the storage directory or bucket."
187192 )
188193 exit (1 )
189194
195+ if not args .output_object_key :
196+ logger .error (
197+ "Missing positional argument for the path to the "
198+ "output file in the storage directory or bucket."
199+ )
200+ exit (1 )
201+
190202 # Determine path for input and output files
191203 if args .remote :
192204 # Validate bucket options present if files hosted remotely
@@ -198,10 +210,10 @@ def get_document(row: pd.Series) -> str:
198210 exit (1 )
199211
200212 # Compose path to remote input file
201- input_fpath = f"{ args .input_bucket } /{ args .object_key } "
213+ input_fpath = f"{ args .input_bucket } /{ args .input_object_key } "
202214
203215 # Compose path to remote output file
204- output_fpath = f"{ args .output_bucket } /{ OUTPUT_FNAME } "
216+ output_fpath = f"{ args .output_bucket } /{ args . output_object_key } "
205217
206218 # Compose storage transport parameters
207219 try :
@@ -211,11 +223,11 @@ def get_document(row: pd.Series) -> str:
211223 exit (1 )
212224 else :
213225 # Compose path to local input file
214- input_fpath = f"{ INPUT_DIR } /{ args .object_key } "
226+ input_fpath = f"{ INPUT_DIR } /{ args .input_object_key } "
215227
216228 # Compose path to local output file
217229 Path .mkdir (OUTPUT_DIR , exist_ok = True )
218- output_fpath = f"{ OUTPUT_DIR } /{ OUTPUT_FNAME } "
230+ output_fpath = f"{ OUTPUT_DIR } /{ args . output_object_key } "
219231
220232 # Compose storage transport parameters
221233 transport_params = {}
0 commit comments