@@ -83,9 +83,7 @@ def _deactivate_device(sdk, device_guid, change_device_name, purge_date):
8383 try :
8484 device = _change_device_activation (sdk , device_guid , "deactivate" )
8585 except exceptions .Py42BadRequestError :
86- raise Code42CLIError (
87- "The device with GUID '{}' is in legal hold." .format (device_guid )
88- )
86+ raise Code42CLIError (f"The device with GUID '{ device_guid } ' is in legal hold." )
8987 if purge_date :
9088 _update_cold_storage_purge_date (sdk , device_guid , purge_date )
9189 if change_device_name and not device .data ["name" ].startswith ("deactivated_" ):
@@ -113,12 +111,10 @@ def _change_device_activation(sdk, device_guid, cmd_str):
113111 sdk .devices .deactivate (device_id )
114112 return device
115113 except exceptions .Py42NotFoundError :
116- raise Code42CLIError (
117- "The device with GUID '{}' was not found." .format (device_guid )
118- )
114+ raise Code42CLIError (f"The device with GUID '{ device_guid } ' was not found." )
119115 except exceptions .Py42ForbiddenError :
120116 raise Code42CLIError (
121- "Unable to {} the device with GUID '{}'." . format ( cmd_str , device_guid )
117+ f "Unable to { cmd_str } the device with GUID '{ device_guid } '."
122118 )
123119
124120
@@ -509,14 +505,12 @@ def _add_backup_set_settings_to_dataframe(sdk, devices_dataframe):
509505 def handle_row (guid ):
510506 try :
511507 current_device_settings = sdk .devices .get_settings (guid )
512- except Exception as e :
508+ except Exception as err :
513509 return DataFrame .from_records (
514510 [
515511 {
516512 "guid" : guid ,
517- "ERROR" : "Unable to retrieve device settings for {}: {}" .format (
518- guid , e
519- ),
513+ "ERROR" : f"Unable to retrieve device settings for { guid } : { err } " ,
520514 }
521515 ]
522516 )
@@ -591,8 +585,8 @@ def handle_row(**row):
591585 sdk , row ["guid" ], row ["change_device_name" ], row ["purge_date" ]
592586 )
593587 row ["deactivated" ] = "True"
594- except Exception as e :
595- row ["deactivated" ] = "False: {}" . format ( e )
588+ except Exception as err :
589+ row ["deactivated" ] = f "False: { err } "
596590 return row
597591
598592 result_rows = run_bulk_process (
@@ -615,8 +609,8 @@ def handle_row(**row):
615609 try :
616610 _reactivate_device (sdk , row ["guid" ])
617611 row ["reactivated" ] = "True"
618- except Exception as e :
619- row ["reactivated" ] = "False: {}" . format ( e )
612+ except Exception as err :
613+ row ["reactivated" ] = f "False: { err } "
620614 return row
621615
622616 result_rows = run_bulk_process (
0 commit comments