@@ -228,7 +228,7 @@ def aws_resource_names() -> Dict[str, Any]:
228228
229229 resptags = get_localhost_instance_tags ()
230230 if resptags :
231- in_tutorial_mode = "firesim-tutorial-username" in resptags .keys ()
231+ in_tutorial_mode = "firesim-tutorial-username" in list ( resptags .keys () )
232232 if not in_tutorial_mode :
233233 return base_dict
234234
@@ -566,15 +566,11 @@ def launch_instances(
566566
567567 if len (instances ):
568568 logging .info (
569- "Already have {} of {} {} instances." .format (
570- len (instances ), count , instancetype
571- )
569+ f"Already have { len (instances )} of { count } { instancetype } instances."
572570 )
573571 if len (instances ) < count :
574572 logging .info (
575- "Launching remaining {} {} instances" .format (
576- count - len (instances ), instancetype
577- )
573+ f"Launching remaining { count - len (instances )} { instancetype } instances"
578574 )
579575
580576 first_subnet_wraparound = None
@@ -612,7 +608,9 @@ def launch_instances(
612608 else [
613609 {
614610 "ResourceType" : "instance" ,
615- "Tags" : [{"Key" : k , "Value" : v } for k , v in tags .items ()],
611+ "Tags" : [
612+ {"Key" : k , "Value" : v } for k , v in list (tags .items ())
613+ ],
616614 },
617615 ]
618616 ),
@@ -645,9 +643,7 @@ def launch_instances(
645643
646644 time_elapsed = datetime .now () - first_subnet_wraparound
647645 logging .info (
648- "have been trying for {} using timeout of {}" .format (
649- time_elapsed , timeout
650- )
646+ f"have been trying for { time_elapsed } using timeout of { timeout } "
651647 )
652648 logging .info (
653649 """only {} of {} {} instances have been launched""" .format (
@@ -785,7 +781,7 @@ def get_instances_by_tag_type(
785781 v ,
786782 ],
787783 }
788- for k , v in tags .items ()
784+ for k , v in list ( tags .items () )
789785 ]
790786 instances = res .instances .filter (Filters = filters ) # type: ignore
791787 return list (instances )
@@ -807,7 +803,7 @@ def instances_sorted_by_avail_ip(
807803 """This returns a list of instance objects, first sorted by their private ip,
808804 then sorted by availability zone."""
809805 ips = get_private_ips_for_instances (instances )
810- ips_to_instances = zip (ips , instances )
806+ ips_to_instances = list ( zip (ips , instances ) )
811807 insts = sorted (ips_to_instances , key = lambda x : x [0 ])
812808 ip_sorted_insts = [x [1 ] for x in insts ]
813809 return sorted (ip_sorted_insts , key = lambda x : x .placement ["AvailabilityZone" ])
@@ -819,7 +815,7 @@ def instance_privateip_lookup_table(
819815 """Given a list of instances, construct a lookup table that goes from
820816 privateip -> instance obj"""
821817 ips = get_private_ips_for_instances (instances )
822- ips_to_instances = zip (ips , instances )
818+ ips_to_instances = list ( zip (ips , instances ) )
823819 return {ip : instance for (ip , instance ) in ips_to_instances }
824820
825821
@@ -1077,14 +1073,14 @@ def main(args: List[str]) -> int:
10771073 use_manager_security_group = parsed_args .use_manager_security_group ,
10781074 )
10791075 instids = get_instance_ids_for_instances (insts )
1080- print ("Instance IDs: {}" . format ( instids ) )
1076+ print (f "Instance IDs: { instids } " )
10811077 wait_on_instance_launches (insts )
1082- print ("Launched instance IPs: {}" . format ( get_private_ips_for_instances (insts )) )
1078+ print (f "Launched instance IPs: { get_private_ips_for_instances (insts )} " )
10831079 else : # "terminate"
10841080 insts = get_instances_with_filter (parsed_args .filters )
10851081 instids = [inst .instance_id for inst in insts ]
10861082 terminate_instances (instids , False )
1087- print ("Terminated instance IDs: {}" . format ( instids ) )
1083+ print (f "Terminated instance IDs: { instids } " )
10881084 return 0
10891085
10901086
0 commit comments