File: 0001-Do-not-use-comparision-with-is-for-literals.patch

package info (click to toggle)
python-yubico 1.3.3-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 460 kB
  • sloc: python: 2,367; ansic: 128; xml: 20; makefile: 7
file content (69 lines) | stat: -rw-r--r-- 2,590 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
From b4a53389c3e6ad41c836aa82998149f427fe1ad8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tibor=20Dudl=C3=A1k?= <tdudlak@redhat.com>
Date: Tue, 10 Sep 2019 19:12:19 +0200
Subject: [PATCH] Do not use comparision with "is" for literals
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

There is a warning with python 3.8 at fedora rawhide about
comparision with "is" while running ipa-server install.
See: https://bugs.python.org/issue34850

Signed-off-by: Tibor Dudlák <tdudlak@redhat.com>
---
 yubico/yubikey_config.py  | 4 ++--
 yubico/yubikey_usb_hid.py | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/yubico/yubikey_config.py b/yubico/yubikey_config.py
index b5a30c4..caeed02 100644
--- a/yubico/yubikey_config.py
+++ b/yubico/yubikey_config.py
@@ -475,12 +475,12 @@ class YubiKeyConfig(object):
         """
         data = self.to_string()
         payload = data.ljust(64, yubico_util.chr_byte(0x0))
-        if slot is 1:
+        if slot == 1:
             if self._update_config:
                 command = SLOT.UPDATE1
             else:
                 command = SLOT.CONFIG
-        elif slot is 2:
+        elif slot == 2:
             if self._update_config:
                 command = SLOT.UPDATE2
             else:
diff --git a/yubico/yubikey_usb_hid.py b/yubico/yubikey_usb_hid.py
index c07dcaa..b87ff3c 100644
--- a/yubico/yubikey_usb_hid.py
+++ b/yubico/yubikey_usb_hid.py
@@ -285,13 +285,13 @@ class YubiKeyHIDDevice(object):
                         seconds_left = min(20, seconds_left)
                         wait_num = (seconds_left * 2) - 1 + 6
 
-            if mode is 'nand':
+            if mode == 'nand':
                 if not flags & mask == mask:
                     finished = True
                 else:
                     self._debug("Status %s (0x%x) has not cleared bits %s (0x%x)\n"
                                 % (bin(flags), flags, bin(mask), mask))
-            elif mode is 'and':
+            elif mode == 'and':
                 if flags & mask == mask:
                     finished = True
                 else:
@@ -303,7 +303,7 @@ class YubiKeyHIDDevice(object):
             if not finished:
                 wait_num -= 1
                 if wait_num == 0:
-                    if mode is 'nand':
+                    if mode == 'nand':
                         reason = 'Timed out waiting for YubiKey to clear status 0x%x' % mask
                     else:
                         reason = 'Timed out waiting for YubiKey to set status 0x%x' % mask
-- 
2.20.1