提交 b30149bf authored 作者: Ricardo Vieira's avatar Ricardo Vieira 提交者: Ricardo Vieira

Use f-string instead of string concatenation

上级 a5320005
......@@ -201,9 +201,8 @@ def hash_from_code(msg: str | bytes) -> str:
# but Python 3 (unicode) strings don't.
if isinstance(msg, str):
msg = msg.encode()
# Python 3 does not like module names that start with
# a digit.
return "m" + hashlib.sha256(msg).hexdigest()
# Python 3 does not like module names that start with a digit.
return f"m{hashlib.sha256(msg).hexdigest()}"
def uniq(seq: Sequence) -> list:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论