@@ -261,7 +261,7 @@ def cascade_operations(input_file, output_file, operations):
261261
262262###### CLI commands (Graph Related) ############################################################
263263def draw_graph (input_file , output_file ):
264- if os .path .splitext (input_file )[1 ] != ".xml" :
264+ if os .path .splitext (input_file )[1 ] != ".xml" and os . path . splitext ( input_file )[ 1 ] :
265265 print (f"{ Fore .RED } Error: Invalid input file. Please provide a valid XML file." )
266266 return
267267 print (f"{ Style .BRIGHT } { Fore .CYAN } Visualizing Graph: { input_file } { Style .RESET_ALL } " )
@@ -276,7 +276,7 @@ def draw_graph(input_file, output_file):
276276 print (f"{ Fore .RED } Error: did not produce an output file." )
277277
278278def most_active_user (input_file ):
279- if os .path .splitext (input_file )[1 ] != ".xml" :
279+ if os .path .splitext (input_file )[1 ] != ".xml" and os . path . splitext ( input_file )[ 1 ] :
280280 print (f"{ Fore .RED } Error: Invalid input file. Please provide a valid XML file." )
281281 return
282282 print (f"{ Style .BRIGHT } { Fore .CYAN } Finding most active user: { input_file } { Style .RESET_ALL } " )
@@ -291,7 +291,7 @@ def most_active_user(input_file):
291291 print (f"{ Fore .RED } Error finding most active user: { e } " )
292292
293293def most_influencer_user (input_file ):
294- if os .path .splitext (input_file )[1 ] != ".xml" :
294+ if os .path .splitext (input_file )[1 ] != ".xml" and os . path . splitext ( input_file )[ 1 ] :
295295 print (f"{ Fore .RED } Error: Invalid input file. Please provide a valid XML file." )
296296 return
297297 print (f"{ Style .BRIGHT } { Fore .CYAN } Finding most influential user: { input_file } { Style .RESET_ALL } " )
@@ -306,7 +306,7 @@ def most_influencer_user(input_file):
306306 print (f"{ Fore .RED } Error finding most influential user: { e } " )
307307
308308def mutual_users (input_file , ids ):
309- if os .path .splitext (input_file )[1 ] != ".xml" :
309+ if os .path .splitext (input_file )[1 ] != ".xml" and os . path . splitext ( input_file )[ 1 ] :
310310 print (f"{ Fore .RED } Error: Invalid input file. Please provide a valid XML file." )
311311 return
312312 print (f"{ Style .BRIGHT } { Fore .CYAN } Finding mutual users for IDs { ids } in { input_file } { Style .RESET_ALL } " )
@@ -322,7 +322,7 @@ def mutual_users(input_file, ids):
322322 print (f"{ Fore .RED } Error finding mutual users: { e } " )
323323
324324def suggest_users (input_file , user_id ):
325- if os .path .splitext (input_file )[1 ] != ".xml" :
325+ if os .path .splitext (input_file )[1 ] != ".xml" and os . path . splitext ( input_file )[ 1 ]:
326326 print (f"{ Fore .RED } Error: Invalid input file. Please provide a valid XML file." )
327327 return
328328 print (f"{ Style .BRIGHT } { Fore .CYAN } Suggesting users for user ID { user_id } in { input_file } { Style .RESET_ALL } " )
0 commit comments