@@ -217,7 +217,6 @@ class ModemStatus(t.uint8_t, t.UndefinedEnum):
217217 "RE" : None ,
218218 "FR" : None ,
219219 "NR" : t .Bool ,
220- "SI" : None ,
221220 "CB" : t .uint8_t ,
222221 "ND" : t , # "optional 2-Byte NI value"
223222 "DN" : t .Bytes , # "up to 20-Byte printable ASCII string"
@@ -407,7 +406,7 @@ def frame_received(self, data):
407406 LOGGER .debug ("Frame received: %s" , command )
408407 data , rest = t .deserialize (data [1 :], COMMAND_RESPONSES [command ][1 ])
409408 try :
410- getattr (self , "_handle_%s" % ( command ,) )(* data )
409+ getattr (self , f "_handle_{ command } " )(* data )
411410 except AttributeError :
412411 LOGGER .error ("No '%s' handler. Data: %s" , command , binascii .hexlify (data ))
413412
@@ -419,9 +418,7 @@ def _handle_at_response(self, frame_id, cmd, status, value):
419418 status = ATCommandResult .ERROR
420419
421420 if status :
422- fut .set_exception (
423- RuntimeError ("AT Command response: {}" .format (status .name ))
424- )
421+ fut .set_exception (RuntimeError (f"AT Command response: { status .name } " ))
425422 return
426423
427424 response_type = AT_COMMANDS [cmd .decode ("ascii" )]
@@ -496,7 +493,7 @@ def _handle_tx_status(self, frame_id, nwk, tries, tx_status, dsc_status):
496493 ):
497494 fut .set_result (tx_status )
498495 else :
499- fut .set_exception (DeliveryError ("%s" % ( tx_status ,) ))
496+ fut .set_exception (DeliveryError (f" { tx_status } " ))
500497 except asyncio .InvalidStateError as ex :
501498 LOGGER .debug ("duplicate tx_status for %s nwk? State: %s" , nwk , ex )
502499
@@ -544,7 +541,7 @@ async def api_mode_at_commands(self, baudrate):
544541 if not await self .command_mode_at_cmd (cmd + "\r " ):
545542 LOGGER .debug ("No response to %s cmd" , cmd )
546543 return None
547- LOGGER .debug ("Successfuly sent %s cmd" , cmd )
544+ LOGGER .debug ("Successfully sent %s cmd" , cmd )
548545 self ._uart .reset_command_mode ()
549546 return True
550547
@@ -569,10 +566,8 @@ async def init_api_mode(self):
569566 return res
570567
571568 LOGGER .debug (
572- (
573- "Couldn't enter AT command mode at any known baudrate."
574- "Configure XBee manually for escaped API mode ATAP2"
575- )
569+ "Couldn't enter AT command mode at any known baudrate."
570+ "Configure XBee manually for escaped API mode ATAP2"
576571 )
577572 return False
578573
@@ -609,4 +604,4 @@ async def _probe(self) -> None:
609604 def __getattr__ (self , item ):
610605 if item in COMMAND_REQUESTS :
611606 return functools .partial (self ._command , item )
612- raise AttributeError ("Unknown command {}" . format ( item ) )
607+ raise AttributeError (f "Unknown command { item } " )
0 commit comments