Index: chirp/bandplan.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/bandplan.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/bandplan.py (revision 94e21deb6ff7fc0f21a42d81f020121b059c1b8a) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2013 Sean Burford # # This program is free software: you can redistribute it and/or modify @@ -34,7 +35,7 @@ for tone in tones: assert tone in chirp_common.TONES, ( "tone %s not one of %s" % (tone, chirp_common.TONES)) - except AssertionError, e: + except AssertionError as e: raise ValueError("%s %s: %s" % (name, limits, e)) self.name = name Index: chirp/chirp_common.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/chirp_common.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/chirp_common.py (revision 83f364736678ae6000c8f4da1e48ab4113b78f69) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2008 Dan Smith # # This program is free software: you can redistribute it and/or modify @@ -153,7 +154,7 @@ return int(math.pow(10, (dBm - 30) / 10)) -class PowerLevel: +class PowerLevel(object): """Represents a power level supported by a radio""" def __init__(self, label, watts=0, dBm=0): @@ -228,7 +229,7 @@ pass -class Memory: +class Memory(object): """Base class for a single radio memory""" freq = 0 number = 0 @@ -634,7 +635,7 @@ super(BankModel, self).__init__(radio, name) -class MappingModelIndexInterface: +class MappingModelIndexInterface(object): """Interface for mappings with index capabilities""" def get_index_bounds(self): @@ -673,7 +674,7 @@ sys.stdout.write(os.linesep) -class RadioPrompts: +class RadioPrompts(object): """Radio prompt strings""" experimental = None pre_download = None @@ -684,7 +685,7 @@ BOOLEAN = [True, False] -class RadioFeatures: +class RadioFeatures(object): """Radio Feature Flags""" _valid_map = { # General @@ -875,13 +876,13 @@ lo, hi = self.memory_bounds if not self.has_infinite_number and \ (mem.number < lo or mem.number > hi) and \ - mem.extd_number not in self.valid_special_chans: + mem.extd_number not in self.valid_special_chans: msg = ValidationWarning("Location %i is out of range" % mem.number) msgs.append(msg) if (self.valid_modes and - mem.mode not in self.valid_modes and - mem.mode != "Auto"): + mem.mode not in self.valid_modes and + mem.mode != "Auto"): msg = ValidationError("Mode %s not supported" % mem.mode) msgs.append(msg) @@ -891,22 +892,22 @@ else: if mem.tmode == "Cross": if self.valid_cross_modes and \ - mem.cross_mode not in self.valid_cross_modes: + mem.cross_mode not in self.valid_cross_modes: msg = ValidationError("Cross tone mode %s not supported" % mem.cross_mode) msgs.append(msg) if self.has_dtcs_polarity and \ - mem.dtcs_polarity not in self.valid_dtcs_pols: + mem.dtcs_polarity not in self.valid_dtcs_pols: msg = ValidationError("DTCS Polarity %s not supported" % mem.dtcs_polarity) msgs.append(msg) if self.valid_dtcs_codes and \ - mem.dtcs not in self.valid_dtcs_codes: + mem.dtcs not in self.valid_dtcs_codes: msg = ValidationError("DTCS Code %03i not supported" % mem.dtcs) if self.valid_dtcs_codes and \ - mem.rx_dtcs not in self.valid_dtcs_codes: + mem.rx_dtcs not in self.valid_dtcs_codes: msg = ValidationError("DTCS Code %03i not supported" % mem.rx_dtcs) if self.valid_duplexes and mem.duplex not in self.valid_duplexes: @@ -933,7 +934,7 @@ if self.valid_bands and \ self.valid_duplexes and \ - mem.duplex in ["split", "-", "+"]: + mem.duplex in ["split", "-", "+"]: if mem.duplex == "split": freq = mem.offset elif mem.duplex == "-": @@ -953,7 +954,7 @@ if mem.power and \ self.valid_power_levels and \ - mem.power not in self.valid_power_levels: + mem.power not in self.valid_power_levels: msg = ValidationWarning("Power level %s not supported" % mem.power) msgs.append(msg) @@ -964,7 +965,7 @@ msg = ValidationError("Frequency requires %.2fkHz step" % required_step(mem.freq)) msgs.append(msg) - except errors.InvalidDataError, e: + except errors.InvalidDataError as e: msgs.append(str(e)) if self.valid_characters: @@ -1122,7 +1123,7 @@ def load_mmap(self, filename): """Load the radio's memory map from @filename""" - mapfile = file(filename, "rb") + mapfile = open(filename, "rb") self._mmap = memmap.MemoryMap(mapfile.read()) mapfile.close() self.process_mmap() @@ -1133,7 +1134,7 @@ If IOError raise a File Access Error Exception """ try: - mapfile = file(filename, "wb") + mapfile = open(filename, "wb") mapfile.write(self._mmap.get_packed()) mapfile.close() except IOError: @@ -1202,7 +1203,7 @@ pass -class IcomDstarSupport: +class IcomDstarSupport(object): """Base interface for radios supporting Icom's D-STAR technology""" MYCALL_LIMIT = (1, 1) URCALL_LIMIT = (1, 1) @@ -1233,15 +1234,16 @@ pass -class ExperimentalRadio: +class ExperimentalRadio(object): """Interface for experimental radios""" + @classmethod def get_experimental_warning(cls): return ("This radio's driver is marked as experimental and may " + "be unstable or unsafe to use.") -class Status: +class Status(object): """Clone status object for conveying clone progress to the UI""" name = "Job" msg = "Unknown" @@ -1480,6 +1482,6 @@ myfilter = ''.join( [ [replacechar, chr(x)][chr(x) in validcharset] - for x in xrange(256) + for x in range(256) ]) return astring.translate(myfilter) Index: chirp/detect.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/detect.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/detect.py (revision 94e21deb6ff7fc0f21a42d81f020121b059c1b8a) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2010 Dan Smith # # This program is free software: you can redistribute it and/or modify @@ -42,7 +43,7 @@ ser.baudrate = 9600 md = icf.get_model_data(ser) return _icom_model_data_to_rclass(md) - except errors.RadioError, e: + except errors.RadioError as e: LOG.error(e) # ICOM IC-91/92 Live-mode radios @ 4800/38400 baud Index: chirp/drivers/alinco.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/alinco.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/drivers/alinco.py (revision 94e21deb6ff7fc0f21a42d81f020121b059c1b8a) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2011 Dan Smith # 2016 Matt Weyland # @@ -199,7 +200,7 @@ self._mmap = self._download(self._memsize) except errors.RadioError: raise - except Exception, e: + except Exception as e: raise errors.RadioError("Failed to communicate with radio: %s" % e) self.process_mmap() @@ -208,7 +209,7 @@ self._upload(self._memsize) except errors.RadioError: raise - except Exception, e: + except Exception as e: raise errors.RadioError("Failed to communicate with radio: %s" % e) def get_raw_memory(self, number): Index: chirp/drivers/anytone.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/anytone.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/drivers/anytone.py (revision 94e21deb6ff7fc0f21a42d81f020121b059c1b8a) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2013 Dan Smith # # This program is free software: you can redistribute it and/or modify @@ -177,7 +178,7 @@ try: radio.pipe.write(data) radio.pipe.read(len(data)) - except Exception, e: + except Exception as e: LOG.error("Error writing to radio: %s" % e) raise errors.RadioError("Unable to write to radio") @@ -185,7 +186,7 @@ def _read(radio, length): try: data = radio.pipe.read(length) - except Exception, e: + except Exception as e: LOG.error("Error reading from radio: %s" % e) raise errors.RadioError("Unable to read from radio") Index: chirp/drivers/anytone_ht.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/anytone_ht.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/drivers/anytone_ht.py (revision 94e21deb6ff7fc0f21a42d81f020121b059c1b8a) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2015 Jim Unroe # # This program is free software: you can redistribute it and/or modify @@ -233,7 +234,7 @@ def _echo_write(radio, data): try: radio.pipe.write(data) - except Exception, e: + except Exception as e: LOG.error("Error writing to radio: %s" % e) raise errors.RadioError("Unable to write to radio") @@ -241,7 +242,7 @@ def _read(radio, length): try: data = radio.pipe.read(length) - except Exception, e: + except Exception as e: LOG.error("Error reading from radio: %s" % e) raise errors.RadioError("Unable to read from radio") @@ -930,7 +931,7 @@ else: LOG.debug("Setting %s = %s" % (setting, element.value)) setattr(obj, setting, element.value) - except Exception, e: + except Exception as e: LOG.debug(element.get_name()) raise Index: chirp/drivers/ap510.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/ap510.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/drivers/ap510.py (revision 83f364736678ae6000c8f4da1e48ab4113b78f69) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2014 Tom Hayward # # This program is free software: you can redistribute it and/or modify @@ -44,7 +45,7 @@ def drain(pipe): """Chew up any data waiting on @pipe""" - for x in xrange(3): + for x in range(3): buf = pipe.read(4096) if not buf: return @@ -53,7 +54,7 @@ def enter_setup(pipe): """Put AP510 in configuration mode.""" - for x in xrange(30): + for x in range(30): if x % 2: pipe.write("@SETUP") else: @@ -84,7 +85,7 @@ radio.pipe.write("@DISP") buf = "" - for status.cur in xrange(status.cur, status.max): + for status.cur in range(status.cur, status.max): buf += radio.pipe.read(1024) if buf.endswith("\r\n"): status.cur = status.max @@ -380,7 +381,7 @@ data = download(self) except errors.RadioError: raise - except Exception, e: + except Exception as e: raise errors.RadioError("Failed to communicate with radio: %s" % e) # _mmap isn't a Chirp MemoryMap, but since AP510Memory implements @@ -398,12 +399,12 @@ upload(self) except errors.RadioError: raise - except Exception, e: + except Exception as e: raise errors.RadioError("Failed to communicate with radio: %s" % e) def load_mmap(self, filename): """Load the radio's memory map from @filename""" - mapfile = file(filename, "rb") + mapfile = open(filename, "rb") data = mapfile.read() if data.startswith('\r\n00=%s 20141215' % self._model): self._mmap = AP510Memory20141215(data) Index: chirp/drivers/baofeng_common.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/baofeng_common.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/drivers/baofeng_common.py (revision 67117ad7beb06c5d5f0d33211d3b06eadbb9059d) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2016: # * Jim Unroe KC9HI, # @@ -14,6 +15,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import print_function + """common functions for Baofeng (or similar) handheld radios""" import time @@ -164,8 +167,8 @@ try: data = _do_ident(radio, magic) return data - except errors.RadioError, e: - print e + except errors.RadioError as e: + print(e) error = e time.sleep(2) if error: @@ -604,7 +607,7 @@ elif element.value.get_mutable(): LOG.debug("Setting %s = %s" % (setting, element.value)) setattr(obj, setting, element.value) - except Exception, e: + except Exception as e: LOG.debug(element.get_name()) raise @@ -618,6 +621,6 @@ value = int(val.get_value() * 10) LOG.debug("Setting fm_presets = %s" % (value)) self._memobj.fm_presets = value - except Exception, e: + except Exception as e: LOG.debug(element.get_name()) raise Index: chirp/drivers/baofeng_uv3r.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/baofeng_uv3r.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/drivers/baofeng_uv3r.py (revision 94e21deb6ff7fc0f21a42d81f020121b059c1b8a) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2011 Dan Smith # # This program is free software: you can redistribute it and/or modify @@ -51,7 +52,7 @@ for _i in range(0, 10): try: return _uv3r_prep(radio) - except errors.RadioError, e: + except errors.RadioError as e: time.sleep(1) raise e @@ -64,7 +65,7 @@ return do_download(radio, 0x0000, 0x0E40, 0x0010) except errors.RadioError: raise - except Exception, e: + except Exception as e: raise errors.RadioError("Failed to communicate with radio: %s" % e) @@ -75,7 +76,7 @@ return do_upload(radio, 0x0000, 0x0E40, 0x0010) except errors.RadioError: raise - except Exception, e: + except Exception as e: raise errors.RadioError("Failed to communicate with radio: %s" % e) @@ -622,7 +623,7 @@ else: LOG.debug("Setting %s = %s" % (setting, element.value)) setattr(obj, setting, element.value) - except Exception, e: + except Exception as e: LOG.debug(element.get_name()) raise @@ -638,7 +639,7 @@ LOG.debug("Setting fm_presets[%1i] = %s" % (index, value)) setting = self._memobj.fm_presets setting[index] = value - except Exception, e: + except Exception as e: LOG.debug(element.get_name()) raise Index: chirp/drivers/bj9900.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/bj9900.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/drivers/bj9900.py (revision 94e21deb6ff7fc0f21a42d81f020121b059c1b8a) @@ -1,3 +1,4 @@ +# coding=utf-8 # # Copyright 2015 Marco Filippi IZ3GME # @@ -178,7 +179,7 @@ self._mmap = self._clone_in() except errors.RadioError: raise - except Exception, e: + except Exception as e: raise errors.RadioError("Failed to communicate with radio: %s" % e) self.process_mmap() @@ -187,7 +188,7 @@ self._clone_out() except errors.RadioError: raise - except Exception, e: + except Exception as e: raise errors.RadioError("Failed to communicate with radio: %s" % e) def process_mmap(self): Index: chirp/drivers/bjuv55.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/bjuv55.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/drivers/bjuv55.py (revision 94e21deb6ff7fc0f21a42d81f020121b059c1b8a) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2013 Jens Jensen AF5MI # Based on work by Jim Unroe, Dan Smith, et al. # Special thanks to Mats SM0BTP for equipment donation. @@ -647,6 +648,6 @@ value = int(val.get_value() * 10 - 870) LOG.debug("Setting fm_preset = %s" % (value)) self._memobj.fm_preset = value - except Exception, e: + except Exception as e: LOG.debug(element.get_name()) raise Index: chirp/drivers/btech.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/btech.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/drivers/btech.py (revision 94e21deb6ff7fc0f21a42d81f020121b059c1b8a) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2016-2017: # * Pavel Milanes CO7WT, # * Jim Unroe KC9HI, @@ -396,7 +397,7 @@ except errors.RadioError: raise - except Exception, e: + except Exception as e: raise errors.RadioError("Error sending Magic to radio:\n%s" % e) @@ -755,7 +756,7 @@ _upload(self) except errors.RadioError: raise - except Exception, e: + except Exception as e: raise errors.RadioError("Error: %s" % e) def get_raw_memory(self, number): @@ -2761,7 +2762,7 @@ elif element.value.get_mutable(): LOG.debug("Setting %s = %s" % (setting, element.value)) setattr(obj, setting, element.value) - except Exception, e: + except Exception as e: LOG.debug(element.get_name()) raise Index: chirp/drivers/ft1d.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/ft1d.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/drivers/ft1d.py (revision 94e21deb6ff7fc0f21a42d81f020121b059c1b8a) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2010 Dan Smith # Copyright 2014 Angus Ainslie # @@ -1617,7 +1618,7 @@ except AttributeError as e: LOG.error("Setting %s is not in the memory map: %s" % (element.get_name(), e)) - except Exception, e: + except Exception as e: LOG.debug(element.get_name()) raise Index: chirp/drivers/ft2800.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/ft2800.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/drivers/ft2800.py (revision 94e21deb6ff7fc0f21a42d81f020121b059c1b8a) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2011 Dan Smith # # This program is free software: you can redistribute it and/or modify @@ -201,7 +202,7 @@ self._mmap = _download(self) except errors.RadioError: raise - except Exception, e: + except Exception as e: raise errors.RadioError("Failed to communicate with radio: %s" % e) LOG.info("Downloaded in %.2f sec" % (time.time() - start)) self.process_mmap() @@ -214,7 +215,7 @@ _upload(self) except errors.RadioError: raise - except Exception, e: + except Exception as e: raise errors.RadioError("Failed to communicate with radio: %s" % e) LOG.info("Uploaded in %.2f sec" % (time.time() - start)) Index: chirp/drivers/ft2900.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/ft2900.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/drivers/ft2900.py (revision 94e21deb6ff7fc0f21a42d81f020121b059c1b8a) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2011 Dan Smith # # FT-2900-specific modifications by Richard Cochran, @@ -537,7 +538,7 @@ self._mmap = _download(self) except errors.RadioError: raise - except Exception, e: + except Exception as e: raise errors.RadioError("Failed to communicate with radio: %s" % e) LOG.info("Downloaded in %.2f sec" % (time.time() - start)) self.process_mmap() @@ -549,7 +550,7 @@ _upload(self) except errors.RadioError: raise - except Exception, e: + except Exception as e: raise errors.RadioError("Failed to communicate with radio: %s" % e) LOG.info("Uploaded in %.2f sec" % (time.time() - start)) @@ -1210,7 +1211,7 @@ setattr(_settings, name, value) LOG.debug("Setting %s: %s" % (name, value)) - except Exception, e: + except Exception as e: LOG.debug(element.get_name()) raise Index: chirp/drivers/ft50.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/ft50.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/drivers/ft50.py (revision 94e21deb6ff7fc0f21a42d81f020121b059c1b8a) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2011 Dan Smith # # This program is free software: you can redistribute it and/or modify @@ -587,7 +588,7 @@ def _clone_out(radio): try: return __clone_out(radio) - except Exception, e: + except Exception as e: raise errors.RadioError("Failed to communicate with the radio: %s" % e) Index: chirp/drivers/ft60.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/ft60.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/drivers/ft60.py (revision 94e21deb6ff7fc0f21a42d81f020121b059c1b8a) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2011 Dan Smith # # This program is free software: you can redistribute it and/or modify @@ -403,7 +404,7 @@ self._mmap = _download(self) except errors.RadioError: raise - except Exception, e: + except Exception as e: raise errors.RadioError("Failed to communicate with radio: %s" % e) self.process_mmap() self.check_checksums() @@ -414,7 +415,7 @@ _upload(self) except errors.RadioError: raise - except Exception, e: + except Exception as e: raise errors.RadioError("Failed to communicate with radio: %s" % e) def process_mmap(self): @@ -716,7 +717,7 @@ setattr(_settings, name, value) LOG.debug("Setting %s: %s" % (name, value)) - except Exception, e: + except Exception as e: LOG.debug(element.get_name()) raise Index: chirp/drivers/ft7800.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/ft7800.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/drivers/ft7800.py (revision 94e21deb6ff7fc0f21a42d81f020121b059c1b8a) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2010 Dan Smith # # This program is free software: you can redistribute it and/or modify @@ -321,7 +322,7 @@ self._mmap = _download(self) except errors.RadioError: raise - except Exception, e: + except Exception as e: raise errors.RadioError("Failed to communicate with radio: %s" % e) LOG.info("Download finished in %i seconds" % (time.time() - start)) self.check_checksums() @@ -337,7 +338,7 @@ _upload(self) except errors.RadioError: raise - except Exception, e: + except Exception as e: raise errors.RadioError("Failed to communicate with radio: %s" % e) LOG.info("Upload finished in %i seconds" % (time.time() - start)) @@ -766,7 +767,7 @@ oldval = getattr(_settings, setting) LOG.debug("Setting %s(%s) <= %s" % (setting, oldval, newval)) setattr(_settings, setting, newval) - except Exception, e: + except Exception as e: LOG.debug(element.get_name()) raise Index: chirp/drivers/ft8100.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/ft8100.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/drivers/ft8100.py (revision 67117ad7beb06c5d5f0d33211d3b06eadbb9059d) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2010 Eric Allen # # This program is free software: you can redistribute it and/or modify @@ -13,6 +14,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import print_function + import time import os @@ -175,7 +178,7 @@ if _mem.duplex == DUPLEX.index("split"): tx_freq = int(_mem.offset) * 1000 - print self.VARIANT, number, tx_freq, mem.freq + print(self.VARIANT, number, tx_freq, mem.freq) mem.offset = tx_freq - mem.freq else: mem.offset = int(_mem.offset) * 1000 @@ -189,7 +192,7 @@ if not self._memobj.enables[byte] & bit and number != 1: mem.empty = True - print 'R', self.VARIANT, number, _mem.baud9600 + print('R', self.VARIANT, number, _mem.baud9600) return mem @@ -270,7 +273,7 @@ def _clone_out(radio): try: return __clone_out(radio) - except Exception, e: + except Exception as e: raise errors.RadioError("Failed to communicate with the radio: %s" % e) @@ -291,7 +294,7 @@ pos = 0 for block in radio._block_lengths: if os.getenv("CHIRP_DEBUG"): - print "\nSending %i-%i" % (pos, pos + block) + print("\nSending %i-%i" % (pos, pos + block)) out = radio.get_mmap()[pos:pos + block] # need to chew byte-by-byte here or else we lose the ACK...not sure why @@ -309,6 +312,6 @@ pos += block - print "Clone completed in %i seconds" % (time.time() - start) + print("Clone completed in %i seconds" % (time.time() - start)) return True Index: chirp/drivers/ft817.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/ft817.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/drivers/ft817.py (revision 94e21deb6ff7fc0f21a42d81f020121b059c1b8a) @@ -1,3 +1,4 @@ +# coding=utf-8 # # Copyright 2012 Filippi Marco # @@ -413,7 +414,7 @@ self._mmap = self._clone_in() except errors.RadioError: raise - except Exception, e: + except Exception as e: raise errors.RadioError("Failed to communicate with radio: %s" % e) self.process_mmap() @@ -422,7 +423,7 @@ self._clone_out() except errors.RadioError: raise - except Exception, e: + except Exception as e: raise errors.RadioError("Failed to communicate with radio: %s" % e) def process_mmap(self): Index: chirp/drivers/ft90.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/ft90.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/drivers/ft90.py (revision 94e21deb6ff7fc0f21a42d81f020121b059c1b8a) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2011 Dan Smith # Copyright 2013 Jens Jensen AF5MI # @@ -332,7 +333,7 @@ self._mmap = self._clone_in() except errors.RadioError: raise - except Exception, e: + except Exception as e: trace = traceback.format_exc() raise errors.RadioError( "Failed to communicate with radio: %s" % trace) @@ -343,7 +344,7 @@ self._clone_out() except errors.RadioError: raise - except Exception, e: + except Exception as e: trace = traceback.format_exc() raise errors.RadioError( "Failed to communicate with radio: %s" % trace) @@ -670,6 +671,6 @@ newval = self._dtmf2bbcd(newval) LOG.debug("Setting %s(%s) <= %s" % (setting, oldval, newval)) setattr(_settings, setting, newval) - except Exception, e: + except Exception as e: LOG.debug(element.get_name()) raise Index: chirp/drivers/ftm350.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/ftm350.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/drivers/ftm350.py (revision 94e21deb6ff7fc0f21a42d81f020121b059c1b8a) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2013 Dan Smith # # This program is free software: you can redistribute it and/or modify @@ -275,7 +276,7 @@ self._mmap = _clone_in(self) except errors.RadioError: raise - except Exception, e: + except Exception as e: raise errors.RadioError("Failed to download from radio (%s)" % e) self.process_mmap() @@ -284,7 +285,7 @@ _clone_out(self) except errors.RadioError: raise - except Exception, e: + except Exception as e: raise errors.RadioError("Failed to upload to radio (%s)" % e) def process_mmap(self): Index: chirp/drivers/generic_csv.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/generic_csv.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/drivers/generic_csv.py (revision 94e21deb6ff7fc0f21a42d81f020121b059c1b8a) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2008 Dan Smith # # This program is free software: you can redistribute it and/or modify @@ -160,9 +161,9 @@ val = typ(val) if hasattr(mem, attr): setattr(mem, attr, val) - except OmittedHeaderError, e: + except OmittedHeaderError as e: pass - except Exception, e: + except Exception as e: raise Exception("[%s] %s" % (attr, e)) return self._clean(headers, line, mem) @@ -176,7 +177,7 @@ self._blank() - f = file(self._filename, "rU") + f = open(self._filename, "rU") header = f.readline().strip() f.seek(0, 0) @@ -203,7 +204,7 @@ mem = self._parse_csv_data_line(header, line) if mem.number is None: raise Exception("Invalid Location field" % lineno) - except Exception, e: + except Exception as e: LOG.error("Line %i: %s", lineno, e) self.errors.append("Line %i: %s" % (lineno, e)) continue @@ -223,7 +224,7 @@ if filename: self._filename = filename - f = file(self._filename, "wb") + f = open(self._filename, "wb") writer = csv.writer(f, delimiter=chirp_common.SEPCHAR) writer.writerow(chirp_common.Memory.CSV_FORMAT) Index: chirp/drivers/generic_xml.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/generic_xml.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/drivers/generic_xml.py (revision 94e21deb6ff7fc0f21a42d81f020121b059c1b8a) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2008 Dan Smith # # This program is free software: you can redistribute it and/or modify @@ -29,7 +30,7 @@ try: ctx = libxml2.schemaNewParserCtxt(path) schema = ctx.schemaParse() - except libxml2.parserError, e: + except libxml2.parserError as e: LOG.error("Unable to load schema: %s" % e) LOG.error("Path: %s" % path) raise errors.RadioError("Unable to load schema") @@ -118,7 +119,7 @@ if filename: self._filename = filename - f = file(self._filename, "w") + f = open(self._filename, "w") f.write(self.doc.serialize(format=1)) f.close() Index: chirp/drivers/h777.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/h777.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/drivers/h777.py (revision ea406febfb9647e8400cf9d023352fc318ec8fd1) @@ -521,7 +521,7 @@ else: LOG.debug("Setting %s = %s" % (setting, element.value)) setattr(obj, setting, element.value) - except Exception, e: + except Exception as e: LOG.debug(element.get_name()) raise Index: chirp/drivers/ic9x.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/ic9x.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/drivers/ic9x.py (revision 67117ad7beb06c5d5f0d33211d3b06eadbb9059d) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2008 Dan Smith # # This program is free software: you can redistribute it and/or modify @@ -13,6 +14,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import print_function + import time import threading import logging @@ -181,7 +184,7 @@ LOG.debug("Done: %s" % mem) except errors.InvalidMemoryLocation: pass - except errors.InvalidDataError, e: + except errors.InvalidDataError as e: LOG.error("Error talking to radio: %s" % e) break @@ -417,8 +420,8 @@ import serial ser = IC9xRadioB(serial.Serial(port="/dev/ttyUSB1", baudrate=38400, timeout=0.1)) - print ser.get_urcall_list() - print "-- FOO --" + print(ser.get_urcall_list()) + print("-- FOO --") ser.set_urcall_list(["K7TAY", "FOOBAR", "BAZ"]) Index: chirp/drivers/ic9x_ll.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/ic9x_ll.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/drivers/ic9x_ll.py (revision 94e21deb6ff7fc0f21a42d81f020121b059c1b8a) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2008 Dan Smith # # This program is free software: you can redistribute it and/or modify @@ -60,7 +61,7 @@ try: start = buf.index("\xfe\xfe") end = buf[start:].index("\xfd") + start + 1 - except Exception, e: + except Exception as e: LOG.error("No trailing bit") break @@ -71,7 +72,7 @@ frame = IC92Frame() frame.from_raw(framedata[2:-1]) frames.append(frame) - except errors.InvalidDataError, e: + except errors.InvalidDataError as e: LOG.error("Broken frame: %s" % e) # LOG.debug("Parsed %i frames" % len(frames)) @@ -102,8 +103,9 @@ return _ic9x_parse_frames(data) -class IC92Frame: +class IC92Frame(object): """IC9x frame base class""" + def get_vfo(self): """Return the vfo number""" return ord(self._map[0]) @@ -153,13 +155,13 @@ return response[0] def __setitem__(self, start, value): - self._map[start+4] = value + self._map[start + 4] = value def __getitem__(self, index): - return self._map[index+4] + return self._map[index + 4] def __getslice__(self, start, end): - return self._map[start+4:end+4] + return self._map[start + 4:end + 4] class IC92GetBankFrame(IC92Frame): Index: chirp/drivers/icf.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/icf.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/drivers/icf.py (revision 94e21deb6ff7fc0f21a42d81f020121b059c1b8a) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2008 Dan Smith # # This program is free software: you can redistribute it and/or modify @@ -32,7 +33,7 @@ SAVE_PIPE = None -class IcfFrame: +class IcfFrame(object): """A single ICF communication frame""" src = 0 dst = 0 @@ -77,8 +78,9 @@ return frame, data[end+1:] -class RadioStream: +class RadioStream(object): """A class to make reading a stream of IcfFrames easier""" + def __init__(self, pipe): self.pipe = pipe self.data = "" @@ -108,7 +110,7 @@ frames.append(frame) self.data = rest - except errors.InvalidDataError, e: + except errors.InvalidDataError as e: LOG.error("Failed to parse frame (cmd=%i): %s" % (cmd, e)) return [] @@ -213,7 +215,7 @@ val = int("%s%s" % (bcddata[i], bcddata[i+1]), 16) i += 2 data += struct.pack("B", val) - except ValueError, e: + except ValueError as e: LOG.error("Failed to parse byte: %s" % e) break @@ -321,7 +323,7 @@ """Do a full clone out of the radio's memory""" try: return _clone_from_radio(radio) - except Exception, e: + except Exception as e: raise errors.RadioError("Failed to communicate with the radio: %s" % e) @@ -361,7 +363,7 @@ global SAVE_PIPE # Uncomment to save out a capture of what we actually write to the radio - # SAVE_PIPE = file("pipe_capture.log", "w", 0) + # SAVE_PIPE = open("pipe_capture.log", "w", 0) md = get_model_data(radio.pipe) @@ -411,7 +413,7 @@ """Initiate a full memory clone out to @radio""" try: return _clone_to_radio(radio) - except Exception, e: + except Exception as e: raise errors.RadioError("Failed to communicate with the radio: %s" % e) @@ -449,7 +451,7 @@ val = int("%s%s" % (data[i], data[i+1]), 16) i += 2 _mmap += struct.pack("B", val) - except ValueError, e: + except ValueError as e: LOG.debug("Failed to parse byte: %s" % e) break @@ -458,7 +460,7 @@ def read_file(filename): """Read an ICF file and return the model string and memory data""" - f = file(filename) + f = open(filename) mod_str = f.readline() dat = f.readlines() @@ -475,7 +477,7 @@ def is_9x_icf(filename): """Returns True if @filename is an IC9x ICF file""" - f = file(filename) + f = open(filename) mdata = f.read(8) f.close() @@ -484,7 +486,7 @@ def is_icf_file(filename): """Returns True if @filename is an ICF file""" - f = file(filename) + f = open(filename) data = f.readline() data += f.readline() f.close() Index: chirp/drivers/icq7.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/icq7.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/drivers/icq7.py (revision 94e21deb6ff7fc0f21a42d81f020121b059c1b8a) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2010 Dan Smith # # This program is free software: you can redistribute it and/or modify @@ -338,6 +339,6 @@ else: LOG.debug("Setting %s = %s" % (setting, element.value)) setattr(obj, setting, element.value) - except Exception, e: + except Exception as e: LOG.debug(element.get_name()) raise Index: chirp/drivers/kenwood_hmk.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/kenwood_hmk.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/drivers/kenwood_hmk.py (revision 94e21deb6ff7fc0f21a42d81f020121b059c1b8a) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2008 Dan Smith # Copyright 2012 Tom Hayward # @@ -79,7 +80,7 @@ self._blank() - f = file(self._filename, "r") + f = open(self._filename, "r") for line in f: if line.strip() == "// Memory Channels": break @@ -114,7 +115,7 @@ mem = self._parse_csv_data_line(header, line) if mem.number is None: raise Exception("Invalid Location field" % lineno) - except Exception, e: + except Exception as e: LOG.error("Line %i: %s" % (lineno, e)) self.errors.append("Line %i: %s" % (lineno, e)) continue Index: chirp/drivers/kenwood_itm.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/kenwood_itm.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/drivers/kenwood_itm.py (revision 94e21deb6ff7fc0f21a42d81f020121b059c1b8a) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2008 Dan Smith # Copyright 2012 Tom Hayward # @@ -85,7 +86,7 @@ self._blank() - f = file(self._filename, "r") + f = open(self._filename, "r") for line in f: if line.strip() == "// Conventional Data": break @@ -118,7 +119,7 @@ mem = self._parse_csv_data_line(header, line) if mem.number is None: raise Exception("Invalid Location field" % lineno) - except Exception, e: + except Exception as e: LOG.error("Line %i: %s" % (lineno, e)) self.errors.append("Line %i: %s" % (lineno, e)) continue Index: chirp/drivers/kguv8d.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/kguv8d.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/drivers/kguv8d.py (revision 94e21deb6ff7fc0f21a42d81f020121b059c1b8a) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2014 Ron Wellsted M0RNW # # This program is free software: you can redistribute it and/or modify @@ -376,7 +377,7 @@ self._mmap = self._download() except errors.RadioError: raise - except Exception, e: + except Exception as e: raise errors.RadioError("Failed to communicate with radio: %s" % e) self.process_mmap() @@ -393,7 +394,7 @@ return self._do_download(0, 32768, 64) except errors.RadioError: raise - except Exception, e: + except Exception as e: LOG.exception('Unknown error during download process') raise errors.RadioError("Failed to communicate with radio: %s" % e) @@ -426,7 +427,7 @@ self._do_upload(0, 32768, 64) except errors.RadioError: raise - except Exception, e: + except Exception as e: raise errors.RadioError("Failed to communicate with radio: %s" % e) return Index: chirp/drivers/kyd.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/kyd.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/drivers/kyd.py (revision 94e21deb6ff7fc0f21a42d81f020121b059c1b8a) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2014 Jim Unroe # Copyright 2014 Dan Smith # @@ -499,7 +500,7 @@ LOG.debug("Setting %s = %s" % (setting, element.value)) setattr(obj, setting, element.value) - except Exception, e: + except Exception as e: LOG.debug(element.get_name()) raise Index: chirp/drivers/kyd_IP620.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/kyd_IP620.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/drivers/kyd_IP620.py (revision 67117ad7beb06c5d5f0d33211d3b06eadbb9059d) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2015 Lepik.stv # based on modification of Dan Smith's and Jim Unroe original work # @@ -14,6 +15,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import print_function + """KYD IP-620 radios management module""" # TODO: Power on message @@ -181,7 +184,7 @@ self.pipe.write("\x06") except errors.RadioError: raise - except Exception, e: + except Exception as e: raise errors.RadioError("Radio refused to exit programming mode: %s" % e) def _ip620_enter_programming_mode(self): @@ -192,7 +195,7 @@ _ack = self.pipe.read(1) except errors.RadioError: raise - except Exception, e: + except Exception as e: raise errors.RadioError("Error communicating with radio: %s" % e) if not _ack: raise errors.RadioError("No response from radio") @@ -203,17 +206,17 @@ _ident = self.pipe.read(8) except errors.RadioError: raise - except Exception, e: + except Exception as e: raise errors.RadioError("Error communicating with radio: %s" % e) if not _ident.startswith("\x06\x4B\x47\x36\x37\x01\x56\xF8"): - print util.hexprint(_ident) + print(util.hexprint(_ident)) raise errors.RadioError("Radio returned unknown identification string") try: self.pipe.write(CMD_ACK) _ack = self.pipe.read(1) except errors.RadioError: raise - except Exception, e: + except Exception as e: raise errors.RadioError("Error communicating with radio: %s" % e) if _ack != CMD_ACK: raise errors.RadioError("Radio refused to enter programming mode") @@ -316,7 +319,7 @@ self._mmap = self._do_download() except errors.RadioError: raise - except Exception, e: + except Exception as e: raise errors.RadioError("Failed to communicate with radio: %s" % e) self.process_mmap() @@ -595,7 +598,7 @@ setattr(self._memobj.settings_misc, element.get_name(), element.value) - except Exception, e: + except Exception as e: LOG.debug(element.get_name()) raise @@ -622,6 +625,6 @@ setattr(_settings_misc, setting, newval) else: setattr(_settings, setting, newval) - except Exception, e: + except Exception as e: LOG.debug(element.get_name()) raise Index: chirp/drivers/leixen.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/leixen.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/drivers/leixen.py (revision 83f364736678ae6000c8f4da1e48ab4113b78f69) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2014 Tom Hayward # # This program is free software: you can redistribute it and/or modify @@ -225,7 +226,7 @@ ] MODES = ["NFM", "FM"] -WTFTONES = map(float, xrange(56, 64)) +WTFTONES = map(float, range(56, 64)) TONES = WTFTONES + chirp_common.TONES DTCS_CODES = [17, 50, 645] + chirp_common.DTCS_CODES DTCS_CODES.sort() @@ -260,7 +261,7 @@ # util.hexprint(frame).replace("\n", "\n "))) try: radio.pipe.write(frame) - except Exception, e: + except Exception as e: raise errors.RadioError("Failed to communicate with radio: %s" % e) @@ -425,7 +426,7 @@ def sync_in(self): try: self._mmap = do_download(self) - except Exception, e: + except Exception as e: finish(self) raise errors.RadioError("Failed to download from radio: %s" % e) self.process_mmap() @@ -440,7 +441,7 @@ except errors.RadioError: finish(self) raise - except Exception, e: + except Exception as e: raise errors.RadioError("Failed to upload to radio: %s" % e) def get_raw_memory(self, number): @@ -939,7 +940,7 @@ else: LOG.debug("Setting %s = %s" % (setting, element.value)) setattr(obj, setting, element.value) - except Exception, e: + except Exception as e: LOG.debug(element.get_name()) raise Index: chirp/drivers/lt725uv.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/lt725uv.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/drivers/lt725uv.py (revision 94e21deb6ff7fc0f21a42d81f020121b059c1b8a) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2016: # * Jim Unroe KC9HI, # @@ -730,7 +731,7 @@ elif element.value.get_mutable(): LOG.debug("Setting %s = %s" % (setting, element.value)) setattr(obj, setting, element.value) - except Exception, e: + except Exception as e: LOG.debug(element.get_name()) raise Index: chirp/drivers/puxing.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/puxing.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/drivers/puxing.py (revision 94e21deb6ff7fc0f21a42d81f020121b059c1b8a) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2011 Dan Smith # # This program is free software: you can redistribute it and/or modify @@ -47,7 +48,7 @@ for _i in range(0, 10): try: return _puxing_prep(radio) - except Exception, e: + except Exception as e: time.sleep(1) raise e @@ -60,7 +61,7 @@ return do_download(radio, 0x0000, 0x0C60, 0x0008) except errors.RadioError: raise - except Exception, e: + except Exception as e: raise errors.RadioError("Failed to communicate with radio: %s" % e) @@ -71,7 +72,7 @@ return do_upload(radio, 0x0000, 0x0C40, 0x0008) except errors.RadioError: raise - except Exception, e: + except Exception as e: raise errors.RadioError("Failed to communicate with radio: %s" % e) POWER_LEVELS = [chirp_common.PowerLevel("High", watts=5.00), @@ -370,7 +371,7 @@ return do_download(radio, 0x0000, 0x0FE0, 0x0010) except errors.RadioError: raise - except Exception, e: + except Exception as e: raise errors.RadioError("Failed to communicate with radio: %s" % e) @@ -381,7 +382,7 @@ return do_upload(radio, 0x0000, 0x0FE0, 0x0010) except errors.RadioError: raise - except Exception, e: + except Exception as e: raise errors.RadioError("Failed to communicate with radio: %s" % e) PUXING_2R_MEM_FORMAT = """ Index: chirp/drivers/retevis_rt1.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/retevis_rt1.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/drivers/retevis_rt1.py (revision 94e21deb6ff7fc0f21a42d81f020121b059c1b8a) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2016 Jim Unroe # # This program is free software: you can redistribute it and/or modify @@ -725,7 +726,7 @@ elif element.value.get_mutable(): LOG.debug("Setting %s = %s" % (setting, element.value)) setattr(obj, setting, element.value) - except Exception, e: + except Exception as e: LOG.debug(element.get_name()) raise Index: chirp/drivers/retevis_rt21.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/retevis_rt21.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/drivers/retevis_rt21.py (revision 94e21deb6ff7fc0f21a42d81f020121b059c1b8a) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2016 Jim Unroe # # This program is free software: you can redistribute it and/or modify @@ -553,6 +554,6 @@ elif element.value.get_mutable(): LOG.debug("Setting %s = %s" % (setting, element.value)) setattr(obj, setting, element.value) - except Exception, e: + except Exception as e: LOG.debug(element.get_name()) raise Index: chirp/drivers/retevis_rt22.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/retevis_rt22.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/drivers/retevis_rt22.py (revision 94e21deb6ff7fc0f21a42d81f020121b059c1b8a) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2016 Jim Unroe # # This program is free software: you can redistribute it and/or modify @@ -595,7 +596,7 @@ LOG.debug("Setting %s = %s" % (setting, element.value)) setattr(obj, setting, element.value) - except Exception, e: + except Exception as e: LOG.debug(element.get_name()) raise Index: chirp/drivers/rfinder.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/rfinder.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/drivers/rfinder.py (revision 94e21deb6ff7fc0f21a42d81f020121b059c1b8a) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2011 Dan Smith # # This program is free software: you can redistribute it and/or modify @@ -167,8 +168,9 @@ return direction -class RFinderParser: +class RFinderParser(object): """Parser for RFinder's data format""" + def __init__(self, lat, lon): self.__memories = [] self.__cheat = {} @@ -186,7 +188,7 @@ "lon": "%7.5f" % coords[1], "radius": "%i" % radius, "vers": "CH%s" % CHIRP_VERSION, - } + } _url = "https://www.rfinder.net/query.php?%s" % \ ("&".join(["%s=%s" % (k, v) for k, v in args.items()])) @@ -240,7 +242,7 @@ dist = distance(self.__lat, self.__lon, lat, lon) bear = fuzzy_to(self.__lat, self.__lon, lat, lon) mem.comment = "(%imi %s) %s" % (dist, bear, mem.comment) - except Exception, e: + except Exception as e: LOG.error("Failed to calculate distance: %s" % e) return mem @@ -258,7 +260,7 @@ mem.number = number number += 1 self.__memories.append(mem) - except Exception, e: + except Exception as e: import traceback LOG.error(traceback.format_exc()) LOG.error("Error in received data, cannot continue") Index: chirp/drivers/tdxone_tdq8a.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/tdxone_tdq8a.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/drivers/tdxone_tdq8a.py (revision 67117ad7beb06c5d5f0d33211d3b06eadbb9059d) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2016: # * Jim Unroe KC9HI, # @@ -14,6 +15,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import print_function import time import struct import logging @@ -301,8 +303,8 @@ try: data = _do_ident(radio, magic) return data - except errors.RadioError, e: - print e + except errors.RadioError as e: + print(e) error = e time.sleep(2) if error: @@ -426,7 +428,7 @@ if len(data) == 0x2008: rid = data[0x2000:0x2008] - print rid + print(rid) return rid.startswith(cls.MODEL) else: return False @@ -1116,7 +1118,7 @@ elif element.value.get_mutable(): LOG.debug("Setting %s = %s" % (setting, element.value)) setattr(obj, setting, element.value) - except Exception, e: + except Exception as e: LOG.debug(element.get_name()) raise @@ -1130,7 +1132,7 @@ value = int(val.get_value() * 10) LOG.debug("Setting fm_presets = %s" % (value)) self._memobj.fm_presets = value - except Exception, e: + except Exception as e: LOG.debug(element.get_name()) raise Index: chirp/drivers/th7800.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/th7800.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/drivers/th7800.py (revision 94e21deb6ff7fc0f21a42d81f020121b059c1b8a) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2014 Tom Hayward # Copyright 2014 Jens Jensen # Copyright 2014 James Lee N1DDK @@ -536,7 +537,7 @@ LOG.debug("Setting %s(%s) <= %s" % (setting, oldval, newval)) setattr(_settings, setting, newval) - except Exception, e: + except Exception as e: LOG.debug(element.get_name()) raise @@ -726,7 +727,7 @@ def sync_in(self): try: self._mmap = _download(self) - except Exception, e: + except Exception as e: raise errors.RadioError( "Failed to communicate with the radio: %s" % e) self.process_mmap() @@ -734,6 +735,6 @@ def sync_out(self): try: _upload(self) - except Exception, e: + except Exception as e: raise errors.RadioError( "Failed to communicate with the radio: %s" % e) Index: chirp/drivers/th9000.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/th9000.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/drivers/th9000.py (revision 94e21deb6ff7fc0f21a42d81f020121b059c1b8a) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2015 David Fannin KK6DF # # This program is free software: you can redistribute it and/or modify @@ -352,7 +353,7 @@ try: radio.pipe.write(data) radio.pipe.read(len(data)) - except Exception, e: + except Exception as e: LOG.error("Error writing to radio: %s" % e) raise errors.RadioError("Unable to write to radio") @@ -366,7 +367,7 @@ def _read(radio, length): try: data = radio.pipe.read(length) - except Exception, e: + except Exception as e: LOG.error( "Error reading from radio: %s" % e) raise errors.RadioError("Unable to read from radio") @@ -559,10 +560,10 @@ _mem = self._memobj.memory[number] # get flag info - cbyte = number / 8 ; - cbit = 7 - (number % 8) ; - setflag = self._memobj.csetflag[cbyte].c[cbit]; - skipflag = self._memobj.cskipflag[cbyte].c[cbit]; + cbyte = number / 8 + cbit = 7 - (number % 8) + setflag = self._memobj.csetflag[cbyte].c[cbit] + skipflag = self._memobj.cskipflag[cbyte].c[cbit] mem = chirp_common.Memory() @@ -792,7 +793,7 @@ else: LOG.debug( "Setting %s = %s" % (setting, element.value)) setattr(obj, setting, element.value) - except Exception, e: + except Exception as e: LOG.debug( element.get_name()) raise Index: chirp/drivers/th9800.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/th9800.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/drivers/th9800.py (revision 94e21deb6ff7fc0f21a42d81f020121b059c1b8a) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2014 Tom Hayward # Copyright 2014 Jens Jensen # Copyright 2014 James Lee N1DDK @@ -597,7 +598,7 @@ LOG.debug("Setting %s(%s) <= %s" % (setting, oldval, newval)) setattr(_settings, setting, newval) - except Exception, e: + except Exception as e: LOG.debug(element.get_name()) raise @@ -784,7 +785,7 @@ def sync_in(self): try: self._mmap = _download(self) - except Exception, e: + except Exception as e: raise errors.RadioError( "Failed to communicate with the radio: %s" % e) self.process_mmap() @@ -792,6 +793,6 @@ def sync_out(self): try: _upload(self) - except Exception, e: + except Exception as e: raise errors.RadioError( "Failed to communicate with the radio: %s" % e) Index: chirp/drivers/thd72.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/thd72.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/drivers/thd72.py (revision 67117ad7beb06c5d5f0d33211d3b06eadbb9059d) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2010 Vernon Mauery # Copyright 2016 Angus Ainslie # @@ -14,6 +15,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import print_function from chirp import chirp_common, errors, util, directory from chirp import bitwise, memmap from chirp.settings import RadioSettingGroup, RadioSetting, RadioSettings @@ -581,7 +583,7 @@ except AttributeError as e: LOG.error("Setting %s is not in the memory map: %s" % (element.get_name(), e)) - except Exception, e: + except Exception as e: LOG.debug(element.get_name()) raise @@ -738,9 +740,9 @@ return r def usage(): - print "Usage: %s <-i input.img>|<-o output.img> -p port " \ - "[[-f first-addr] [-l last-addr] | [-b list,of,blocks]]" % \ - sys.argv[0] + print("Usage: %s <-i input.img>|<-o output.img> -p port " \ + "[[-f first-addr] [-l last-addr] | [-b list,of,blocks]]" % \ + sys.argv[0]) sys.exit(1) opts, args = getopt.getopt(sys.argv[1:], "i:o:p:f:l:b:") @@ -789,8 +791,8 @@ if download: data = r.download(True, blocks) - file(fname, "wb").write(data) + open(fname, "wb").write(data) else: - r._mmap = file(fname, "rb").read(r._memsize) + r._mmap = open(fname, "rb").read(r._memsize) r.upload(blocks) - print "\nDone" + print("\nDone") Index: chirp/drivers/thuv1f.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/thuv1f.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/drivers/thuv1f.py (revision 94e21deb6ff7fc0f21a42d81f020121b059c1b8a) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2012 Dan Smith # # This program is free software: you can redistribute it and/or modify @@ -214,7 +215,7 @@ self._mmap = uvf1_download(self) except errors.RadioError: raise - except Exception, e: + except Exception as e: raise errors.RadioError("Failed to communicate with radio: %s" % e) self.process_mmap() @@ -223,7 +224,7 @@ uvf1_upload(self) except errors.RadioError: raise - except Exception, e: + except Exception as e: raise errors.RadioError("Failed to communicate with radio: %s" % e) @classmethod Index: chirp/drivers/tk760g.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/tk760g.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/drivers/tk760g.py (revision 83f364736678ae6000c8f4da1e48ab4113b78f69) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2016 Pavel Milanes, CO7WT, # # This program is free software: you can redistribute it and/or modify @@ -824,7 +825,7 @@ # building the data for the memmap fdata = "" - for k, v in data.iteritems(): + for k, v in data.items(): # posible bad data if k == 0: k = 1 @@ -914,7 +915,7 @@ do_upload(self) except errors.RadioError: raise - except Exception, e: + except Exception as e: raise errors.RadioError("Failed to communicate with radio: %s" % e) def process_mmap(self): Index: chirp/drivers/tk8102.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/tk8102.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/drivers/tk8102.py (revision 94e21deb6ff7fc0f21a42d81f020121b059c1b8a) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2013 Dan Smith # # This program is free software: you can redistribute it and/or modify @@ -188,7 +189,7 @@ except errors.RadioError: self.pipe.write("\x45") raise - except Exception, e: + except Exception as e: raise errors.RadioError("Failed to download from radio: %s" % e) self.process_mmap() @@ -201,7 +202,7 @@ except errors.RadioError: self.pipe.write("\x45") raise - except Exception, e: + except Exception as e: raise errors.RadioError("Failed to upload to radio: %s" % e) def get_raw_memory(self, number): Index: chirp/drivers/uv5r.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/uv5r.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/drivers/uv5r.py (revision 94e21deb6ff7fc0f21a42d81f020121b059c1b8a) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2012 Dan Smith # # This program is free software: you can redistribute it and/or modify @@ -513,7 +514,7 @@ try: data = _do_ident(radio, magic) return data - except errors.RadioError, e: + except errors.RadioError as e: LOG.error(e) error = e time.sleep(2) @@ -806,7 +807,7 @@ self._mmap = _do_download(self) except errors.RadioError: raise - except Exception, e: + except Exception as e: raise errors.RadioError("Failed to communicate with radio: %s" % e) self.process_mmap() @@ -815,7 +816,7 @@ _do_upload(self) except errors.RadioError: raise - except Exception, e: + except Exception as e: raise errors.RadioError("Failed to communicate with radio: %s" % e) def get_raw_memory(self, number): @@ -1704,7 +1705,7 @@ elif element.value.get_mutable(): LOG.debug("Setting %s = %s" % (setting, element.value)) setattr(obj, setting, element.value) - except Exception, e: + except Exception as e: LOG.debug(element.get_name()) raise @@ -1718,7 +1719,7 @@ value = int(val.get_value() * 10) LOG.debug("Setting fm_presets = %s" % (value)) self._memobj.fm_presets = value - except Exception, e: + except Exception as e: LOG.debug(element.get_name()) raise Index: chirp/drivers/uvb5.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/uvb5.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/drivers/uvb5.py (revision 83f364736678ae6000c8f4da1e48ab4113b78f69) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2013 Dan Smith # # This program is free software: you can redistribute it and/or modify @@ -176,7 +177,7 @@ def do_ident(radio): radio.pipe.timeout = 3 radio.pipe.write("\x05PROGRAM") - for x in xrange(10): + for x in range(10): ack = radio.pipe.read(1) if ack == '\x06': break @@ -327,7 +328,7 @@ self._mmap = do_download(self) except errors.RadioError: raise - except Exception, e: + except Exception as e: raise errors.RadioError("Failed to communicate with radio: %s" % e) self.process_mmap() @@ -336,7 +337,7 @@ do_upload(self) except errors.RadioError: raise - except Exception, e: + except Exception as e: raise errors.RadioError("Failed to communicate with radio: %s" % e) def process_mmap(self): @@ -763,7 +764,7 @@ else: LOG.debug("Setting %s = %s" % (setting, element.value)) setattr(obj, setting, element.value) - except Exception, e: + except Exception as e: LOG.debug(element.get_name()) raise @@ -779,7 +780,7 @@ LOG.debug("Setting fm_presets[%1i] = %s" % (index, value)) setting = self._memobj.fm_presets setting[index] = value - except Exception, e: + except Exception as e: LOG.debug(element.get_name()) raise Index: chirp/drivers/vgc.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/vgc.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/drivers/vgc.py (revision 94e21deb6ff7fc0f21a42d81f020121b059c1b8a) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2016: # * Jim Unroe KC9HI, # * Pavel Milanes CO7WT @@ -1409,7 +1410,7 @@ elif element.value.get_mutable(): LOG.debug("Setting %s = %s" % (setting, element.value)) setattr(obj, setting, element.value) - except Exception, e: + except Exception as e: LOG.debug(element.get_name()) raise Index: chirp/drivers/vx2.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/vx2.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/drivers/vx2.py (revision 94e21deb6ff7fc0f21a42d81f020121b059c1b8a) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2013 Jens Jensen # based on modification of Dan Smith's and Rick Farina's original work # @@ -746,6 +747,6 @@ newval = self._encode_chars(newval, 6) LOG.debug("Setting %s(%s) <= %s" % (setting, oldval, newval)) setattr(_settings, setting, newval) - except Exception, e: + except Exception as e: LOG.debug(element.get_name()) raise Index: chirp/drivers/vx3.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/vx3.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/drivers/vx3.py (revision 94e21deb6ff7fc0f21a42d81f020121b059c1b8a) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2011 Rick Farina # based on modification of Dan Smith's original work # @@ -973,6 +974,6 @@ newval = self._encode_chars(newval, 6) LOG.debug("Setting %s(%s) <= %s" % (setting, oldval, newval)) setattr(_settings, setting, newval) - except Exception, e: + except Exception as e: LOG.debug(element.get_name()) raise Index: chirp/drivers/vx8.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/vx8.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/drivers/vx8.py (revision 94e21deb6ff7fc0f21a42d81f020121b059c1b8a) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2010 Dan Smith # # This program is free software: you can redistribute it and/or modify @@ -1517,7 +1518,7 @@ except AttributeError as e: LOG.error("Setting %s is not in the memory map: %s" % (element.get_name(), e)) - except Exception, e: + except Exception as e: LOG.debug(element.get_name()) raise Index: chirp/drivers/vxa700.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/vxa700.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/drivers/vxa700.py (revision 94e21deb6ff7fc0f21a42d81f020121b059c1b8a) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2012 Dan Smith # # This program is free software: you can redistribute it and/or modify @@ -177,7 +178,7 @@ self._mmap = _download(self) except errors.RadioError: raise - except Exception, e: + except Exception as e: raise errors.RadioError("Failed to communicate " + "with the radio: %s" % e) self.process_mmap() @@ -192,7 +193,7 @@ _upload(self) except errors.RadioError: raise - except Exception, e: + except Exception as e: raise errors.RadioError("Failed to communicate " + "with the radio: %s" % e) Index: chirp/drivers/wouxun.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/wouxun.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/drivers/wouxun.py (revision 94e21deb6ff7fc0f21a42d81f020121b059c1b8a) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2011 Dan Smith # # This program is free software: you can redistribute it and/or modify @@ -274,7 +275,7 @@ return do_download(self, 0x0000, 0x2000, 0x0040) except errors.RadioError: raise - except Exception, e: + except Exception as e: raise errors.RadioError("Failed to communicate with radio: %s" % e) def _upload(self): @@ -285,7 +286,7 @@ return do_upload(self, 0x0000, 0x2000, 0x0010) except errors.RadioError: raise - except Exception, e: + except Exception as e: raise errors.RadioError("Failed to communicate with radio: %s" % e) def sync_in(self): @@ -657,7 +658,7 @@ else: LOG.debug("Setting %s = %s" % (setting, element.value)) setattr(obj, setting, element.value) - except Exception, e: + except Exception as e: LOG.debug(element.get_name()) raise @@ -679,7 +680,7 @@ else: setting = self._memobj.fm_presets_1 setting[index] = value - except Exception, e: + except Exception as e: LOG.debug(element.get_name()) raise @@ -689,7 +690,7 @@ setattr(self._memobj.freq_ranges, element.get_name(), encode_freq(int(element.value))) - except Exception, e: + except Exception as e: LOG.debug(element.get_name()) raise @@ -1394,7 +1395,7 @@ else: LOG.debug("Setting %s = %s" % (setting, element.value)) setattr(obj, setting, element.value) - except Exception, e: + except Exception as e: LOG.debug(element.get_name()) raise @@ -1416,7 +1417,7 @@ else: setting = self._memobj.fm_presets_1 setting[index] = value - except Exception, e: + except Exception as e: LOG.debug(element.get_name()) raise Index: chirp/drivers/yaesu_clone.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/yaesu_clone.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/drivers/yaesu_clone.py (revision 94e21deb6ff7fc0f21a42d81f020121b059c1b8a) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2010 Dan Smith # # This program is free software: you can redistribute it and/or modify @@ -96,7 +97,7 @@ def _clone_in(radio): try: return __clone_in(radio) - except Exception, e: + except Exception as e: raise errors.RadioError("Failed to communicate with the radio: %s" % e) @@ -156,12 +157,13 @@ def _clone_out(radio): try: return __clone_out(radio) - except Exception, e: + except Exception as e: raise errors.RadioError("Failed to communicate with the radio: %s" % e) -class YaesuChecksum: +class YaesuChecksum(object): """A Yaesu Checksum Object""" + def __init__(self, start, stop, address=None): self._start = start self._stop = stop @@ -177,7 +179,7 @@ def get_calculated(self, mmap): """Return the calculated value of the checksum""" cs = 0 - for i in range(self._start, self._stop+1): + for i in range(self._start, self._stop + 1): cs += ord(mmap[i]) return cs % 256 Index: chirp/platform.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/platform.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/platform.py (revision 67117ad7beb06c5d5f0d33211d3b06eadbb9059d) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2008 Dan Smith # # This program is free software: you can redistribute it and/or modify @@ -13,6 +14,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import print_function + import os import sys import glob @@ -45,7 +48,7 @@ ports.append((portname, "Unknown", "Serial")) win32file.CloseHandle(port) port = None - except Exception, e: + except Exception as e: pass return ports @@ -71,7 +74,7 @@ return sorted(l, key=natural_key) -class Platform: +class Platform(object): """Base class for platform-specific functions""" def __init__(self, basepath): @@ -231,6 +234,7 @@ def executable_path(self): """Return a full path to the program executable""" + def we_are_frozen(): return hasattr(sys, "frozen") @@ -329,7 +333,7 @@ def os_version_string(self): try: - issue = file("/etc/issue.net", "r") + issue = open("/etc/issue.net", "r") ver = issue.read().strip().replace("\r", "").replace("\n", "")[:64] issue.close() ver = "%s - %s" % (os.uname()[0], ver) @@ -373,7 +377,7 @@ def list_serial_ports(self): try: ports = list(comports()) - except Exception, e: + except Exception as e: if comports != win32_comports_bruteforce: LOG.error("Failed to detect win32 serial ports: %s" % e) ports = win32_comports_bruteforce() @@ -390,7 +394,7 @@ try: fname, _, _ = win32gui.GetOpenFileNameW(Filter=typestrs) - except Exception, e: + except Exception as e: LOG.error("Failed to get filename: %s" % e) return None @@ -421,7 +425,7 @@ CustomFilter=custom, DefExt=def_ext, Filter=typestrs) - except Exception, e: + except Exception as e: LOG.error("Failed to get filename: %s" % e) return None @@ -433,7 +437,7 @@ try: pidl, _, _ = shell.SHBrowseForFolder() fname = shell.SHGetPathFromIDList(pidl) - except Exception, e: + except Exception as e: LOG.error("Failed to get directory: %s" % e) return None @@ -475,16 +479,16 @@ def _do_test(): __pform = get_platform() - print "Config dir: %s" % __pform.config_dir() - print "Default dir: %s" % __pform.default_dir() - print "Log file (foo): %s" % __pform.log_file("foo") - print "Serial ports: %s" % __pform.list_serial_ports() - print "OS Version: %s" % __pform.os_version_string() + print("Config dir: %s" % __pform.config_dir()) + print("Default dir: %s" % __pform.default_dir()) + print("Log file (foo): %s" % __pform.log_file("foo")) + print("Serial ports: %s" % __pform.list_serial_ports()) + print("OS Version: %s" % __pform.os_version_string()) # __pform.open_text_file("d-rats.py") - # print "Open file: %s" % __pform.gui_open_file() - # print "Save file: %s" % __pform.gui_save_file(default_name="Foo.txt") - print "Open folder: %s" % __pform.gui_select_dir("/tmp") + # print("Open file: %s" % __pform.gui_open_file()) + # print("Save file: %s" % __pform.gui_save_file(default_name="Foo.txt")) + print("Open folder: %s" % __pform.gui_select_dir("/tmp")) if __name__ == "__main__": _do_test() Index: chirp/pyPEG.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/pyPEG.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/pyPEG.py (revision f42ee3682381917f11f06b2deb690352fa37b86a) @@ -1,3 +1,4 @@ +# coding=utf-8 # YPL parser 1.5 # written by VB. @@ -5,7 +6,6 @@ import re import sys import codecs -import exceptions class keyword(unicode): @@ -52,14 +52,14 @@ def __repr__(self): return unicode(self) -word_regex = re.compile(ur"\w+") -rest_regex = re.compile(ur".*") +word_regex = re.compile(r"\w+") +rest_regex = re.compile(r".*") print_trace = False def u(text): - if isinstance(text, exceptions.BaseException): + if isinstance(text, BaseException): text = text.args[0] if type(text) is unicode: return text @@ -377,7 +377,7 @@ if text: raise SyntaxError() - except SyntaxError, msg: + except SyntaxError as msg: parsed = textlen - p.restlen textlen = 0 nn, lineNo, file = 0, 0, u"" Index: chirp/radioreference.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/radioreference.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/radioreference.py (revision 67117ad7beb06c5d5f0d33211d3b06eadbb9059d) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2012 Tom Hayward # # This program is free software: you can redistribute it and/or modify @@ -13,6 +14,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import print_function + import logging from chirp import chirp_common, errors @@ -72,7 +75,7 @@ service = self._client.service zipcode = service.getZipcodeInfo(self._zip, self._auth) county = service.getCountyInfo(zipcode.ctid, self._auth) - except WebFault, err: + except WebFault as err: raise errors.RadioError(err) status = chirp_common.Status() @@ -185,8 +188,8 @@ username=sys.argv[2], password=sys.argv[3]) rrr.do_fetch() - print rrr.get_raw_memory(0) - print rrr.get_memory(0) + print(rrr.get_raw_memory(0)) + print(rrr.get_memory(0)) if __name__ == "__main__": main() Index: chirp/ui/clone.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/ui/clone.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/ui/clone.py (revision 67117ad7beb06c5d5f0d33211d3b06eadbb9059d) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2008 Dan Smith # # This program is free software: you can redistribute it and/or modify @@ -13,6 +14,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import print_function + import collections import threading import logging @@ -29,7 +32,7 @@ AUTO_DETECT_STRING = "Auto Detect (Icom Only)" -class CloneSettings: +class CloneSettings(object): def __init__(self): self.port = None self.radio_class = None @@ -177,7 +180,7 @@ raise Exception( _("Unable to detect radio on {port}").format( port=cs.port)) - except Exception, e: + except Exception as e: d = inputdialog.ExceptionDialog(e) d.run() d.destroy() @@ -249,7 +252,7 @@ self.__radio.sync_in() emsg = None - except Exception, e: + except Exception as e: common.log_exception() LOG.error(_("Clone failed: {error}").format(error=e)) emsg = e @@ -268,4 +271,4 @@ if __name__ == "__main__": d = CloneSettingsDialog("/dev/ttyUSB0") r = d.run() - print r + print(r) Index: chirp/ui/common.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/ui/common.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/ui/common.py (revision 94e21deb6ff7fc0f21a42d81f020121b059c1b8a) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2008 Dan Smith # # This program is free software: you can redistribute it and/or modify @@ -84,7 +85,7 @@ LOG.debug(" ".join(args)) -class RadioJob: +class RadioJob(object): def __init__(self, cb, func, *args, **kwargs): self.cb = cb self.cb_args = () @@ -114,9 +115,9 @@ str(self.kwargs))) DBG(self.desc) result = func(*self.args, **self.kwargs) - except errors.InvalidMemoryLocation, e: + except errors.InvalidMemoryLocation as e: result = e - except Exception, e: + except Exception as e: LOG.error("Exception running RadioJob: %s" % e) log_exception() LOG.error("Job Args: %s" % str(self.args)) @@ -134,7 +135,7 @@ try: func = getattr(self.target, self.func) - except AttributeError, e: + except AttributeError as e: LOG.error("No such radio function `%s' in %s" % (self.func, self.target)) return Index: chirp/ui/editorset.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/ui/editorset.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/ui/editorset.py (revision 94e21deb6ff7fc0f21a42d81f020121b059c1b8a) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2008 Dan Smith # # This program is free software: you can redistribute it and/or modify @@ -296,7 +297,7 @@ common.show_error("Memory editor must be selected before import") try: src_radio = directory.get_radio_by_image(filen) - except Exception, e: + except Exception as e: common.show_error(e) return @@ -310,7 +311,7 @@ try: src_radio.status_fn = status src_radio.do_fetch() - except Exception, e: + except Exception as e: common.show_error(e) ww.hide() return @@ -319,7 +320,7 @@ try: if src_radio.get_features().has_sub_devices: src_radio = self.choose_sub_device(src_radio) - except Exception, e: + except Exception as e: common.show_error(e) return @@ -335,7 +336,7 @@ src_radio, self.rthread) reporting.report_model_usage(src_radio, "importsrc", True) - except Exception, e: + except Exception as e: common.log_exception() common.show_error(_("There was an error during " "import: {error}").format(error=e)) @@ -348,7 +349,7 @@ dst_radio = generic_xml.XMLRadio(filen) else: raise Exception(_("Unsupported file type")) - except Exception, e: + except Exception as e: common.log_exception() common.show_error(e) return @@ -361,7 +362,7 @@ count = self._do_import_locked(importdialog.ExportDialog, self.rthread.radio, dst_rthread) - except Exception, e: + except Exception as e: common.log_exception() common.show_error(_("There was an error during " "export: {error}").format(error=e), @@ -376,7 +377,7 @@ try: dst_radio.save(filename=filen) - except Exception, e: + except Exception as e: common.log_exception() common.show_error(_("There was an error during " "export: {error}").format(error=e), Index: chirp/ui/importdialog.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/ui/importdialog.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/ui/importdialog.py (revision 67117ad7beb06c5d5f0d33211d3b06eadbb9059d) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2008 Dan Smith # # This program is free software: you can redistribute it and/or modify @@ -13,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import print_function import gtk import gobject import pango @@ -265,7 +267,7 @@ {"number": new, "name": name, "comment": comm}) - except import_logic.ImportError, e: + except import_logic.ImportError as e: LOG.error(e) error_messages[new] = str(e) continue @@ -518,7 +520,7 @@ except errors.InvalidMemoryLocation: LOG.error("Location %i empty or at limit of destination radio" % number) - except errors.InvalidDataError, e: + except errors.InvalidDataError as e: LOG.error("Got error from radio, assuming %i beyond limits: %s" % (number, e)) @@ -529,9 +531,9 @@ self.ww.set(float(i) / end) try: mem = self.src_radio.get_memory(i) - except errors.InvalidMemoryLocation, e: + except errors.InvalidMemoryLocation as e: continue - except Exception, e: + except Exception as e: self.__store.append(row=(False, i, i, @@ -651,4 +653,4 @@ d = ImportDialog(radio) d.run() - print d.get_import_list() + print(d.get_import_list()) Index: chirp/ui/mainapp.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/ui/mainapp.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/ui/mainapp.py (revision 83f364736678ae6000c8f4da1e48ab4113b78f69) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2008 Dan Smith # Copyright 2012 Tom Hayward # @@ -14,6 +15,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import print_function from datetime import datetime import os import tempfile @@ -45,7 +47,7 @@ try: import serial -except ImportError, e: +except ImportError as e: common.log_exception() common.show_error("\nThe Pyserial module is not installed!") @@ -356,7 +358,7 @@ if not radio: return LOG.debug("Manually selected %s" % radio) - except Exception, e: + except Exception as e: common.log_exception() common.show_error(os.path.basename(fname) + ": " + str(e)) return @@ -366,7 +368,7 @@ eset = editorset.EditorSet(radio, self, filename=fname, tempname=tempname) - except Exception, e: + except Exception as e: common.log_exception() common.show_error( _("There was an error opening {fname}: {error}").format( @@ -472,7 +474,7 @@ try: eset.save(fname) - except Exception, e: + except Exception as e: d = inputdialog.ExceptionDialog(e) d.run() d.destroy() @@ -555,7 +557,7 @@ try: shutil.copy(fn, stock_dir) LOG.debug("Copying %s -> %s" % (fn, stock_dir)) - except Exception, e: + except Exception as e: LOG.error("Unable to copy %s to %s: %s" % (fn, stock_dir, e)) return False return True @@ -565,7 +567,7 @@ if not os.path.isdir(stock_dir): try: os.mkdir(stock_dir) - except Exception, e: + except Exception as e: LOG.error("Unable to create directory: %s" % stock_dir) return if not self.copy_shipped_stock_configs(stock_dir): @@ -680,7 +682,7 @@ rtscts=rclass.HARDWARE_FLOW, timeout=0.25) ser.flushInput() - except serial.SerialException, e: + except serial.SerialException as e: d = inputdialog.ExceptionDialog(e) d.run() d.destroy() @@ -725,7 +727,7 @@ rtscts=radio.HARDWARE_FLOW, timeout=0.25) ser.flushInput() - except serial.SerialException, e: + except serial.SerialException as e: d = inputdialog.ExceptionDialog(e) d.run() d.destroy() @@ -859,7 +861,7 @@ radio = dmrmarc.DMRMARCRadio(None) radio.set_params(city, state, country) self.do_open_live(radio, read_only=True) - except errors.RadioError, e: + except errors.RadioError as e: common.show_error(e) self.window.set_cursor(None) @@ -970,7 +972,7 @@ query = query % (code, band and band or "%%", county and county or "%%") - print query + print(query) # Do this in case the import process is going to take a while # to make sure we process events leading up to this @@ -994,11 +996,11 @@ ("query=%s\n" % query) + ("\n") + ("\n".join(radio.errors))) - except errors.InvalidDataError, e: + except errors.InvalidDataError as e: common.show_error(str(e)) self.window.set_cursor(None) return - except Exception, e: + except Exception as e: common.log_exception() reporting.report_model_usage(radio, "import", True) @@ -1076,7 +1078,7 @@ query = "https://www.repeaterbook.com/repeaters/downloads/CHIRP/" \ "app_direct.php?loc=%s&band=%s&dist=%s" % (loc, band, dist) - print query + print(query) # Do this in case the import process is going to take a while # to make sure we process events leading up to this @@ -1100,11 +1102,11 @@ ("query=%s\n" % query) + ("\n") + ("\n".join(radio.errors))) - except errors.InvalidDataError, e: + except errors.InvalidDataError as e: common.show_error(str(e)) self.window.set_cursor(None) return - except Exception, e: + except Exception as e: common.log_exception() reporting.report_model_usage(radio, "import", True) @@ -1188,7 +1190,7 @@ try: radio = PRRadio(filename) - except Exception, e: + except Exception as e: common.show_error(str(e)) return @@ -1327,7 +1329,7 @@ radio = radioreference.RadioReferenceRadio(None) radio.set_params(zipcode, username, passwd) self.do_open_live(radio, read_only=True) - except errors.RadioError, e: + except errors.RadioError as e: common.show_error(e) self.window.set_cursor(None) @@ -1466,7 +1468,7 @@ conf = config.get("memedit") conf.set_bool("hide_unused", action.get_active()) else: - for editortype, editor in eset.editors.iteritems(): + for editortype, editor in eset.editors.items(): if "memedit" in editortype: editor.set_hide_unused(action.get_active()) @@ -1554,14 +1556,14 @@ directory.enable_reregistrations() try: - module = file(filen) + module = open(filen) code = module.read() module.close() pyc = compile(code, filen, 'exec') # See this for why: # http://stackoverflow.com/questions/2904274/globals-and-locals-in-python-exec exec(pyc, globals(), globals()) - except Exception, e: + except Exception as e: common.log_exception() common.show_error("Unable to load module: %s" % e) Index: chirp/ui/memdetail.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/ui/memdetail.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/ui/memdetail.py (revision 94e21deb6ff7fc0f21a42d81f020121b059c1b8a) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2012 Dan Smith # # This program is free software: you can redistribute it and/or modify @@ -25,8 +26,9 @@ POL = ["NN", "NR", "RN", "RR"] -class ValueEditor: +class ValueEditor(object): """Base class""" + def __init__(self, features, memory, errfn, name, data=None): self._features = features self._memory = memory @@ -61,24 +63,24 @@ try: newval = self._get_value() - except ValueError, e: + except ValueError as e: self._errfn(self._name, str(e)) return str(e) if self._name.startswith("extra_"): try: self._memory.extra[self._name.split("_", 1)[1]].value = newval - except settings.InternalError, e: + except settings.InternalError as e: self._errfn(self._name, str(e)) return str(e) else: try: setattr(self._memory, self._name, newval) - except chirp_common.ImmutableValueError, e: + except chirp_common.ImmutableValueError as e: if getattr(self._memory, self._name) != self._get_value(): self._errfn(self._name, str(e)) return str(e) - except ValueError, e: + except ValueError as e: self._errfn(self._name, str(e)) return str(e) Index: chirp/ui/memedit.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/ui/memedit.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/ui/memedit.py (revision 94e21deb6ff7fc0f21a42d81f020121b059c1b8a) @@ -1,3 +1,4 @@ +# coding=utf-8 # # Copyright 2008 Dan Smith # @@ -178,7 +179,7 @@ try: new = chirp_common.parse_freq(new) - except ValueError, e: + except ValueError as e: LOG.error(e) new = None @@ -565,7 +566,7 @@ self.emit("usermsg", "No room to %s" % (action.replace("_", " "))) return False # No change - class Context: + class Context(object): pass ctx = Context() @@ -964,7 +965,7 @@ for i in col_order: if i not in default_col_order: raise Exception() - except Exception, e: + except Exception as e: LOG.error(e) col_order = default_col_order Index: chirp/ui/miscwidgets.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/ui/miscwidgets.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/ui/miscwidgets.py (revision 67117ad7beb06c5d5f0d33211d3b06eadbb9059d) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2008 Dan Smith # # This program is free software: you can redistribute it and/or modify @@ -13,6 +14,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import print_function + import gtk import gobject import pango @@ -130,7 +133,7 @@ try: (store, iter) = self.__view.get_selection().get_selected() return store.get(iter, 0)[0] - except Exception, e: + except Exception as e: LOG.error("Unable to find selected: %s" % e) return None @@ -300,7 +303,7 @@ try: (lst, iter) = self._view.get_selection().get_selected() lst.remove(iter) - except Exception, e: + except Exception as e: LOG.error("Unable to remove selected: %s" % e) def get_selected(self, take_default=False): @@ -322,7 +325,7 @@ target = lst.get_iter(pos-1) elif delta < 0: target = lst.get_iter(pos+1) - except Exception, e: + except Exception as e: return False if target: @@ -588,7 +591,7 @@ except: try: return self.parse_dms(string) - except Exception, e: + except Exception as e: LOG.error("DMS: %s" % e) raise Exception("Invalid format") @@ -737,9 +740,9 @@ def print_val(entry): if entry.validate(): - print "Valid: %s" % entry.value() + print("Valid: %s" % entry.value()) else: - print "Invalid" + print("Invalid") lle.connect("activate", print_val) lle.set_text("45 13 12") @@ -749,7 +752,7 @@ except KeyboardInterrupt: pass - print lst.get_values() + print(lst.get_values()) if __name__ == "__main__": Index: chirp/ui/reporting.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/ui/reporting.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/ui/reporting.py (revision f42ee3682381917f11f06b2deb690352fa37b86a) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2011 Dan Smith # # This program is free software: you can redistribute it and/or modify @@ -43,7 +44,14 @@ try: # Don't let failure to import any of these modules cause trouble from chirp.ui import config - import xmlrpclib + try: + # noinspection PyCompatibility, PyUnresolvedReferences + from xmlrpclib import ServerProxy + except ImportError: + # Give importing from Python3 a shot + # noinspection PyCompatibility, PyUnresolvedReferences + from xmlrpc.client import ServerProxy + except: ENABLED = False @@ -73,7 +81,7 @@ LOG.debug("Reporting model usage: %s" % data) - proxy = xmlrpclib.ServerProxy(REPORT_URL) + proxy = ServerProxy(REPORT_URL) id = proxy.report_stats(CHIRP_VERSION, platform.get_platform().os_version_string(), "model_use", @@ -88,7 +96,7 @@ LOG.debug("Reporting exception") - proxy = xmlrpclib.ServerProxy(REPORT_URL) + proxy = ServerProxy(REPORT_URL) id = proxy.report_exception(CHIRP_VERSION, platform.get_platform().os_version_string(), "exception", @@ -103,7 +111,7 @@ LOG.debug("Reporting misc error with %s" % module) - proxy = xmlrpclib.ServerProxy(REPORT_URL) + proxy = ServerProxy(REPORT_URL) id = proxy.report_misc_error(CHIRP_VERSION, platform.get_platform().os_version_string(), module, data) @@ -114,7 +122,7 @@ def _check_for_updates(callback): LOG.debug("Checking for updates") - proxy = xmlrpclib.ServerProxy(REPORT_URL) + proxy = ServerProxy(REPORT_URL) ver = proxy.check_for_updates(CHIRP_VERSION, platform.get_platform().os_version_string()) @@ -132,7 +140,7 @@ def _run(self): try: return self.__func(*self.__args) - except Exception, e: + except Exception as e: LOG.debug("Failed to report: %s" % e) return False Index: chirp/ui/settingsedit.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/ui/settingsedit.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/ui/settingsedit.py (revision 94e21deb6ff7fc0f21a42d81f020121b059c1b8a) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2012 Dan Smith # # This program is free software: you can redistribute it and/or modify @@ -109,7 +110,7 @@ def _save_setting(self, widget, value): try: self._do_save_setting(widget, value) - except settings.InvalidValueError, e: + except settings.InvalidValueError as e: common.show_error(_("Invalid setting value: %s") % e) def _build_ui_tab(self, group): Index: chirp/ui/shiftdialog.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/ui/shiftdialog.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirp/ui/shiftdialog.py (revision 94e21deb6ff7fc0f21a42d81f020121b059c1b8a) @@ -1,3 +1,4 @@ +# coding=utf-8 # # Copyright 2008 Dan Smith # @@ -136,7 +137,7 @@ try: count = func(newhole, *args) - except errors.InvalidMemoryLocation, e: + except errors.InvalidMemoryLocation as e: self.status(str(e), 0) self.finished() return Index: chirpc IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>US-ASCII =================================================================== --- chirpc (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ chirpc (revision 67117ad7beb06c5d5f0d33211d3b06eadbb9059d) @@ -1,4 +1,5 @@ #!/usr/bin/env python +# coding=utf-8 # # Copyright 2008 Dan Smith # @@ -16,6 +17,8 @@ # along with this program. If not, see . +from __future__ import print_function + import serial import os import sys @@ -192,21 +195,21 @@ logger.handle_options(options) if options.list_radios: - print "Supported Radios:\n\t", "\n\t".join(sorted(RADIOS.keys())) + print("Supported Radios:\n\t", "\n\t".join(sorted(RADIOS.keys()))) sys.exit(0) if options.id: from chirp import icf s = serial.Serial(port=options.serial, baudrate=9600, timeout=0.5) md = icf.get_model_data(s) - print "Model:\n%s" % util.hexprint(md) + print("Model:\n%s" % util.hexprint(md)) sys.exit(0) if not options.radio: if options.mmap: rclass = directory.get_radio_by_image(options.mmap).__class__ else: - print "You must specify a radio model. See --list-radios." + print("You must specify a radio model. See --list-radios.") sys.exit(1) else: rclass = directory.get_radio(options.radio) @@ -255,7 +258,7 @@ dst = parse_memory_number(radio, args[1:]) try: mem = radio.get_memory(src) - except errors.InvalidMemoryLocation, e: + except errors.InvalidMemoryLocation as e: LOG.exception(e) sys.exit(1) LOG.info("copying memory %s to %s", src, dst) @@ -266,7 +269,7 @@ memnum = parse_memory_number(radio, args) try: mem = radio.get_memory(memnum) - except errors.InvalidMemoryLocation, e: + except errors.InvalidMemoryLocation as e: LOG.exception(e) sys.exit(1) if mem.empty: @@ -318,7 +321,7 @@ memnum = parse_memory_number(radio, args) try: mem = radio.get_memory(memnum) - except errors.InvalidMemoryLocation, e: + except errors.InvalidMemoryLocation as e: LOG.exception(e) sys.exit(1) @@ -359,7 +362,7 @@ pos = parse_memory_number(radio, args) try: mem = radio.get_memory(pos) - except errors.InvalidMemoryLocation, e: + except errors.InvalidMemoryLocation as e: mem = chirp_common.Memory() mem.number = pos @@ -376,7 +379,7 @@ try: radio.sync_in() radio.save_mmap(options.mmap) - except Exception, e: + except Exception as e: LOG.exception(e) sys.exit(1) @@ -391,7 +394,7 @@ radio.load_mmap(options.mmap) radio.sync_out() print "Upload successful" - except Exception, e: + except Exception as e: LOG.exception(e) sys.exit(1) Index: csvdump/csvapp.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- csvdump/csvapp.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ csvdump/csvapp.py (revision 67117ad7beb06c5d5f0d33211d3b06eadbb9059d) @@ -1,4 +1,5 @@ #!/usr/bin/env python +# coding=utf-8 # # Copyright 2008 Dan Smith # @@ -15,6 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import print_function + import gobject import gtk import threading @@ -38,7 +41,7 @@ } -class CsvDumpApp: +class CsvDumpApp(object): def update_status(self, s): gobject.idle_add(self.progwin.status, s) @@ -55,14 +58,14 @@ radio.status_fn = self.update_status radio.sync_in() - print "Sync done, saving to: %s" % fn + print("Sync done, saving to: %s" % fn) radio.save_mmap(fn) self.refresh_radio() - except serial.SerialException, e: + except serial.SerialException as e: gobject.idle_add(self.mainwin.set_status, "Error: Unable to open serial port") - except Exception, e: + except Exception as e: gobject.idle_add(self.mainwin.set_status, "Error: %s" % e) @@ -89,11 +92,11 @@ radio = RADIOS[self.rtype](s) radio.status_fn = self.update_status - print "Loading image from %s" % fn + print("Loading image from %s" % fn) radio.load_mmap(fn) radio.sync_out() - except Exception, e: + except Exception as e: gobject.idle_add(self.mainwin.set_status, "Error: %s" % e) @@ -112,14 +115,14 @@ count = 0 try: - f = file(fname, "w") - except Exception, e: + f = open(fname, "w") + except Exception as e: self.mainwin.set_status("%s: %s" % (fname, e)) return - print >>f, chirp.chirp_common.Memory.CSV_FORMAT + print(chirp.chirp_common.Memory.CSV_FORMAT, file=f) for m in self.radio.get_memories(): - print >>f, m.to_csv() + print(m.to_csv(), file=f) count += 1 f.close() @@ -129,23 +132,23 @@ gobject.idle_add(self.progwin.show) try: - f = file(fname, "w") - except Exception, e: + f = open(fname, "w") + except Exception as e: gobject.idle_add(self.progwin.hide) gobject.idle_add(self.mainwin.set_status, "%s: %s" % (fname, e)) return - print >>f, chirp.chirp_common.Memory.CSV_FORMAT - for i in range(l, h+1): + print(chirp.chirp_common.Memory.CSV_FORMAT, file=f) + for i in range(l, h + 1): s = chirp.chirp_common.Status() s.msg = "Reading memory %i" % i s.cur = i - s.max = h+1 + s.max = h + 1 gobject.idle_add(self.progwin.status, s) try: m = self.radio.get_memory(i) - print >>f, m.to_csv() + print(m.to_csv(), file=f) except chirp.errors.InvalidMemoryLocation: pass @@ -196,8 +199,8 @@ m.name = name m.number = int(num) m.freq = float(freq) - except Exception, e: - print "Failed to parse `%s': %s" % (line, e) + except Exception as e: + print("Failed to parse `%s': %s" % (line, e)) return None return m @@ -206,8 +209,8 @@ gobject.idle_add(self.progwin.show) try: - f = file(fname, "rU") - except Exception, e: + f = open(fname, "rU") + except Exception as e: gobject.idle_add(self.progwin.hide) gobject.idle_add(self.mainwin.set_status, "%s: %s" % (fname, e)) @@ -223,8 +226,8 @@ m = chirp.chirp_common.Memory.from_csv(line) except errors.InvalidMemoryLocation: continue - except Exception, e: - print "Parse error on line %i: %s" % (lineno, e) + except Exception as e: + print("Parse error on line %i: %s" % (lineno, e)) break # FIXME: Report error here lineno += 1 @@ -238,15 +241,15 @@ s.max = len(memories) gobject.idle_add(self.progwin.status, s) -# try: -# self.radio.get_memory(m.number, 2) -# except errors.InvalidMemoryLocation: -# m + # try: + # self.radio.get_memory(m.number, 2) + # except errors.InvalidMemoryLocation: + # m try: self.radio.set_memory(m) - except Exception, e: - print "Error setting memory %i: %s" % (m.number, e) + except Exception as e: + print("Error setting memory %i: %s" % (m.number, e)) break count += 1 @@ -257,8 +260,8 @@ def _import_file_mmap(self, fname): try: - f = file(fname, "rU") - except Exception, e: + f = open(fname, "rU") + except Exception as e: self.progwin.hide() self.mainwin.set_status("%s: %s" % (fname, e)) return @@ -271,8 +274,8 @@ lineno += 1 try: m = chirp.chirp_common.Memory.from_csv(line.strip()) - print "Imported: %s" % m - except Exception, e: + print("Imported: %s" % m) + except Exception as e: if lineno == 1: continue import traceback @@ -280,10 +283,10 @@ self.mainwin.set_status("Error on line %i: %s" % (lineno, e)) return - print "Setting memory: %s" % m + print("Setting memory: %s" % m) self.radio.set_memory(m) - print "Saving image to %s.img" % self.rtype + print("Saving image to %s.img" % self.rtype) self.radio.save_mmap("%s.img" % self.rtype) self.mainwin.set_status("Imported %s" % os.path.basename(fname)) @@ -303,7 +306,7 @@ if self.radio: try: self.radio.pipe.close() - except Exception, e: + except Exception as e: pass if not self.rtype.startswith("ic9x"): @@ -322,7 +325,7 @@ timeout=0.1) self.radio = rtype(s) self.mainwin.set_image_info(False, True, "Live") - except Exception, e: + except Exception as e: smsg = "Error: Unable to open serial port" self.mainwin.set_image_info(False, False, "") Index: rpttool IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- rpttool (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ rpttool (revision f42ee3682381917f11f06b2deb690352fa37b86a) @@ -1,4 +1,5 @@ #!/usr/bin/env python +# coding=utf-8 # # Copyright 2009 Dan Smith # @@ -15,10 +16,11 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import print_function + import os import sys import serial -import commands from chirp import idrp, chirp_common @@ -28,8 +30,8 @@ s = serial.Serial(port="/dev/icom", baudrate=idrp.IDRPx000V.BAUD_RATE, timeout=0.1) - except Exception, e: - print "Unable to open serial port %s: %s" % ("/dev/icom", e) + except Exception as e: + print("Unable to open serial port %s: %s" % ("/dev/icom", e)) return None rp = idrp.IDRPx000V(s) @@ -44,8 +46,8 @@ try: mem = rp.get_memory(0) - except Exception, e: - print "Unable to read memory from device: %s" % e + except Exception as e: + print("Unable to read memory from device: %s" % e) return 0 rp.pipe.close() @@ -56,32 +58,30 @@ def _set_freq(rp): try: mem = rp.get_memory(0) - except Exception, e: - print "Unable to read memory from device: %s" % e + except Exception as e: + print("Unable to read memory from device: %s" % e) return False - print "\nNew frequency [%s]: " % chirp_common.format_freq(mem.freq), + print("\nNew frequency [%s]: " % chirp_common.format_freq(mem.freq)) input = sys.stdin.readline().strip() if not input: - print "Frequency unchanged" + print("Frequency unchanged") return False try: mem.freq = chirp_common.parse_freq(input) except Exception: - print "Invalid entry `%s'" % input + print("Invalid entry `%s'" % input) return False try: rp.set_memory(mem) - except Exception, e: - print "Failed to set frequency to %s: %s" % \ - (chirp_common.format_freq(mem.freq), e) + except Exception as e: + print("Failed to set frequency to %s: %s" % (chirp_common.format_freq(mem.freq), e)) return False - print "Successfully set frequency to %s" % \ - chirp_common.format_freq(mem.freq) + print ("Successfully set frequency to %s" % chirp_common.format_freq(mem.freq)) return True @@ -92,8 +92,8 @@ try: res = _set_freq(rp) - except Exception, e: - print "Unknown error while setting frequency: %s" % e + except Exception as e: + print ("Unknown error while setting frequency: %s" % e) res = False rp.pipe.close() @@ -101,16 +101,16 @@ def main_menu(): - print "Looking for a repeater...", + print("Looking for a repeater...",end="") sys.stdout.flush() freq = read_freq() if not freq: return 1 - print "\r \r", + print("\r \r", end="") cmd = "" while cmd != "3": - print """ + print (""" KK7DS ID-RP* Frequency Tool Current Setting: %s -------------------------------- @@ -118,7 +118,7 @@ 2. Re-read current frequency 3. Quit -------------------------------- -> """ % chirp_common.format_freq(freq), +> """ % chirp_common.format_freq(freq), end="") cmd = sys.stdin.readline().strip() @@ -128,7 +128,7 @@ elif cmd == "2": freq = read_freq() elif cmd != "3": - print "Invalid entry" + print("Invalid entry") return 0 @@ -143,6 +143,6 @@ sys.exit(r) if not os.geteuid() == 0: - print "Sorry, this must be run as root" + print("Sorry, this must be run as root") sys.exit(1) sys.exit(main_menu()) Index: share/make_supported.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- share/make_supported.py (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ share/make_supported.py (revision 67117ad7beb06c5d5f0d33211d3b06eadbb9059d) @@ -1,4 +1,7 @@ #!/usr/bin/env python +# coding=utf-8 + +from __future__ import print_function import sys import serial @@ -49,7 +52,7 @@ try: value = ", ".join([str(x) for x in value if not str(x).startswith("?")]) - except Exception, e: + except Exception as e: raise if key == "memory_bounds": @@ -88,7 +91,7 @@ return row -print """ +print(""" -""" +""") models = {"Icom": [], "Kenwood": [], @@ -136,13 +139,13 @@ count = 0 for vendor, radios in sorted(models.items(), key=lambda t: t[0]): - print header_row() + print(header_row()) for radio in sorted(radios, key=lambda r: r.VENDOR+r.MODEL): _radio = radio(None) if _radio.get_features().has_sub_devices: for __radio in _radio.get_sub_devices(): - print supported_row(__radio, count % 2) + print(supported_row(__radio, count % 2)) count += 1 else: - print supported_row(_radio, count % 2) + print(supported_row(_radio, count % 2)) count += 1 Index: tests/run_tests IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- tests/run_tests (revision 7f5cf7dc68613d5a96957af4a5facf9456e91f0c) +++ tests/run_tests (revision 67117ad7beb06c5d5f0d33211d3b06eadbb9059d) @@ -1,4 +1,5 @@ #!/usr/bin/env python +# coding=utf-8 # # Copyright 2011 Dan Smith # @@ -15,6 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import print_function + import traceback import sys import os @@ -102,7 +105,7 @@ return traceback.format_exc() -class TestWrapper: +class TestWrapper(object): def __init__(self, dstclass, filename): self._ignored_exceptions = [] self._dstclass = dstclass @@ -129,7 +132,7 @@ if self._make_reload: try: self.open() - except Exception, e: + except Exception as e: raise TestCrashError(get_tb(), e, "[Loading]") try: @@ -139,21 +142,21 @@ try: ret = fn(*args, **kwargs) - except Exception, e: + except Exception as e: if type(e) in self._ignored_exceptions: raise e details = str(args) + str(kwargs) for arg in args: if isinstance(arg, chirp_common.Memory): details += os.linesep + \ - os.linesep.join(["%s:%s" % (k, v) for k, v - in arg.__dict__.items()]) + os.linesep.join(["%s:%s" % (k, v) for k, v + in arg.__dict__.items()]) raise TestCrashError(get_tb(), e, details) if self._make_reload: try: self.close() - except Exception, e: + except Exception as e: raise TestCrashError(get_tb(), e, "[Saving]") return ret @@ -167,7 +170,7 @@ return self._dst -class TestCase: +class TestCase(object): def __init__(self, wrapper): self._wrapper = wrapper @@ -201,27 +204,27 @@ elif k == "tuning_step" and not rf.has_tuning_step: continue elif k == "rtone" and not ( - a.tmode == "Tone" or - (a.tmode == "TSQL" and not rf.has_ctone) or - (a.tmode == "Cross" and tx_mode == "Tone") or + a.tmode == "Tone" or + (a.tmode == "TSQL" and not rf.has_ctone) or + (a.tmode == "Cross" and tx_mode == "Tone") or (a.tmode == "Cross" and rx_mode == "Tone" and - not rf.has_ctone) - ): + not rf.has_ctone) + ): continue elif k == "ctone" and (not rf.has_ctone or - not (a.tmode == "TSQL" or - (a.tmode == "Cross" and - rx_mode == "Tone"))): + not (a.tmode == "TSQL" or + (a.tmode == "Cross" and + rx_mode == "Tone"))): continue elif k == "dtcs" and not ( - (a.tmode == "DTCS" and not rf.has_rx_dtcs) or - (a.tmode == "Cross" and tx_mode == "DTCS") or - (a.tmode == "Cross" and rx_mode == "DTCS" and - not rf.has_rx_dtcs)): + (a.tmode == "DTCS" and not rf.has_rx_dtcs) or + (a.tmode == "Cross" and tx_mode == "DTCS") or + (a.tmode == "Cross" and rx_mode == "DTCS" and + not rf.has_rx_dtcs)): continue elif k == "rx_dtcs" and (not rf.has_rx_dtcs or - not (a.tmode == "Cross" and - rx_mode == "DTCS")): + not (a.tmode == "Cross" and + rx_mode == "DTCS")): continue elif k == "offset" and not a.duplex: continue @@ -231,8 +234,8 @@ try: if b.__dict__[k] != v: msg = "Field `%s' " % k + \ - "is `%s', " % b.__dict__[k] + \ - "expected `%s' " % v + "is `%s', " % b.__dict__[k] + \ + "expected `%s' " % v details = msg details += os.linesep + "### Wanted:" + os.linesep @@ -242,9 +245,9 @@ details += os.linesep.join(["%s:%s" % (k, v) for k, v in b.__dict__.items()]) raise TestFailedError(msg, details) - except KeyError, e: - print sorted(a.__dict__.keys()) - print sorted(b.__dict__.keys()) + except KeyError as e: + print(sorted(a.__dict__.keys())) + print(sorted(b.__dict__.keys())) raise @@ -282,11 +285,11 @@ src_mem) except import_logic.DestNotCompatible: continue - except import_logic.ImportError, e: + except import_logic.ImportError as e: failures.append(TestFailedError("<%i>: Import Failed: %s" % (dst_number, e))) continue - except Exception, e: + except Exception as e: raise TestCrashError(get_tb(), e, "[Import]") self._wrapper.do("set_memory", dst_mem) @@ -294,7 +297,7 @@ try: self.compare_mem(dst_mem, ret_mem) - except TestFailedError, e: + except TestFailedError as e: failures.append( TestFailedError("<%i>: %s" % (number, e), e.get_detail())) @@ -351,7 +354,7 @@ try: self.set_and_compare(m) - except errors.UnsupportedToneError, e: + except errors.UnsupportedToneError as e: # If a radio doesn't support a particular tone value, # don't punish it pass @@ -637,7 +640,7 @@ bank.set_name(testname) except AttributeError: return [], [] - except Exception, e: + except Exception as e: if str(e) == "Not implemented": return [], [] else: @@ -802,7 +805,7 @@ try: radio = directory.get_radio_by_image(filename) - except Exception, e: + except Exception as e: raise TestFailedError("Failed to detect", str(e)) if issubclass(self._wrapper._dstclass, radio.__class__): @@ -816,7 +819,7 @@ class TestCaseClone(TestCase): - class SerialNone: + class SerialNone(object): def read(self, size): return "" @@ -861,7 +864,7 @@ live = isinstance(self._wrapper._dst, chirp_common.LiveRadio) try: radio = self._wrapper._dst.__class__(serial) - except Exception, e: + except Exception as e: error = e radio.status_fn = lambda s: True @@ -879,7 +882,7 @@ error = None try: radio.sync_in() - except Exception, e: + except Exception as e: error = e if error is None: @@ -898,7 +901,7 @@ error = None try: radio.sync_out() - except Exception, e: + except Exception as e: error = e if error is None: @@ -923,7 +926,7 @@ TESTS["Clone"] = TestCaseClone -class TestOutput: +class TestOutput(object): def __init__(self, output=None): if not output: output = sys.stdout @@ -936,7 +939,7 @@ pass def _print(self, string): - print >>self._out, string + print(string,file=self._out) def report(self, rclass, tc, msg, e): name = ("%s %s" % (rclass.MODEL, rclass.VARIANT))[:13] @@ -988,9 +991,9 @@ self._filename = filename def prepare(self): - print "Writing to %s" % self._filename, + print("Writing to %s" % self._filename) sys.stdout.flush() - self._out = file(self._filename, "w") + self._out = open(self._filename, "w") s = """ @@ -1032,12 +1035,12 @@ """ % (CHIRP_VERSION, CHIRP_VERSION, time.strftime("%x at %X"), os.name) - print >>self._out, s + print(s, file=self._out) def cleanup(self): - print >>self._out, "
StatusMessage
" + print("", file=self._out) self._out.close() - print "Done" + print("Done") def report(self, rclass, tc, msg, e): s = ("" % msg) + \ @@ -1048,12 +1051,12 @@ ("%s" % (msg, msg)) + \ ("%s" % e) + \ "" - print >>self._out, s + print(s,file=self._out) sys.stdout.write(".") sys.stdout.flush() -class TestRunner: +class TestRunner(object): def __init__(self, images_dir, test_list, test_out): self._images_dir = images_dir self._test_list = test_list @@ -1074,11 +1077,11 @@ def log(self, rclass, tc, e): fn = "logs/%s_%s.log" % (directory.get_driver(rclass), tc) - log = file(fn, "a") - print >>log, "---- Begin test %s ----" % tc + log = open(fn, "a") + print("---- Begin test %s ----" % tc, file=log) log.write(e.get_detail()) - print >>log - print >>log, "---- End test %s ----" % tc + print(file=log)) + print("---- End test %s ----" % tc, file=log)) log.close() def nuke_log(self, rclass, tc): @@ -1105,18 +1108,18 @@ self.log(rclass, tc, e) nfailed += 1 nprinted += 1 - except TestFailedError, e: + except TestFailedError as e: self.report(rclass, tc, "FAILED", e) if e.get_detail(): self.log(rclass, tc, e) nfailed += 1 nprinted += 1 - except TestCrashError, e: + except TestCrashError as e: self.report(rclass, tc, "CRASHED", e) self.log(rclass, tc, e) nfailed += 1 nprinted += 1 - except TestSkippedError, e: + except TestSkippedError as e: self.report(rclass, tc, "SKIPPED", e) self.log(rclass, tc, e) nprinted += 1 @@ -1151,6 +1154,7 @@ def run_list(self, run_list): def _key(pair): return pair[0].VENDOR + pair[0].MODEL + pair[0].VARIANT + failed = 0 for rclass, image in sorted(run_list, key=_key): failed += self.run_rclass_image(rclass, image) @@ -1212,7 +1216,7 @@ stdout = sys.stdout if not os.path.exists("logs"): os.mkdir("logs") - sys.stdout = file("logs/verbose", "w") + sys.stdout = open("logs/verbose", "w") test_out = TestOutputANSI(stdout) test_out.prepare() @@ -1227,7 +1231,7 @@ if options.live: if not options.driver: - print "Live mode requires a driver to be specified" + print("Live mode requires a driver to be specified") sys.exit(1) failed = tr.run_one_live(options.driver, options.live) elif options.driver: Index: chirp/directory.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/directory.py (date 1503636211000) +++ chirp/directory.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2010 Dan Smith # Copyright 2012 Tom Hayward # @@ -102,7 +103,7 @@ pass # Skip non-Icoms if img_data: - f = file(img_file, "wb") + f = open(img_file, "wb") f.write(img_data) f.close() else: @@ -131,7 +132,7 @@ image_file = tempf if os.path.exists(image_file): - f = file(image_file, "rb") + f = open(image_file, "rb") filedata = f.read() f.close() else: Index: chirp/drivers/tmv71_ll.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/tmv71_ll.py (date 1503636211000) +++ chirp/drivers/tmv71_ll.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2010 Dan Smith # # This program is free software: you can redistribute it and/or modify @@ -388,4 +389,4 @@ # s.write("\r\r") # print get_id(s) data = download(s) - file(sys.argv[2], "wb").write(data) + open(sys.argv[2], "wb").write(data) Index: chirp/logger.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/logger.py (date 1503636211000) +++ chirp/logger.py (date 1503639966000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2015 Zachary T Welch # # This program is free software: you can redistribute it and/or modify @@ -14,6 +15,8 @@ # along with this program. If not, see . +from __future__ import print_function + r""" The chirp.logger module provides the core logging facilties for CHIRP. It sets up the console and (optionally) a log file. For early debugging, @@ -38,7 +41,7 @@ class VersionAction(argparse.Action): def __call__(self, parser, namespace, value, option_string=None): - print version_string() + print(version_string()) sys.exit(1) @@ -89,7 +92,7 @@ if hasattr(sys, "frozen") or not os.isatty(0) \ or os.getenv("CHIRP_DEBUG_LOG"): p = platform.get_platform() - log = file(p.config_file("debug.log"), "w", 0) + log = open(p.config_file("debug.log"), "w", 0) sys.stdout = log sys.stderr = log console_stream = log @@ -120,7 +123,7 @@ if self.logfile is None: self.logname = name # always truncate the log file - with file(name, "w") as fh: + with open(name, "w") as fh: pass self.logfile = logging.FileHandler(name) format_str = self.log_format Index: chirp/ui/config.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/ui/config.py (date 1503636211000) +++ chirp/ui/config.py (date 1503642115000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2011 Dan Smith # # This program is free software: you can redistribute it and/or modify @@ -14,11 +15,16 @@ # along with this program. If not, see . from chirp import platform -from ConfigParser import ConfigParser +try: + # noinspection PyCompatibility, PyUnresolvedReferences + from ConfigParser import ConfigParser +except ImportError: # Py3 + # noinspection PyCompatibility, PyUnresolvedReferences + from configparser import ConfigParser import os -class ChirpConfig: +class ChirpConfig(object): def __init__(self, basepath, name="chirp.config"): self.__basepath = basepath self.__name = name @@ -33,7 +39,7 @@ def save(self): cfg = os.path.join(self.__basepath, self.__name) - cfg_file = file(cfg, "w") + cfg_file = open(cfg, "w") self.__config.write(cfg_file) cfg_file.close() @@ -62,7 +68,7 @@ self.__config.remove_section(section) -class ChirpConfigProxy: +class ChirpConfigProxy(object): def __init__(self, config, section="global"): self._config = config self._section = section Index: csvdump.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- csvdump.py (date 1503636211000) +++ csvdump.py (date 1503639966000) @@ -1,4 +1,5 @@ #!/usr/bin/env python +# coding=utf-8 # # Copyright 2008 Dan Smith # @@ -16,16 +17,17 @@ # along with this program. If not, see . +from __future__ import print_function import gtk import sys from csvdump import csvapp if hasattr(sys, "frozen"): - log = file("debug.log", "w", 0) + log = open("debug.log", "w", 0) sys.stderr = log sys.stdout = log - print "Log initialized" + print("Log initialized") a = csvapp.CsvDumpApp() a.run() Index: setup.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- setup.py (date 1503636211000) +++ setup.py (date 1503639966000) @@ -1,3 +1,5 @@ +# coding=utf-8 +from __future__ import print_function import sys import os @@ -10,21 +12,20 @@ def staticify_chirp_module(): import chirp - with file("chirp/__init__.py", "w") as init: - print >>init, "CHIRP_VERSION = \"%s\"" % CHIRP_VERSION - print >>init, "__all__ = %s\n" % str(chirp.__all__) + with open("chirp/__init__.py", "w") as init: + print("CHIRP_VERSION = \"%s\"" % CHIRP_VERSION, file=init) + print("__all__ = %s\n" % str(chirp.__all__), file=init) - print "Set chirp/__init__.py::__all__ = %s" % str(chirp.__all__) + print("Set chirp/__init__.py::__all__ = %s" % str(chirp.__all__)) def staticify_drivers_module(): import chirp.drivers - with file("chirp/drivers/__init__.py", "w") as init: - print >>init, "__all__ = %s\n" % str(chirp.drivers.__all__) + with open("chirp/drivers/__init__.py", "w") as init: + print("__all__ = %s\n" % str(chirp.drivers.__all__), file=init) - print "Set chirp/drivers/__init__.py::__all__ = %s" % str( - chirp.drivers.__all__) + print("Set chirp/drivers/__init__.py::__all__ = %s" % str(chirp.drivers.__all__)) def win32_build(): @@ -117,7 +118,7 @@ for f in _locale_files: locale_files.append(("share/chirp/%s" % os.path.dirname(f), [f])) - print "LOC: %s" % str(locale_files) + print("LOC: %s" % str(locale_files)) xsd_files = glob("chirp*.xsd") @@ -156,9 +157,9 @@ if not files: return - f = file("MANIFEST.in", "w") + f = open("MANIFEST.in", "w") for fn in files: - print >>f, fn + print(fn, file=f) f.close() Index: tools/cpep8.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- tools/cpep8.py (date 1503636211000) +++ tools/cpep8.py (date 1503639966000) @@ -1,4 +1,5 @@ #!/usr/bin/env python +# coding=utf-8 # # cpep8.py - Check Python source files for PEP8 compliance. # @@ -17,6 +18,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import print_function + import os import sys import logging @@ -44,7 +47,7 @@ def file_to_lines(name): - fh = file(name, "r") + fh = open(name, "r") lines = fh.read().split("\n") lines.pop() fh.close() @@ -64,7 +67,7 @@ if f.endswith('.py'): manifest.append(filename) continue - with file(filename, "r") as fh: + with open(filename, "r") as fh: shebang = fh.readline() if shebang.startswith("#!/usr/bin/env python"): manifest.append(filename) @@ -90,25 +93,25 @@ return ignore if args.update: - print "Starting update of %d files" % len(manifest) + print("Starting update of %d files" % len(manifest)) bad = [] for f in manifest: checker = pep8.StyleGuide(quiet=True, ignore=get_exceptions(f)) results = checker.check_files([f]) if results.total_errors: bad.append(f) - print "%s: %s" % (results.total_errors and "FAIL" or "PASS", f) + print("%s: %s" % (results.total_errors and "FAIL" or "PASS", f)) - with file(blacklist_filename, "w") as fh: - print >>fh, """\ + with open(blacklist_filename, "w") as fh: + print("""\ # cpep8.blacklist: The list of files that do not meet PEP8 standards. # DO NOT ADD NEW FILES!! Instead, fix the code to be compliant. -# Over time, this list should shrink and (eventually) be eliminated.""" - print >>fh, "\n".join(sorted(bad)) +# Over time, this list should shrink and (eventually) be eliminated.""", file=fh) + print("\n".join(sorted(bad)), file=fh) if args.scan: - with file(manifest_filename, "w") as fh: - print >>fh, "\n".join(sorted(manifest)) + with open(manifest_filename, "w") as fh: + print("\n".join(sorted(manifest)), file=fh) sys.exit(0) if args.files: Index: tools/img2thd72.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- tools/img2thd72.py (date 1503636211000) +++ tools/img2thd72.py (date 1503639966000) @@ -18,13 +18,14 @@ # along with this software. If not, see . +from __future__ import print_function import sys import getopt from PIL import Image as im def die(msg): - print msg + print(msg) sys.exit(1) @@ -66,26 +67,26 @@ line += dots[(ord(buf[byte]) >> (y % 8)) & 0x01] lines.append(line) for l in lines: - print l + print(l) def usage(): - print "\nUsage: %s <-s|-g> [-i] [-d] " \ - " " % sys.argv[0] - print "\nThis program will modify whatever nvram file provided or will" - print "create a new one if the file does not exist. After using this to" - print "modify the image, you can use that file to upload all or part of" - print "it to your radio" - print "\nOption explanations:" - print " -s Save as the startup image" - print " -g Save as the GPS logger image" - print " -i Invert colors (black for white)" - print " Depending on the file format the bits may be inverted." - print " If your bitmap file turns out to be inverted, use -i." - print " -d Display the bitmap as dots (for confirmation)" - print " Each black pixel is '*' and each white pixel is ' '" - print " This will print up to 120 dots wide, so beware your" - print " terminal size." + print("\nUsage: %s <-s|-g> [-i] [-d] " + " " % sys.argv[0]) + print("\nThis program will modify whatever nvram file provided or will") + print("create a new one if the file does not exist. After using this to") + print("modify the image, you can use that file to upload all or part of") + print("it to your radio") + print("\nOption explanations:") + print(" -s Save as the startup image") + print(" -g Save as the GPS logger image") + print(" -i Invert colors (black for white)") + print(" Depending on the file format the bits may be inverted.") + print(" If your bitmap file turns out to be inverted, use -i.") + print(" -d Display the bitmap as dots (for confirmation)") + print(" Each black pixel is '*' and each white pixel is ' '") + print(" This will print up to 120 dots wide, so beware your") + print(" terminal size.") sys.exit(1) if __name__ == "__main__": @@ -108,7 +109,7 @@ buf = thd72bitmap(ifname, invert) imgfname = ifname + '\xff' * (48-len(ifname)) - of = file(ofname, "rb+") + of = open(ofname, "rb+") of.seek(tagpos) of.write('\x01') of.seek(imgpos) @@ -124,4 +125,4 @@ blocks.append(imgpos/256) blocks.append(1+imgpos/256) blocks.append(2+imgpos/256) - print "Modified block list:", blocks + print ("Modified block list: {}".format(blocks)) Index: chirp/bitwise.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/bitwise.py (date 1503636539000) +++ chirp/bitwise.py (date 1503639966000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2010 Dan Smith # # This program is free software: you can redistribute it and/or modify @@ -57,6 +58,8 @@ # as integers directly (for int types). Strings and BCD arrays # behave as expected. +from __future__ import print_function + import struct import os import logging @@ -91,12 +94,12 @@ pp(i, level+2) elif isinstance(i, tuple): if isinstance(i[1], str): - print "%s%s: %s" % (" " * level, i[0], i[1]) + print("%s%s: %s" % (" " * level, i[0], i[1])) else: - print "%s%s:" % (" " * level, i[0]) + print("%s%s:" % (" " * level, i[0])) pp(i, level+2) elif isinstance(i, str): - print "%s%s" % (" " * level, i) + print("%s%s" % (" " * level, i)) def array_copy(dst, src): @@ -135,7 +138,7 @@ array_copy(char_array, list(string)) -class DataElement: +class DataElement(object): _size = 1 def __init__(self, data, offset, count=1): @@ -160,7 +163,7 @@ raise Exception("Not implemented for %s" % self.__class__) def get_raw(self): - return self._data[self._offset:self._offset+self._size] + return self._data[self._offset:self._offset + self._size] def set_raw(self, data): self._data[self._offset] = data[:self._size] @@ -723,8 +726,7 @@ yield key, self._generators[key] -class Processor: - +class Processor(object): _types = { "u8": u8DataElement, "u16": u16DataElement, @@ -809,7 +811,7 @@ for i in range(0, count): if dtype == "bit": gen = self.do_bitarray(i, count) - self._offset += int((i+1) % 8 == 0) + self._offset += int((i + 1) % 8 == 0) else: gen = self._types[dtype](self._data, self._offset) self._offset += (gen.size() / 8) @@ -908,14 +910,14 @@ data = "\xab\x7F\x81abc\x12\x34" tree = parse(defn, data) - print repr(tree) + print(repr(tree)) - print "Foo %i" % tree.mystruct.foo - print "Highbit: %i SixZeros: %i: Lowbit: %i" % (tree.mystruct.highbit, - tree.mystruct.sixzeros, - tree.mystruct.lowbit) - print "String: %s" % tree.mystruct.string - print "Fourdigits: %i" % tree.mystruct.fourdigits + print("Foo %i" % tree.mystruct.foo) + print("Highbit: %i SixZeros: %i: Lowbit: %i" % (tree.mystruct.highbit, + tree.mystruct.sixzeros, + tree.mystruct.lowbit)) + print("String: %s" % tree.mystruct.string) + print("Fourdigits: %i" % tree.mystruct.fourdigits) import sys sys.exit(0) @@ -947,26 +949,26 @@ # Mess with it a little p = Processor(data, 0) obj = p.parse(ast) - print "Object: %s" % obj - print obj["foo"][0]["bcdL"] - print obj["tail"] - print obj["foo"][0]["bar"] + print ("Object: %s" % obj) + print(obj["foo"][0]["bcdL"]) + print(obj["tail"]) + print(obj["foo"][0]["bar"]) obj["foo"][0]["bar"].set_value(255 << 8) obj["foo"][0]["twobit"].set_value(0) obj["foo"][0]["onebit"].set_value(1) - print "%i" % int(obj["foo"][0]["bar"]) + print("%i" % int(obj["foo"][0]["bar"])) for i in obj["foo"][0]["array"]: - print int(i) + print(int(i)) obj["foo"][0]["array"][1].set_value(255) for i in obj["foo"][0]["bcdL"]: - print i.get_value() + print(i.get_value()) int_to_bcd(obj["foo"][0]["bcdL"], 1234) - print bcd_to_int(obj["foo"][0]["bcdL"]) + print(bcd_to_int(obj["foo"][0]["bcdL"])) set_string(obj["foo"][0]["str"], "xyz") - print get_string(obj["foo"][0]["str"]) + print(get_string(obj["foo"][0]["str"])) - print repr(data.get_packed()) + print(repr(data.get_packed())) Index: chirp/bitwise_grammar.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/bitwise_grammar.py (date 1503636539000) +++ chirp/bitwise_grammar.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2010 Dan Smith # # This program is free software: you can redistribute it and/or modify @@ -104,7 +105,7 @@ if '//' in line: lines[index] = line[:line.index('//')] - class FakeFileInput: + class FakeFileInput(object): """Simulate line-by-line file reading from @data""" line = -1 Index: chirp/drivers/icomciv.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/icomciv.py (date 1503636539000) +++ chirp/drivers/icomciv.py (date 1503637841000) @@ -1,4 +1,4 @@ - +# coding=utf-8 import struct import logging from chirp.drivers import icf @@ -104,7 +104,7 @@ SPLIT = ["", "spl"] -class Frame: +class Frame(object): """Base class for an ICF frame""" _cmd = 0x00 _sub = 0x00 Index: chirp/memmap.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/memmap.py (date 1503636539000) +++ chirp/memmap.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2008 Dan Smith # # This program is free software: you can redistribute it and/or modify @@ -16,7 +17,7 @@ from chirp import util -class MemoryMap: +class MemoryMap(object): """ A pythonic memory map interface """ @@ -41,7 +42,7 @@ if start == -1: return "".join(self._data[start:]) else: - return "".join(self._data[start:start+length]) + return "".join(self._data[start:start + length]) def set(self, pos, value): """Set a chunk of memory at @pos to @value""" @@ -63,7 +64,7 @@ return len(self._data) def __getslice__(self, start, end): - return self.get(start, end-start) + return self.get(start, end - start) def __getitem__(self, pos): return self.get(pos) Index: chirp/settings.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/settings.py (date 1503636539000) +++ chirp/settings.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2012 Dan Smith # # This program is free software: you can redistribute it and/or modify @@ -28,8 +29,7 @@ pass -class RadioSettingValue: - +class RadioSettingValue(object): """Base class for a single radio setting""" def __init__(self): @@ -342,8 +342,7 @@ self[element.get_name()] = element def __iter__(self): - class RSGIterator: - + class RSGIterator(object): """Iterator for a RadioSettingGroup""" def __init__(self, rsg): Index: chirp/ui/radiobrowser.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/ui/radiobrowser.py (date 1503636539000) +++ chirp/ui/radiobrowser.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 import gtk import gobject import pango @@ -339,7 +340,8 @@ r = directory.get_radio_by_image(sys.argv[1]) - class Foo: + + class Foo(object): radio = r w = gtk.Window() Index: chirp/__init__.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/__init__.py (date 1503637713000) +++ chirp/__init__.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2008 Dan Smith # # This program is free software: you can redistribute it and/or modify Index: chirp/bandplan_au.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/bandplan_au.py (date 1503637713000) +++ chirp/bandplan_au.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2013 Sean Burford # # This program is free software: you can redistribute it and/or modify Index: chirp/bandplan_iaru_r1.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/bandplan_iaru_r1.py (date 1503637713000) +++ chirp/bandplan_iaru_r1.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2013 Sean Burford # # This program is free software: you can redistribute it and/or modify Index: chirp/bandplan_iaru_r2.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/bandplan_iaru_r2.py (date 1503637713000) +++ chirp/bandplan_iaru_r2.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2013 Sean Burford # # This program is free software: you can redistribute it and/or modify Index: chirp/bandplan_iaru_r3.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/bandplan_iaru_r3.py (date 1503637713000) +++ chirp/bandplan_iaru_r3.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2013 Sean Burford # # This program is free software: you can redistribute it and/or modify Index: chirp/bandplan_na.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/bandplan_na.py (date 1503637713000) +++ chirp/bandplan_na.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2013 Dan Smith # # This program is free software: you can redistribute it and/or modify Index: chirp/dmrmarc.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/dmrmarc.py (date 1503637713000) +++ chirp/dmrmarc.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2016 Tom Hayward # # This program is free software: you can redistribute it and/or modify Index: chirp/drivers/__init__.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/__init__.py (date 1503637713000) +++ chirp/drivers/__init__.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 import os import sys from glob import glob Index: chirp/drivers/baofeng_wp970i.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/baofeng_wp970i.py (date 1503637713000) +++ chirp/drivers/baofeng_wp970i.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2016: # * Jim Unroe KC9HI, # Index: chirp/drivers/fd268.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/fd268.py (date 1503637713000) +++ chirp/drivers/fd268.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2015 Pavel Milanes CO7WT # # This program is free software: you can redistribute it and/or modify Index: chirp/drivers/ft1802.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/ft1802.py (date 1503637713000) +++ chirp/drivers/ft1802.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2012 Tom Hayward # # This program is free software: you can redistribute it and/or modify Index: chirp/drivers/ft857.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/ft857.py (date 1503637713000) +++ chirp/drivers/ft857.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # # Copyright 2012 Filippi Marco # Index: chirp/drivers/generic_tpe.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/generic_tpe.py (date 1503637713000) +++ chirp/drivers/generic_tpe.py (date 1503642115000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2012 Tom Hayward # # This program is free software: you can redistribute it and/or modify @@ -13,7 +14,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import UserDict from chirp import chirp_common, directory from chirp.drivers import generic_csv Index: chirp/drivers/gmrsuv1.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/gmrsuv1.py (date 1503637713000) +++ chirp/drivers/gmrsuv1.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2016: # * Jim Unroe KC9HI, # Index: chirp/drivers/hobbypcb.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/hobbypcb.py (date 1503637713000) +++ chirp/drivers/hobbypcb.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2016 Dan Smith # # This program is free software: you can redistribute it and/or modify Index: chirp/drivers/ic208.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/ic208.py (date 1503637713000) +++ chirp/drivers/ic208.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2013 Dan Smith # # This program is free software: you can redistribute it and/or modify Index: chirp/drivers/ic2100.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/ic2100.py (date 1503637713000) +++ chirp/drivers/ic2100.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2010 Dan Smith # # This program is free software: you can redistribute it and/or modify Index: chirp/drivers/ic2200.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/ic2200.py (date 1503637713000) +++ chirp/drivers/ic2200.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2008 Dan Smith # # This program is free software: you can redistribute it and/or modify Index: chirp/drivers/ic2720.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/ic2720.py (date 1503637713000) +++ chirp/drivers/ic2720.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2011 Dan Smith # # This program is free software: you can redistribute it and/or modify Index: chirp/drivers/ic2820.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/ic2820.py (date 1503637713000) +++ chirp/drivers/ic2820.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2010 Dan Smith # # This program is free software: you can redistribute it and/or modify Index: chirp/drivers/ic9x_icf.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/ic9x_icf.py (date 1503637713000) +++ chirp/drivers/ic9x_icf.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2010 Dan Smith # # This program is free software: you can redistribute it and/or modify Index: chirp/drivers/ic9x_icf_ll.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/ic9x_icf_ll.py (date 1503637713000) +++ chirp/drivers/ic9x_icf_ll.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2010 Dan Smith # # This program is free software: you can redistribute it and/or modify Index: chirp/drivers/icp7.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/icp7.py (date 1503637713000) +++ chirp/drivers/icp7.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2017 SASANO Takayoshi (JG1UAA) # # This program is free software: you can redistribute it and/or modify Index: chirp/drivers/ict70.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/ict70.py (date 1503637713000) +++ chirp/drivers/ict70.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2011 Dan Smith # # This program is free software: you can redistribute it and/or modify Index: chirp/drivers/ict7h.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/ict7h.py (date 1503637713000) +++ chirp/drivers/ict7h.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2012 Eric Allen # # This program is free software: you can redistribute it and/or modify Index: chirp/drivers/ict8.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/ict8.py (date 1503637713000) +++ chirp/drivers/ict8.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2012 Dan Smith # # This program is free software: you can redistribute it and/or modify Index: chirp/drivers/icw32.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/icw32.py (date 1503637713000) +++ chirp/drivers/icw32.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2011 Dan Smith # # This program is free software: you can redistribute it and/or modify Index: chirp/drivers/icx8x.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/icx8x.py (date 1503637713000) +++ chirp/drivers/icx8x.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2008 Dan Smith # # This program is free software: you can redistribute it and/or modify Index: chirp/drivers/icx8x_ll.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/icx8x_ll.py (date 1503637713000) +++ chirp/drivers/icx8x_ll.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2008 Dan Smith # # This program is free software: you can redistribute it and/or modify Index: chirp/drivers/id31.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/id31.py (date 1503637713000) +++ chirp/drivers/id31.py (date 1503639966000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2012 Dan Smith # # This program is free software: you can redistribute it and/or modify @@ -13,6 +14,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import print_function + from chirp.drivers import icf from chirp import directory, bitwise, chirp_common @@ -332,6 +335,6 @@ return calls if __name__ == "__main__": - print repr(_decode_call(_encode_call("KD7REX B"))) - print repr(_decode_call(_encode_call(" B"))) - print repr(_decode_call(_encode_call(" "))) + print(repr(_decode_call(_encode_call("KD7REX B")))) + print(repr(_decode_call(_encode_call(" B")))) + print(repr(_decode_call(_encode_call(" ")))) Index: chirp/drivers/id51.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/id51.py (date 1503637713000) +++ chirp/drivers/id51.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2012 Dan Smith # # This program is free software: you can redistribute it and/or modify Index: chirp/drivers/id51plus.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/id51plus.py (date 1503637713000) +++ chirp/drivers/id51plus.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2015 Eric Dropps # # This program is free software: you can redistribute it and/or modify Index: chirp/drivers/id800.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/id800.py (date 1503637713000) +++ chirp/drivers/id800.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2008 Dan Smith # # This program is free software: you can redistribute it and/or modify Index: chirp/drivers/id880.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/id880.py (date 1503637713000) +++ chirp/drivers/id880.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2010 Dan Smith # # This program is free software: you can redistribute it and/or modify Index: chirp/drivers/idrp.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/idrp.py (date 1503637713000) +++ chirp/drivers/idrp.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2008 Dan Smith # # This program is free software: you can redistribute it and/or modify Index: chirp/drivers/kenwood_live.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/kenwood_live.py (date 1503637713000) +++ chirp/drivers/kenwood_live.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2010 Dan Smith # # This program is free software: you can redistribute it and/or modify Index: chirp/drivers/puxing_px888k.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/puxing_px888k.py (date 1503637713000) +++ chirp/drivers/puxing_px888k.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2016 Leo Barring # # This program is free software: you can redistribute it and/or modify Index: chirp/drivers/repeaterbook.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/repeaterbook.py (date 1503637713000) +++ chirp/drivers/repeaterbook.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2016 Tom Hayward # # This program is free software: you can redistribute it and/or modify Index: chirp/drivers/rh5r_v2.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/rh5r_v2.py (date 1503637713000) +++ chirp/drivers/rh5r_v2.py (date 1503639966000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2017 Dan Smith # # This program is free software: you can redistribute it and/or modify @@ -13,6 +14,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import print_function + """Rugged RH5R V2 radio management module""" import struct @@ -167,7 +170,7 @@ filedata[0x840:0x848] == cls._FILEID) def process_mmap(self): - print MEM_FORMAT + print(MEM_FORMAT) self._memobj = bitwise.parse(MEM_FORMAT, self._mmap) def get_raw_memory(self, number): Index: chirp/drivers/template.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/template.py (date 1503637713000) +++ chirp/drivers/template.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2012 Dan Smith # # This program is free software: you can redistribute it and/or modify Index: chirp/drivers/th_uv3r.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/th_uv3r.py (date 1503637713000) +++ chirp/drivers/th_uv3r.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2011 Dan Smith # # This program is free software: you can redistribute it and/or modify Index: chirp/drivers/th_uv3r25.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/th_uv3r25.py (date 1503637713000) +++ chirp/drivers/th_uv3r25.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2015 Eric Allen # # This program is free software: you can redistribute it and/or modify Index: chirp/drivers/th_uvf8d.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/th_uvf8d.py (date 1503637713000) +++ chirp/drivers/th_uvf8d.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2013 Dan Smith # Eric Allen # Index: chirp/drivers/tk270.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/tk270.py (date 1503637713000) +++ chirp/drivers/tk270.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2016 Pavel Milanes CO7WT, # # This program is free software: you can redistribute it and/or modify Index: chirp/drivers/tk760.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/tk760.py (date 1503637713000) +++ chirp/drivers/tk760.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2016 Pavel Milanes CO7WT, # # This program is free software: you can redistribute it and/or modify Index: chirp/drivers/tmv71.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/tmv71.py (date 1503637713000) +++ chirp/drivers/tmv71.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2010 Dan Smith # # This program is free software: you can redistribute it and/or modify Index: chirp/drivers/ts2000.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/ts2000.py (date 1503637713000) +++ chirp/drivers/ts2000.py (date 1503639966000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2012 Tom Hayward # # This program is free software: you can redistribute it and/or modify @@ -13,6 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import print_function import re from chirp import chirp_common, directory, util, errors from chirp.drivers import kenwood_live @@ -217,7 +219,7 @@ duplex = 0 offset = 0 else: - print "Bug: unsupported duplex `%s'" % mem.duplex + print("Bug: unsupported duplex `%s'" % mem.duplex) if mem.mode in ["AM", "FM"]: step = TS2000_FM_STEPS.index(mem.tuning_step) else: @@ -259,7 +261,7 @@ elif mem.duplex == "split": duplex = 0 else: - print "Bug: unsupported duplex `%s'" % mem.duplex + print("Bug: unsupported duplex `%s'" % mem.duplex) if mem.mode in ["AM", "FM"]: step = TS2000_FM_STEPS.index(mem.tuning_step) else: Index: chirp/drivers/uv5x3.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/uv5x3.py (date 1503637713000) +++ chirp/drivers/uv5x3.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2016: # * Jim Unroe KC9HI, # Index: chirp/drivers/uv6r.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/uv6r.py (date 1503637713000) +++ chirp/drivers/uv6r.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2016: # * Jim Unroe KC9HI, # Index: chirp/drivers/vx170.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/vx170.py (date 1503637713000) +++ chirp/drivers/vx170.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2014 Jens Jensen # # This program is free software: you can redistribute it and/or modify Index: chirp/drivers/vx5.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/vx5.py (date 1503637713000) +++ chirp/drivers/vx5.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2011 Dan Smith # Copyright 2012 Tom Hayward # Index: chirp/drivers/vx510.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/vx510.py (date 1503637713000) +++ chirp/drivers/vx510.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2012 Tom Hayward # # This program is free software: you can redistribute it and/or modify Index: chirp/drivers/vx6.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/vx6.py (date 1503637713000) +++ chirp/drivers/vx6.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2010 Dan Smith # # This program is free software: you can redistribute it and/or modify Index: chirp/drivers/vx7.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/vx7.py (date 1503637713000) +++ chirp/drivers/vx7.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2010 Dan Smith # # This program is free software: you can redistribute it and/or modify Index: chirp/drivers/wouxun_common.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/drivers/wouxun_common.py (date 1503637713000) +++ chirp/drivers/wouxun_common.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # # Copyright 2012 Filippi Marco # Index: chirp/errors.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/errors.py (date 1503637713000) +++ chirp/errors.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2008 Dan Smith # # This program is free software: you can redistribute it and/or modify Index: chirp/import_logic.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/import_logic.py (date 1503637713000) +++ chirp/import_logic.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2011 Dan Smith # # This program is free software: you can redistribute it and/or modify Index: chirp/ui/__init__.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/ui/__init__.py (date 1503637713000) +++ chirp/ui/__init__.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2008 Dan Smith # # This program is free software: you can redistribute it and/or modify Index: chirp/ui/bandplans.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/ui/bandplans.py (date 1503637713000) +++ chirp/ui/bandplans.py (date 1503641665000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2013 Sean Burford # # This program is free software: you can redistribute it and/or modify @@ -85,7 +86,7 @@ def select_bandplan(self, parent_window): plans = ["None"] - for shortname, details in self.plans.iteritems(): + for shortname, details in self.plans.items(): if self._config.get_bool(shortname, "bandplan"): plans.insert(0, details[0]) else: @@ -102,7 +103,7 @@ if r == gtk.RESPONSE_OK: selection = d.choice.get_active_text() - for shortname, details in self.plans.iteritems(): + for shortname, details in self.plans.items(): self._config.set_bool(shortname, selection == details[0], "bandplan") if selection == details[0]: Index: chirp/ui/bankedit.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/ui/bankedit.py (date 1503637713000) +++ chirp/ui/bankedit.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2008 Dan Smith # # This program is free software: you can redistribute it and/or modify Index: chirp/ui/cloneprog.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/ui/cloneprog.py (date 1503637713000) +++ chirp/ui/cloneprog.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2008 Dan Smith # # This program is free software: you can redistribute it and/or modify Index: chirp/ui/dstaredit.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/ui/dstaredit.py (date 1503637713000) +++ chirp/ui/dstaredit.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2008 Dan Smith # # This program is free software: you can redistribute it and/or modify Index: chirp/ui/fips.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/ui/fips.py (date 1503637713000) +++ chirp/ui/fips.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2012 Tom Hayward # # This program is free software: you can redistribute it and/or modify Index: chirp/ui/inputdialog.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/ui/inputdialog.py (date 1503637713000) +++ chirp/ui/inputdialog.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2008 Dan Smith # # This program is free software: you can redistribute it and/or modify Index: chirp/util.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/util.py (date 1503637713000) +++ chirp/util.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2008 Dan Smith # # This program is free software: you can redistribute it and/or modify Index: chirp/xml_ll.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- chirp/xml_ll.py (date 1503637713000) +++ chirp/xml_ll.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2008 Dan Smith # # This program is free software: you can redistribute it and/or modify Index: chirpw IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>US-ASCII =================================================================== --- chirpw (date 1503637713000) +++ chirpw (date 1503637841000) @@ -1,4 +1,5 @@ #!/usr/bin/env python +# coding=utf-8 # # Copyright 2014 Dan Smith # Index: csvdump/__init__.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- csvdump/__init__.py (date 1503637713000) +++ csvdump/__init__.py (date 1503637841000) @@ -1,4 +1,5 @@ #!/usr/bin/env python +# coding=utf-8 # # Copyright 2008 Dan Smith # Index: csvdump/csvdump.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- csvdump/csvdump.py (date 1503637713000) +++ csvdump/csvdump.py (date 1503639966000) @@ -1,4 +1,5 @@ #!/usr/bin/env python +# coding=utf-8 # # Copyright 2008 Dan Smith # @@ -14,6 +15,7 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . +from __future__ import print_function import gtk @@ -240,7 +242,7 @@ if __name__ == "__main__": def cb(arg=None): - print "Callback: %s" % arg + print("Callback: %s" % arg) w = CsvDumpWindow(cb, cb, cb, cb) Index: locale/check_parameters.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- locale/check_parameters.py (date 1503637713000) +++ locale/check_parameters.py (date 1503641665000) @@ -1,4 +1,7 @@ #!/usr/bin/env python +# coding=utf-8 + +from __future__ import print_function import polib from string import Formatter @@ -9,8 +12,8 @@ formatter = Formatter() -for name, po in pos.iteritems(): - print "Testing", name +for name, po in pos.items(): + print("Testing {}".format(name)) for entry in po: if len(entry.msgstr) > 0: try: @@ -21,11 +24,10 @@ for literal_text, field_name, format_spec, conversion in formatter.parse(entry.msgstr)] except Exception as e: - print "Got exception!", e, "for entry", entry.msgid + print("Got exception! {} for entry {}".format(e, entry.msgid)) else: if tids is not None: missing = [name for name in tids if name is not None and name not in ids] if len(missing) > 0: - print "Missing parameters", missing, \ - "in translation of", entry.msgid + print("Missing parameters {} in translation of {}".format(missing, entry.msgid)) Index: tests/__init__.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- tests/__init__.py (date 1503637713000) +++ tests/__init__.py (date 1503637841000) @@ -1,0 +1,1 @@ +# coding=utf-8 \ No newline at end of file Index: tests/unit/__init__.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- tests/unit/__init__.py (date 1503637713000) +++ tests/unit/__init__.py (date 1503637841000) @@ -1,0 +1,1 @@ +# coding=utf-8 \ No newline at end of file Index: tests/unit/base.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- tests/unit/base.py (date 1503637713000) +++ tests/unit/base.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 import unittest import mox Index: tests/unit/test_bitwise.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- tests/unit/test_bitwise.py (date 1503637713000) +++ tests/unit/test_bitwise.py (date 1503641665000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2013 Dan Smith # # This program is free software: you can redistribute it and/or modify @@ -21,7 +22,7 @@ class BaseTest(unittest.TestCase): def _compare_structure(self, obj, primitive): - for key, value in primitive.iteritems(): + for key, value in primitive.items(): if isinstance(value, dict): self._compare_structure(getattr(obj, key), value) else: Index: tests/unit/test_chirp_common.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- tests/unit/test_chirp_common.py (date 1503637713000) +++ tests/unit/test_chirp_common.py (date 1503639966000) @@ -1,3 +1,5 @@ +# coding=utf-8 +from __future__ import print_function from tests.unit import base from chirp import chirp_common from chirp import errors @@ -208,7 +210,7 @@ def test_is_fractional_step(self): for freq in self._125 + self._625: - print freq + print(freq) self.assertTrue(chirp_common.is_fractional_step(freq)) def test_is_6_25(self): Index: tests/unit/test_import_logic.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- tests/unit/test_import_logic.py (date 1503637713000) +++ tests/unit/test_import_logic.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 from tests.unit import base from chirp import import_logic from chirp import chirp_common Index: tests/unit/test_mappingmodel.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- tests/unit/test_mappingmodel.py (date 1503637713000) +++ tests/unit/test_mappingmodel.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2013 Dan Smith # # This program is free software: you can redistribute it and/or modify Index: tests/unit/test_memedit_edits.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- tests/unit/test_memedit_edits.py (date 1503637713000) +++ tests/unit/test_memedit_edits.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 import mox from tests.unit import base Index: tests/unit/test_platform.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- tests/unit/test_platform.py (date 1503637713000) +++ tests/unit/test_platform.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2013 Dan Smith # # This program is free software: you can redistribute it and/or modify Index: tests/unit/test_settings.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- tests/unit/test_settings.py (date 1503637713000) +++ tests/unit/test_settings.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 # Copyright 2013 Dan Smith # # This program is free software: you can redistribute it and/or modify Index: tests/unit/test_shiftdialog.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- tests/unit/test_shiftdialog.py (date 1503637713000) +++ tests/unit/test_shiftdialog.py (date 1503637841000) @@ -1,3 +1,4 @@ +# coding=utf-8 import unittest import mox Index: tools/bitdiff.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- tools/bitdiff.py (date 1503637713000) +++ tools/bitdiff.py (date 1503639966000) @@ -1,7 +1,10 @@ #!/usr/bin/env python +# coding=utf-8 # # Copyright 2013 Jens Jensen AF5MI +from __future__ import print_function + import sys import os import argparse @@ -11,9 +14,9 @@ def printDiff(pos, byte1, byte2, args): bits1 = '{0:08b}'.format(byte1) bits2 = '{0:08b}'.format(byte2) - print "@%04Xh" % pos - print "1:%02Xh, %sb" % (byte1, bits1) - print "2:%02Xh, %sb" % (byte2, bits2) + print("@%04Xh" % pos) + print("1:%02Xh, %sb" % (byte1, bits1)) + print("2:%02Xh, %sb" % (byte2, bits2)) if args.csv: writeDiffCSV(pos, byte1, byte2, args) @@ -53,7 +56,7 @@ printDiff(pos, b1, b2, args) pos = f1.tell() - args.offset - print "bytes read: %02d" % pos + print("bytes read: %02d" % pos) f1.close() f2.close() @@ -82,7 +85,7 @@ printDiff(pos, b1, b2, args) pos = length - print "bytes read: %02d" % pos + print("bytes read: %02d" % pos) def convertFileToBin(args): @@ -147,9 +150,9 @@ if args.offset: args.offset = int(args.offset, 16) -print "f1:", args.file1, " f2:", args.file2 +print("f1: {0} f2: {1}".format(args.file1,args.file2)) if args.setting or args.value: - print "setting:", args.setting, "- value:", args.value + print("setting: {0} - value: {1}".format(args.setting, args.value)) while True: if (args.dat):