]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
refactor: update conditional syntax
authorMike Fiedler <miketheman@gmail.com>
Sun, 3 Jul 2022 13:37:49 +0000 (13:37 +0000)
committerMike Fiedler <miketheman@gmail.com>
Sun, 3 Jul 2022 13:37:49 +0000 (13:37 +0000)
Use single-line ternary if/else introduced in Python 2.5.

Signed-off-by: Mike Fiedler <miketheman@gmail.com>
lib/sqlalchemy/sql/compiler.py

index 9cc928a810899e464e3e55d601746aaca26d4ce2..5461a0dc24f60c1b5f11c7dc2aaf272f23b5bf92 100644 (file)
@@ -5212,9 +5212,9 @@ class DDLCompiler(Compiled):
             )
         return "ALTER TABLE %s DROP CONSTRAINT %s%s%s" % (
             self.preparer.format_table(drop.element.table),
-            drop.if_exists and "IF EXISTS " or "",
+            "IF EXISTS " if drop.if_exists else "",
             formatted_name,
-            drop.cascade and " CASCADE" or "",
+            " CASCADE" if drop.cascade else "",
         )
 
     def get_column_specification(self, column, **kwargs):