@@ -52,25 +52,25 @@ def modify_septa_bus():
5252 otpv1_supported_route_type = '3'
5353 try :
5454 updated_rows = []
55- with open (txt_path_to_update , 'r' , newline = '' , encoding = 'utf-8' ) as csvfile :
55+ with open (txt_path_to_update , 'r' ) as csvfile :
5656 reader = csv .DictReader (csvfile )
5757 header = reader .fieldnames
5858 if column_to_update not in header :
59- raise ValueError (f" Column ' { column_to_update } ' not found in routes.txt" )
59+ raise ValueError (' Column %s not found in routes.txt' , column_to_update )
6060 for row in reader :
6161 if row [column_to_update ] == str (new_route_type ):
6262 row [column_to_update ] = str (otpv1_supported_route_type )
63- LOG .info (f" Converted route_id ' { row [ 'route_id' ] } ' from type { new_route_type } to { otpv1_supported_route_type } " )
63+ LOG .info (' Converted route_id {} from type {} to {}' . format ( row [ 'route_id' ], new_route_type , otpv1_supported_route_type ) )
6464 updated_rows .append (row )
6565
66- with open (txt_path_to_update , 'w' , newline = '' , encoding = 'utf-8' ) as csvfile :
66+ with open (txt_path_to_update , 'w' ) as csvfile :
6767 writer = csv .DictWriter (csvfile , fieldnames = header )
6868 writer .writeheader ()
6969 writer .writerows (updated_rows )
7070
7171 LOG .debug ('Modified %s' , txt_path_to_update )
7272 except Exception as e :
73- raise ValueError ('Error modifying %s: %s' , txt_path_to_update , e )
73+ raise ValueError ('Error modifying {}: {}' . format ( txt_path_to_update , e ) )
7474
7575def main ():
7676 filenames_to_modify = ['septa_bus' ]
0 commit comments