File: fix-syntaxwarnings-is-with-literals

package info (click to toggle)
python-mbed-ls 1.6.2%2Bdfsg-8
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 576 kB
  • sloc: python: 2,784; makefile: 32; sh: 14
file content (44 lines) | stat: -rw-r--r-- 1,773 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
From: Nick Morrott <nickm@debian.org>
Date: Sun, 13 Nov 2022 10:36:04 +0200
Subject: Fix SyntaxWarnings (using is comparing strings)

Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=985022
Forwarded: not-needed
Applied-Upstream: https://github.com/ARMmbed/mbed-os-tools/commit/9fd3e86f50967c374d968b06b508d6aeec31ac1c
Last-Update: 2022-02-06

Last-Update: 2022-02-06
---
 mbed_lstools/lstools_base.py      | 4 ++--
 mbed_lstools/platform_database.py | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/mbed_lstools/lstools_base.py b/mbed_lstools/lstools_base.py
index 7c8ba02..5d9b94f 100644
--- a/mbed_lstools/lstools_base.py
+++ b/mbed_lstools/lstools_base.py
@@ -361,9 +361,9 @@ class MbedLsToolsBase(object):
                     '-' remove mid from mocking entry
         @return Mocked structure (json format)
         """
-        if oper is '+':
+        if oper == '+':
             self.plat_db.add(mid, platform_name, permanent=True)
-        elif oper is '-':
+        elif oper == '-':
             self.plat_db.remove(mid, permanent=True)
         else:
             raise ValueError("oper can only be [+-]")
diff --git a/mbed_lstools/platform_database.py b/mbed_lstools/platform_database.py
index a7eaa68..a650e4f 100644
--- a/mbed_lstools/platform_database.py
+++ b/mbed_lstools/platform_database.py
@@ -501,7 +501,7 @@ class PlatformDatabase(object):
         as a dict.
         """
         logger.debug("Trying remove of %s", id)
-        if id is '*' and device_type in self._dbs[self._prim_db]:
+        if id == '*' and device_type in self._dbs[self._prim_db]:
             self._dbs[self._prim_db][device_type] = {}
         for db in self._dbs.values():
             if device_type in db and id in db[device_type]: