@@ -83,9 +83,7 @@ def _deactivate_device(sdk, device_guid, change_device_name, purge_date):
83
83
try :
84
84
device = _change_device_activation (sdk , device_guid , "deactivate" )
85
85
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." )
89
87
if purge_date :
90
88
_update_cold_storage_purge_date (sdk , device_guid , purge_date )
91
89
if change_device_name and not device .data ["name" ].startswith ("deactivated_" ):
@@ -113,12 +111,10 @@ def _change_device_activation(sdk, device_guid, cmd_str):
113
111
sdk .devices .deactivate (device_id )
114
112
return device
115
113
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." )
119
115
except exceptions .Py42ForbiddenError :
120
116
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 } '."
122
118
)
123
119
124
120
@@ -509,14 +505,12 @@ def _add_backup_set_settings_to_dataframe(sdk, devices_dataframe):
509
505
def handle_row (guid ):
510
506
try :
511
507
current_device_settings = sdk .devices .get_settings (guid )
512
- except Exception as e :
508
+ except Exception as err :
513
509
return DataFrame .from_records (
514
510
[
515
511
{
516
512
"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 } " ,
520
514
}
521
515
]
522
516
)
@@ -591,8 +585,8 @@ def handle_row(**row):
591
585
sdk , row ["guid" ], row ["change_device_name" ], row ["purge_date" ]
592
586
)
593
587
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 } "
596
590
return row
597
591
598
592
result_rows = run_bulk_process (
@@ -615,8 +609,8 @@ def handle_row(**row):
615
609
try :
616
610
_reactivate_device (sdk , row ["guid" ])
617
611
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 } "
620
614
return row
621
615
622
616
result_rows = run_bulk_process (
0 commit comments