From 2bd564ca225cbf1d02eb5025315bb67fe458ba00 Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Wed, 31 May 2017 18:19:30 -0700 Subject: mpm: Replaced xrange with range for better Python future-proofing --- mpm/python/usrp_mpm/cores/tdc_sync.py | 6 +++--- mpm/python/usrp_mpm/dboard_manager/eiscat.py | 2 +- mpm/python/usrp_mpm/dboard_manager/lmk_eiscat.py | 2 +- mpm/python/usrp_mpm/sysfs_gpio.py | 2 +- mpm/tools/mpm_debug.py | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) (limited to 'mpm') diff --git a/mpm/python/usrp_mpm/cores/tdc_sync.py b/mpm/python/usrp_mpm/cores/tdc_sync.py index c3cc308a0..6d680d32f 100644 --- a/mpm/python/usrp_mpm/cores/tdc_sync.py +++ b/mpm/python/usrp_mpm/cores/tdc_sync.py @@ -14,7 +14,7 @@ # along with this program. If not, see . # """ -TDC sync foo +TDC clock synchronization """ import time @@ -193,7 +193,7 @@ class ClockSynchronizer(object): # Now, read off 512 measurements and take the mean of them. num_meas = 256 # FIXME back to 512 self.log.trace("Reading {} TDC measurements from device...".format(num_meas)) - current_value = mean([measure_offset() for _ in xrange(num_meas)]) + current_value = mean([measure_offset() for _ in range(num_meas)]) # Run the initial value through the oracle to determine the adjustments to make. target_values = [135e-9,] # only one target for now that all DBs shift to @@ -232,7 +232,7 @@ class ClockSynchronizer(object): Return the offset (in seconds) the whatever what measured and whatever the reference is. """ - for _ in xrange(1000): # TODO replace with poll & timeout + for _ in range(1000): # TODO replace with poll & timeout rtc_offset_msb = self.peek32(self.RTC_OFFSET_1) updated = (rtc_offset_msb & 0x100) == 0x100 if updated: diff --git a/mpm/python/usrp_mpm/dboard_manager/eiscat.py b/mpm/python/usrp_mpm/dboard_manager/eiscat.py index 0b76c88ee..4a4d4a256 100644 --- a/mpm/python/usrp_mpm/dboard_manager/eiscat.py +++ b/mpm/python/usrp_mpm/dboard_manager/eiscat.py @@ -439,7 +439,7 @@ class EISCAT(DboardManagerBase): slot_idx, core_idx, self.log - ) for core_idx in xrange(2) + ) for core_idx in range(2) ] def _init_spi_devices(): " Returns abstraction layers to all the SPI devices " diff --git a/mpm/python/usrp_mpm/dboard_manager/lmk_eiscat.py b/mpm/python/usrp_mpm/dboard_manager/lmk_eiscat.py index d6975fea6..3affdc3e9 100644 --- a/mpm/python/usrp_mpm/dboard_manager/lmk_eiscat.py +++ b/mpm/python/usrp_mpm/dboard_manager/lmk_eiscat.py @@ -213,7 +213,7 @@ class LMK04828EISCAT(LMK04828): (0x132, ddly_value), # Hidden register. Write the same as previous based on inc/dec. (0x144, 0xB1), # Enable SYNC on outputs 2,4,6,12 )) - for x in xrange(abs(num_shifts)): + for x in range(abs(num_shifts)): self.poke8(0x142, 0x1) self.poke8(0x144, 0xFF) # Disable SYNC on all outputs diff --git a/mpm/python/usrp_mpm/sysfs_gpio.py b/mpm/python/usrp_mpm/sysfs_gpio.py index fd06ad10d..fa07921d8 100644 --- a/mpm/python/usrp_mpm/sysfs_gpio.py +++ b/mpm/python/usrp_mpm/sysfs_gpio.py @@ -121,7 +121,7 @@ class SysFSGPIO(object): E.g., if use_mask & 0x1 is True, it makes sure that 'gpioXXX' is exported. Also sets the DDRs. """ - gpio_list = [x for x in xrange(n_gpio) if (1<