Fix string formatting type warning

This commit is contained in:
Joakim Soderlund 2019-11-29 22:57:58 +01:00
parent 271fa3cf96
commit c2a62dac38

View file

@ -110,14 +110,14 @@ class Index(Mapping[int, Dict[str, Any]]):
return -1, f"Unknown parser error: {e}".encode() return -1, f"Unknown parser error: {e}".encode()
if meta[0] != 123 or meta[-1] != 125: if meta[0] != 123 or meta[-1] != 125:
return -1, f"Malformed JSON object for {key}.".encode() return -1, f"Malformed JSON object for {key!r}.".encode()
try: try:
return int(key), serialize(json.loads(meta.decode())) return int(key), serialize(json.loads(meta.decode()))
except UnicodeDecodeError as e: except UnicodeDecodeError as e:
return -1, f"Incorrectly encoded index: {e}".encode() return -1, f"Incorrectly encoded index: {e}".encode()
except ValueError as e: except ValueError as e:
return -1, f"Malformed meta for {key}: {e}".encode() return -1, f"Malformed meta for {key!r}: {e}".encode()
class MemoryIndex(Index): class MemoryIndex(Index):