@@ -526,7 +526,7 @@ def _make_key(self, addr):
526526 :meta private:
527527 """
528528
529- return '{0}:{1}' . format ( addr ['host' ], addr ['port' ])
529+ return f" { addr ['host' ]} : { addr ['port' ]} "
530530
531531 def _get_new_state (self , unit ):
532532 """
@@ -546,38 +546,33 @@ def _get_new_state(self, unit):
546546 try :
547547 conn .connect ()
548548 except NetworkError as exc :
549- msg = "Failed to connect to {0}:{1}" .format (
550- unit .addr ['host' ], unit .addr ['port' ])
549+ msg = f"Failed to connect to { unit .addr ['host' ]} :{ unit .addr ['port' ]} "
551550 warn (msg , ClusterConnectWarning )
552551 return InstanceState (Status .UNHEALTHY )
553552
554553 try :
555554 resp = conn .call ('box.info' )
556555 except NetworkError as exc :
557- msg = "Failed to get box.info for {0}:{1}, reason: {2}" .format (
558- unit .addr ['host' ], unit .addr ['port' ], repr (exc ))
556+ msg = f"Failed to get box.info for { unit .addr ['host' ]} :{ unit .addr ['port' ]} , reason: { repr (exc )} "
559557 warn (msg , PoolTolopogyWarning )
560558 return InstanceState (Status .UNHEALTHY )
561559
562560 try :
563561 read_only = resp .data [0 ]['ro' ]
564562 except (IndexError , KeyError ) as exc :
565- msg = "Incorrect box.info response from {0}:{1}" .format (
566- unit .addr ['host' ], unit .addr ['port' ])
563+ msg = f"Incorrect box.info response from { unit .addr ['host' ]} :{ unit .addr ['port' ]} "
567564 warn (msg , PoolTolopogyWarning )
568565 return InstanceState (Status .UNHEALTHY )
569566
570567 try :
571568 status = resp .data [0 ]['status' ]
572569
573570 if status != 'running' :
574- msg = "{0}:{1} instance status is not 'running'" .format (
575- unit .addr ['host' ], unit .addr ['port' ])
571+ msg = f"{ unit .addr ['host' ]} :{ unit .addr ['port' ]} instance status is not 'running'"
576572 warn (msg , PoolTolopogyWarning )
577573 return InstanceState (Status .UNHEALTHY )
578574 except (IndexError , KeyError ) as exc :
579- msg = "Incorrect box.info response from {0}:{1}" .format (
580- unit .addr ['host' ], unit .addr ['port' ])
575+ msg = f"Incorrect box.info response from { unit .addr ['host' ]} :{ unit .addr ['port' ]} "
581576 warn (msg , PoolTolopogyWarning )
582577 return InstanceState (Status .UNHEALTHY )
583578
0 commit comments