From 0aebcba508207becd983d36a47f02c20c8b15c64 Mon Sep 17 00:00:00 2001 From: Mike Fiedler Date: Sun, 3 Jul 2022 13:37:49 +0000 Subject: [PATCH] refactor: update conditional syntax Use single-line ternary if/else introduced in Python 2.5. Signed-off-by: Mike Fiedler --- lib/sqlalchemy/sql/compiler.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py index 9cc928a810..5461a0dc24 100644 --- a/lib/sqlalchemy/sql/compiler.py +++ b/lib/sqlalchemy/sql/compiler.py @@ -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): -- 2.47.3