From 72c30250cb7aec0bcd8ecfde7cf040451e2882a8 Mon Sep 17 00:00:00 2001 From: Guido Petri <18634426+guidopetri@users.noreply.github.com> Date: Fri, 13 Oct 2023 20:58:28 -0400 Subject: [PATCH] fix comparisons to literals Change comparisons to literals from `is` to `==`. Comparisons to literals with `is` aren't Pythonic because `is` uses the underlying object ID to determine whether objects match, whereas `==` does a value comparison. By switching the comparisons to `==`, we have a more consistent set of comparisons, because we don't rely on object IDs but rather the values themselves, which is what we're looking for, anyhow. --- qds_sdk/commands.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/qds_sdk/commands.py b/qds_sdk/commands.py index 0966a9e2..931c3c79 100755 --- a/qds_sdk/commands.py +++ b/qds_sdk/commands.py @@ -1121,7 +1121,7 @@ def parse(cls, args): raise ParseError("dbtap_id and db_table are required", cls.optparser.format_help()) - if options.mode is "1": + if options.mode == "1": if options.hive_table is None: raise ParseError("hive_table is required for mode 1", cls.optparser.format_help()) @@ -1134,7 +1134,7 @@ def parse(cls, args): raise ParseError("db_update_mode should either be left blank for append " "mode or be 'updateonly' or 'allowinsert'", cls.optparser.format_help()) - if options.db_update_mode is "updateonly": + if options.db_update_mode == "updateonly": if options.db_update_keys is None: raise ParseError("db_update_keys is required when db_update_mode " "is 'updateonly'", @@ -1521,7 +1521,7 @@ def _callback(downloaded, total): `total`: Total file size to be downloaded (int) ''' - if (total is 0) or (downloaded == total): + if (total == 0) or (downloaded == total): return progress = downloaded*100/total sys.stderr.write('\r[{0}] {1}%'.format('#'*progress, progress))