This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
fixeria gerrit-no-reply at lists.osmocom.orgfixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmocom-bb/+/16086 )
Change subject: trx_toolkit: fix: do not use 'is' / 'is not' with string and numerical literals
......................................................................
trx_toolkit: fix: do not use 'is' / 'is not' with string and numerical literals
Since version 3.8, Python warnins us that using the "is" and "is not"
operators with string and numerical literals is a bad idea. Let's
avoid this and use the classical '==' and '!=' operators instead.
Change-Id: Iaed86d630ac1e0b9b4f72bbf3c788e325783456d
Bug description: https://bugs.python.org/issue34850
---
M src/target/trx_toolkit/fake_trx.py
M src/target/trx_toolkit/trx_sniff.py
2 files changed, 9 insertions(+), 9 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/86/16086/1
diff --git a/src/target/trx_toolkit/fake_trx.py b/src/target/trx_toolkit/fake_trx.py
index 8beee6e..f226f03 100755
--- a/src/target/trx_toolkit/fake_trx.py
+++ b/src/target/trx_toolkit/fake_trx.py
@@ -4,7 +4,7 @@
# TRX Toolkit
# Virtual Um-interface (fake transceiver)
#
-# (C) 2017-2018 by Vadim Yanitskiy <axilirator at gmail.com>
+# (C) 2017-2019 by Vadim Yanitskiy <axilirator at gmail.com>
#
# All Rights Reserved
#
@@ -22,7 +22,7 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-APP_CR_HOLDERS = [("2017-2018", "Vadim Yanitskiy <axilirator at gmail.com>")]
+APP_CR_HOLDERS = [("2017-2019", "Vadim Yanitskiy <axilirator at gmail.com>")]
import logging as log
import signal
@@ -131,7 +131,7 @@
@property
def toa256(self):
# Check if randomization is required
- if self.toa256_rand_threshold is 0:
+ if self.toa256_rand_threshold == 0:
return self.toa256_base
# Generate a random ToA value in required range
@@ -142,7 +142,7 @@
@property
def rssi(self):
# Check if randomization is required
- if self.rssi_rand_threshold is 0:
+ if self.rssi_rand_threshold == 0:
return self.rssi_base
# Generate a random RSSI value in required range
@@ -153,7 +153,7 @@
@property
def ci(self):
# Check if randomization is required
- if self.ci_rand_threshold is 0:
+ if self.ci_rand_threshold == 0:
return self.ci_base
# Generate a random C/I value in required range
@@ -165,7 +165,7 @@
# Returns: True - drop, False - keep
def sim_burst_drop(self, msg):
# Check if dropping is required
- if self.burst_drop_amount is 0:
+ if self.burst_drop_amount == 0:
return False
if msg.fn % self.burst_drop_period == 0:
@@ -212,7 +212,7 @@
self._handle_data_msg_v1(src_msg, msg)
# Apply optional Timing Advance
- if src_trx.ta is not 0:
+ if src_trx.ta != 0:
msg.toa256 -= src_trx.ta * 256
# Path loss simulation
@@ -384,7 +384,7 @@
def append_child_trx(self, remote_addr, base_port, child_idx, name = None):
# Index 0 corresponds to the first transceiver
- if child_idx is 0:
+ if child_idx == 0:
self.append_trx(remote_addr, base_port, name)
return
diff --git a/src/target/trx_toolkit/trx_sniff.py b/src/target/trx_toolkit/trx_sniff.py
index 7e5c2bd..6671c35 100755
--- a/src/target/trx_toolkit/trx_sniff.py
+++ b/src/target/trx_toolkit/trx_sniff.py
@@ -112,7 +112,7 @@
msg.validate()
except ValueError as e:
desc = msg.desc_hdr()
- if desc is "":
+ if desc == "":
desc = "parsing error"
log.warning("Ignoring an incorrect message (%s): %s" % (desc, e))
self.cnt_burst_dropped_num += 1
--
To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/16086
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: Iaed86d630ac1e0b9b4f72bbf3c788e325783456d
Gerrit-Change-Number: 16086
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <axilirator at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20191117/c31917c1/attachment.htm>