44481b
From b4a53389c3e6ad41c836aa82998149f427fe1ad8 Mon Sep 17 00:00:00 2001
44481b
From: =?UTF-8?q?Tibor=20Dudl=C3=A1k?= <tdudlak@redhat.com>
44481b
Date: Tue, 10 Sep 2019 19:12:19 +0200
44481b
Subject: [PATCH] Do not use comparision with "is" for literals
44481b
MIME-Version: 1.0
44481b
Content-Type: text/plain; charset=UTF-8
44481b
Content-Transfer-Encoding: 8bit
44481b
44481b
There is a warning with python 3.8 at fedora rawhide about
44481b
comparision with "is" while running ipa-server install.
44481b
See: https://bugs.python.org/issue34850
44481b
44481b
Signed-off-by: Tibor Dudlák <tdudlak@redhat.com>
44481b
---
44481b
 yubico/yubikey_config.py  | 4 ++--
44481b
 yubico/yubikey_usb_hid.py | 6 +++---
44481b
 2 files changed, 5 insertions(+), 5 deletions(-)
44481b
44481b
diff --git a/yubico/yubikey_config.py b/yubico/yubikey_config.py
44481b
index b5a30c4..caeed02 100644
44481b
--- a/yubico/yubikey_config.py
44481b
+++ b/yubico/yubikey_config.py
44481b
@@ -475,12 +475,12 @@ def to_frame(self, slot=1):
44481b
         """
44481b
         data = self.to_string()
44481b
         payload = data.ljust(64, yubico_util.chr_byte(0x0))
44481b
-        if slot is 1:
44481b
+        if slot == 1:
44481b
             if self._update_config:
44481b
                 command = SLOT.UPDATE1
44481b
             else:
44481b
                 command = SLOT.CONFIG
44481b
-        elif slot is 2:
44481b
+        elif slot == 2:
44481b
             if self._update_config:
44481b
                 command = SLOT.UPDATE2
44481b
             else:
44481b
diff --git a/yubico/yubikey_usb_hid.py b/yubico/yubikey_usb_hid.py
44481b
index c07dcaa..b87ff3c 100644
44481b
--- a/yubico/yubikey_usb_hid.py
44481b
+++ b/yubico/yubikey_usb_hid.py
44481b
@@ -285,13 +285,13 @@ def _waitfor(self, mode, mask, may_block, timeout=2):
44481b
                         seconds_left = min(20, seconds_left)
44481b
                         wait_num = (seconds_left * 2) - 1 + 6
44481b
 
44481b
-            if mode is 'nand':
44481b
+            if mode == 'nand':
44481b
                 if not flags & mask == mask:
44481b
                     finished = True
44481b
                 else:
44481b
                     self._debug("Status %s (0x%x) has not cleared bits %s (0x%x)\n"
44481b
                                 % (bin(flags), flags, bin(mask), mask))
44481b
-            elif mode is 'and':
44481b
+            elif mode == 'and':
44481b
                 if flags & mask == mask:
44481b
                     finished = True
44481b
                 else:
44481b
@@ -303,7 +303,7 @@ def _waitfor(self, mode, mask, may_block, timeout=2):
44481b
             if not finished:
44481b
                 wait_num -= 1
44481b
                 if wait_num == 0:
44481b
-                    if mode is 'nand':
44481b
+                    if mode == 'nand':
44481b
                         reason = 'Timed out waiting for YubiKey to clear status 0x%x' % mask
44481b
                     else:
44481b
                         reason = 'Timed out waiting for YubiKey to set status 0x%x' % mask