Skip to content

Commit

Permalink
chore: lint: C0209: consider-using-f-string
Browse files Browse the repository at this point in the history
"Formatting a regular string which could be a f-string"
  • Loading branch information
zzarne committed Sep 17, 2021
1 parent 660af53 commit 8bf91ec
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions custom_components/badconga/app/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def handle_ping(self, _):
def handle_user_login(self, schema):
""" handle_user_login """
if schema.result != 0:
raise Exception('user login error ({})'.format(hex(schema.result)))
raise Exception(f'user login error ({ hex(schema.result) })')
if schema.body.deviceId == 0:
raise Exception('device not configured on this account')
self.set_session(
Expand All @@ -108,7 +108,7 @@ def handle_user_login(self, schema):
def handle_session_login(self, schema):
""" handle_session_login """
if schema.result != 0:
raise Exception('session login error ({})'.format(hex(schema.result)))
raise Exception(f'session login error ({ hex(schema.result) })')
self.trigger('login')

def handle_device_status(self, schema):
Expand All @@ -127,7 +127,7 @@ def handle_device_status(self, schema):
def handle_device_list(self, schema):
""" handle_device_list """
if schema.result != 0:
raise Exception('device list error ({})'.format(hex(schema.result)))
raise Exception(f'device list error ({ hex(schema.result) })')
if schema.body.deviceList.deviceId == 0:
raise Exception('device not configured on this account')
self.device.serial_number = schema.body.deviceList.serialNumber
Expand Down
6 changes: 3 additions & 3 deletions custom_components/badconga/app/opcode_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def read_string(data):
""" read_string """
(str_len,) = struct.unpack('=b', data.read(1))
if str_len:
(string,) = struct.unpack('{}s'.format(str_len), data.read(str_len))
(string,) = struct.unpack(f'{ str_len }s', data.read(str_len))
return string.decode('utf-8')
return ''

Expand Down Expand Up @@ -69,8 +69,8 @@ def read_area_info_list(parent, data):
message = parent.add()
message.CopyFrom(dict_to_message(schema_pb2.AreaInfo(), (area_id, area_type)))
if points:
message.x.extend(struct.unpack('{}f'.format(points), data.read(points * 4)))
message.y.extend(struct.unpack('{}f'.format(points), data.read(points * 4)))
message.x.extend(struct.unpack(f'{ points }f', data.read(points * 4)))
message.y.extend(struct.unpack(f'{ points }f', data.read(points * 4)))
data.read(points * 3 * 4) # dump values

def read_clean_room_info_list(parent, data):
Expand Down

0 comments on commit 8bf91ec

Please sign in to comment.