Fix new UP031 errors from ruff 0.4.2

This commit is contained in:
Nicola Soranzo
2024-04-29 00:09:38 +01:00
parent 0e89124a13
commit 0629908541
127 changed files with 381 additions and 425 deletions
+3 -3
View File
@@ -85,7 +85,7 @@ def printquery(statement, bind=None):
"""
if isinstance(value, str):
value = value.replace("'", "''")
return "'%s'" % value
return f"'{value}'"
elif value is None:
return "NULL"
elif isinstance(value, (float, int)):
@@ -93,10 +93,10 @@ def printquery(statement, bind=None):
elif isinstance(value, decimal.Decimal):
return str(value)
elif isinstance(value, datetime.datetime):
return "TO_DATE('%s','YYYY-MM-DD HH24:MI:SS')" % value.strftime("%Y-%m-%d %H:%M:%S")
return f"TO_DATE('{value.strftime('%Y-%m-%d %H:%M:%S')}','YYYY-MM-DD HH24:MI:SS')"
else:
raise NotImplementedError("Don't know how to literal-quote value %r" % value)
raise NotImplementedError(f"Don't know how to literal-quote value {value!r}")
compiler = LiteralCompiler(dialect, statement)
print(compiler.process(statement))