[pyupgrade] tests/ (#10347)

This commit is contained in:
Jonathan de Jong 2021-07-13 12:43:15 +02:00 committed by GitHub
parent 879d8c1ee1
commit 89cfc3dd98
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 45 additions and 58 deletions

View file

@ -550,12 +550,12 @@ class FakeRedisPubSubProtocol(Protocol):
if obj is None:
return "$-1\r\n"
if isinstance(obj, str):
return "${len}\r\n{str}\r\n".format(len=len(obj), str=obj)
return f"${len(obj)}\r\n{obj}\r\n"
if isinstance(obj, int):
return ":{val}\r\n".format(val=obj)
return f":{obj}\r\n"
if isinstance(obj, (list, tuple)):
items = "".join(self.encode(a) for a in obj)
return "*{len}\r\n{items}".format(len=len(obj), items=items)
return f"*{len(obj)}\r\n{items}"
raise Exception("Unrecognized type for encoding redis: %r: %r", type(obj), obj)