Change in gr-gsm[master]: Python 3 compatibility changes in fn_time.py

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/.

ptrkrysik gerrit-no-reply at lists.osmocom.org
Mon May 3 10:31:47 UTC 2021


ptrkrysik has submitted this change. ( https://gerrit.osmocom.org/c/gr-gsm/+/24082 )

Change subject: Python 3 compatibility changes in fn_time.py
......................................................................

Python 3 compatibility changes in fn_time.py

- Use range instead of xrange as it has been removed
- Use integer division operator (//)
- Import uniform and fn_time_delta_cpp only when started as a script
- Remove the unused imports

Change-Id: I268e0aec8fb8e6d490bfb8b0e9e6d169a9f6c352
---
M python/misc_utils/fn_time.py
1 file changed, 4 insertions(+), 4 deletions(-)

Approvals:
  ptrkrysik: Looks good to me, approved; Verified



diff --git a/python/misc_utils/fn_time.py b/python/misc_utils/fn_time.py
index 17c6295..93342bd 100644
--- a/python/misc_utils/fn_time.py
+++ b/python/misc_utils/fn_time.py
@@ -20,9 +20,6 @@
 # Boston, MA 02110-1301, USA.
 # 
 # 
-from math import floor, ceil
-from random import uniform
-from grgsm import fn_time_delta_cpp
 
 __hyper_frame = 26*51*2048
 __symb_rate = 13.0e6/48.0
@@ -72,10 +69,13 @@
 
 
 if __name__ == "__main__":
+    from random import uniform
+    from grgsm import fn_time_delta_cpp
+
     fn1 = 10000
     ts_ref = 4
     time1 = 10.5
-    for fn2 in xrange(__hyper_frame/2+fn1-10,__hyper_frame/2*10+fn1+100,10):
+    for fn2 in range(__hyper_frame//2+fn1-10,__hyper_frame//2*10+fn1+100,10):
         ts_x = int(uniform(0,8))
         time2 = time1 + (fn2-fn1)*__frame_period + (ts_x-ts_ref)*__ts_period
         error = uniform(-6200,6200)

-- 
To view, visit https://gerrit.osmocom.org/c/gr-gsm/+/24082
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: gr-gsm
Gerrit-Branch: master
Gerrit-Change-Id: I268e0aec8fb8e6d490bfb8b0e9e6d169a9f6c352
Gerrit-Change-Number: 24082
Gerrit-PatchSet: 1
Gerrit-Owner: ptrkrysik <ptrkrysik at gmail.com>
Gerrit-Reviewer: ptrkrysik <ptrkrysik at gmail.com>
Gerrit-Reviewer: vvvelichkov <vvvelichkov at gmail.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210503/6862f032/attachment.htm>


More information about the gerrit-log mailing list