# HG changeset patch
# User Tyler Tidman <tyler.tidman@draak.ca>
# Date 1477428491 14400
#      Tue Oct 25 16:48:11 2016 -0400
# Node ID c83daa0abc46fd7d5446abed1703b747bf5b43c3
# Parent  cc28502a220f297e56fa9d99e7ea74480e1cd15f
Minor PEP8 cleanup for some drivers.  Fixes #4161.

diff -r cc28502a220f -r c83daa0abc46 chirp/chirp_common.py
--- a/chirp/chirp_common.py	Sun Oct 16 16:55:56 2016 -0700
+++ b/chirp/chirp_common.py	Tue Oct 25 16:48:11 2016 -0400
@@ -30,7 +30,7 @@
          ]
 
 TONES_EXTRA = [56.0, 57.0, 58.0, 59.0, 60.0, 61.0, 62.0,
-               62.5, 63.0, 64.0 ]
+               62.5, 63.0, 64.0]
 
 OLD_TONES = list(TONES)
 [OLD_TONES.remove(x) for x in [159.8, 165.5, 171.3, 177.3, 183.5, 189.9,
@@ -48,7 +48,7 @@
     465, 466, 503, 506, 516, 523, 526, 532, 546, 565, 606,
     612, 624, 627, 631, 632, 654, 662, 664, 703, 712, 723,
     731, 732, 734, 743, 754,
-    ]
+]
 
 # 512 Possible DTCS Codes
 ALL_DTCS_CODES = []
@@ -94,7 +94,7 @@
 CHARSET_UPPER_NUMERIC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ 1234567890"
 CHARSET_ALPHANUMERIC = \
     "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz 1234567890"
-CHARSET_ASCII = "".join([chr(x) for x in range(ord(" "), ord("~")+1)])
+CHARSET_ASCII = "".join([chr(x) for x in range(ord(" "), ord("~") + 1)])
 
 # http://aprs.org/aprs11/SSIDs.txt
 APRS_SSID = (
@@ -155,6 +155,7 @@
 
 class PowerLevel:
     """Represents a power level supported by a radio"""
+
     def __init__(self, label, watts=0, dBm=0):
         if watts:
             dBm = watts_to_dBm(watts)
@@ -297,7 +298,7 @@
         "skip":           SKIP_VALUES,
         "empty":          [True, False],
         "dv_code":        [x for x in range(0, 100)],
-        }
+    }
 
     def __repr__(self):
         return "Memory[%i]" % self.number
@@ -553,6 +554,7 @@
 
 class MemoryMapping(object):
     """Base class for a memory mapping"""
+
     def __init__(self, model, index, name):
         self._model = model
         self._index = index
@@ -619,6 +621,7 @@
 
 class NamedBank(Bank):
     """A bank that can have a name"""
+
     def set_name(self, name):
         """Changes the user-adjustable bank name"""
         self._name = name
@@ -626,12 +629,14 @@
 
 class BankModel(MappingModel):
     """A bank model where one memory is in zero or one banks at any point"""
+
     def __init__(self, radio, name='Banks'):
         super(BankModel, self).__init__(radio, name)
 
 
 class MappingModelIndexInterface:
     """Interface for mappings with index capabilities"""
+
     def get_index_bounds(self):
         """Returns a tuple (lo,hi) of the min and max mapping indices"""
         raise NotImplementedError()
@@ -722,7 +727,7 @@
         # D-STAR
         "requires_call_lists":  BOOLEAN,
         "has_implicit_calls":   BOOLEAN,
-        }
+    }
 
     def __setattr__(self, name, val):
         if name.startswith("_"):
@@ -942,8 +947,8 @@
                     break
             if not valid:
                 msg = ValidationError(
-                        ("Tx freq {freq} is out "
-                         "of supported range").format(freq=format_freq(freq)))
+                    ("Tx freq {freq} is out "
+                     "of supported range").format(freq=format_freq(freq)))
                 msgs.append(msg)
 
         if mem.power and \
@@ -1191,6 +1196,7 @@
 
 class NetworkSourceRadio(Radio):
     """Base class for all radios based on a network source"""
+
     def do_fetch(self):
         """Fetch the source data from the network"""
         pass
diff -r cc28502a220f -r c83daa0abc46 chirp/drivers/ft2900.py
--- a/chirp/drivers/ft2900.py	Sun Oct 16 16:55:56 2016 -0700
+++ b/chirp/drivers/ft2900.py	Tue Oct 25 16:48:11 2016 -0400
@@ -146,7 +146,7 @@
         cs += ord(byte)
 
     while block < (radio.get_memsize() / 32):
-        data = radio.get_mmap()[block*32:(block+1)*32]
+        data = radio.get_mmap()[block * 32:(block + 1) * 32]
 
         LOG.debug("Writing block %i:\n%s" % (block, util.hexprint(data)))
 
@@ -381,9 +381,9 @@
 
 def _encode_name(mem):
     if(mem.strip() == ""):
-        return [0xff]*6
+        return [0xff] * 6
 
-    name = [None]*6
+    name = [None] * 6
     for i in range(0, 6):
         try:
             name[i] = CHARSET.index(mem[i])
@@ -399,6 +399,7 @@
 
 
 class FT2900Bank(chirp_common.NamedBank):
+
     def get_name(self):
         _bank = self._model._radio._memobj.bank_names[self.index]
         name = ""
@@ -416,6 +417,7 @@
 
 
 class FT2900BankModel(chirp_common.BankModel):
+
     def get_num_mappings(self):
         return 8
 
@@ -558,7 +560,7 @@
 
     def get_memory(self, number):
         _mem = self._memobj.memory[number]
-        _flag = self._memobj.flags[(number)/2]
+        _flag = self._memobj.flags[(number) / 2]
 
         nibble = ((number) % 2) and "even" or "odd"
         used = _flag["%s_masked" % nibble]
@@ -622,7 +624,7 @@
 
     def set_memory(self, mem):
         _mem = self._memobj.memory[mem.number]
-        _flag = self._memobj.flags[(mem.number)/2]
+        _flag = self._memobj.flags[(mem.number) / 2]
 
         nibble = ((mem.number) % 2) and "even" or "odd"
 
@@ -764,19 +766,20 @@
         # 5 BCLO
         opts = ["Off", "On"]
         misc.append(RadioSetting(
-                "busy_lockout", "Busy Channel Lock-Out",
-                RadioSettingValueList(opts, opts[_settings.busy_lockout])))
+            "busy_lockout", "Busy Channel Lock-Out",
+            RadioSettingValueList(opts, opts[_settings.busy_lockout])))
 
         # 6 BEEP
         opts = ["Off", "Key+Scan", "Key"]
         switch.append(RadioSetting(
-                "beep", "Enable the Beeper",
-                RadioSettingValueList(opts, opts[_settings.beep])))
+            "beep", "Enable the Beeper",
+            RadioSettingValueList(opts, opts[_settings.beep])))
 
         # 7 BELL
         opts = ["Off", "1", "3", "5", "8", "Continuous"]
         ctcss.append(RadioSetting("bell", "Bell Repetitions",
-                     RadioSettingValueList(opts, opts[_settings.bell])))
+                                  RadioSettingValueList(opts, opts[
+                                                        _settings.bell])))
 
         # 8 BNK.LNK
         for i in range(0, 8):
@@ -800,7 +803,8 @@
         # 11 CW.ID
         opts = ["Off", "On"]
         arts.append(RadioSetting("cw_id", "CW ID Enable",
-                    RadioSettingValueList(opts, opts[_settings.cw_id])))
+                                 RadioSettingValueList(opts, opts[
+                                                       _settings.cw_id])))
 
         cw_id_text = ""
         for i in _settings.cw_id_string:
@@ -830,14 +834,16 @@
                 "10WPM", "11WPM", "12WPM", "13WPM", "15WPM", "17WPM",
                 "20WPM", "24WPM", "30WPM", "40WPM"]
         misc.append(RadioSetting("cw_trng", "CW Training",
-                    RadioSettingValueList(opts, opts[_settings.cw_trng])))
+                                 RadioSettingValueList(opts, opts[
+                                                       _settings.cw_trng])))
 
         # todo: make the setting of the units here affect the display
         # of the speed.  Not critical, but would be slick.
         opts = ["CPM", "WPM"]
         misc.append(RadioSetting("cw_trng_units", "CW Training Units",
-                    RadioSettingValueList(opts,
-                                          opts[_settings.cw_trng_units])))
+                                 RadioSettingValueList(opts, opts[
+                                                       _settings
+                                                       .cw_trng_units])))
 
         # 13 DC VLT - a read-only status, so nothing to do here
 
@@ -904,66 +910,61 @@
         opts = ["50 ms", "100 ms"]
         dtmf.append(RadioSetting("dtmf_speed",
                                  "DTMF Autodialer Sending Speed",
-                                 RadioSettingValueList(opts,
-                                                       opts[_settings.
-                                                            dtmf_speed])))
+                                 RadioSettingValueList(opts, opts[
+                                                       _settings.dtmf_speed])))
 
         # 21 EDG.BEP
         opts = ["Off", "On"]
         mbls.append(RadioSetting("edge_beep", "Band Edge Beeper",
-                                 RadioSettingValueList(opts,
-                                                       opts[_settings.
-                                                            edge_beep])))
+                                 RadioSettingValueList(opts, opts[
+                                                       _settings.edge_beep])))
 
         # 22 INT.CD
         opts = ["DTMF %X" % (x) for x in range(0, 16)]
         wires.append(RadioSetting("int_cd", "Access Number for WiRES(TM)",
-                     RadioSettingValueList(opts, opts[_settings.int_cd])))
+                                  RadioSettingValueList(opts, opts[
+                                                        _settings.int_cd])))
 
         # 23 ING MD
         opts = ["Sister Radio Group", "Friends Radio Group"]
         wires.append(RadioSetting("wires_mode",
                                   "Internet Link Connection Mode",
-                                  RadioSettingValueList(opts,
-                                                        opts[_settings.
-                                                             wires_mode])))
+                                  RadioSettingValueList(opts, opts[
+                                                        _settings
+                                                        .wires_mode])))
 
         # 24 INT.A/M
         opts = ["Manual", "Auto"]
         wires.append(RadioSetting("wires_auto", "Internet Link Autodialer",
-                                  RadioSettingValueList(opts,
-                                                        opts[_settings
-                                                             .wires_auto])))
+                                  RadioSettingValueList(opts, opts[
+                                                        _settings
+                                                        .wires_auto])))
         # 25 INT.SET
         opts = ["F%d" % (x) for x in range(0, 10)]
 
         wires.append(RadioSetting("int_set", "Memory Register for "
                                   "non-WiRES Internet",
-                                  RadioSettingValueList(opts,
-                                                        opts[_settings
-                                                             .int_set])))
+                                  RadioSettingValueList(opts, opts[
+                                                        _settings.int_set])))
 
         # 26 LOCK
         opts = ["Key", "Dial", "Key + Dial", "PTT",
                 "Key + PTT", "Dial + PTT", "All"]
         switch.append(RadioSetting("lock", "Control Locking",
-                                   RadioSettingValueList(opts,
-                                                         opts[_settings
-                                                              .lock])))
+                                   RadioSettingValueList(opts, opts[
+                                                         _settings.lock])))
 
         # 27 MCGAIN
         opts = ["Level %d" % (x) for x in range(1, 10)]
         misc.append(RadioSetting("mic_gain", "Microphone Gain",
-                                 RadioSettingValueList(opts,
-                                                       opts[_settings
-                                                            .mic_gain])))
+                                 RadioSettingValueList(opts, opts[
+                                                       _settings.mic_gain])))
 
         # 28 MEM.SCN
         opts = ["Tag 1", "Tag 2", "All Channels"]
         rs = RadioSetting("scan_mode", "Memory Scan Mode",
-                          RadioSettingValueList(opts,
-                                                opts[_settings
-                                                     .scan_mode - 1]))
+                          RadioSettingValueList(opts, opts[
+                                                _settings.scan_mode - 1]))
         # this setting is unusual in that it starts at 1 instead of 0.
         # that is, index 1 corresponds to "Tag 1", and index 0 is invalid.
         # so we create a custom callback to handle this.
@@ -1053,26 +1054,26 @@
         # 36 PRG P1
         opts = button_opts + ["DC Volts"]
         switch.append(RadioSetting(
-                "prog_p1", "P1 Button",
-                RadioSettingValueList(opts, opts[_settings.prog_p1])))
+            "prog_p1", "P1 Button",
+            RadioSettingValueList(opts, opts[_settings.prog_p1])))
 
         # 37 PRG P2
         opts = button_opts + ["Dimmer"]
         switch.append(RadioSetting(
-                "prog_p2", "P2 Button",
-                RadioSettingValueList(opts, opts[_settings.prog_p2])))
+            "prog_p2", "P2 Button",
+            RadioSettingValueList(opts, opts[_settings.prog_p2])))
 
         # 38 PRG P3
         opts = button_opts + ["Mic Gain"]
         switch.append(RadioSetting(
-                "prog_p3", "P3 Button",
-                RadioSettingValueList(opts, opts[_settings.prog_p3])))
+            "prog_p3", "P3 Button",
+            RadioSettingValueList(opts, opts[_settings.prog_p3])))
 
         # 39 PRG P4
         opts = button_opts + ["Skip"]
         switch.append(RadioSetting(
-                "prog_p4", "P4 Button",
-                RadioSettingValueList(opts, opts[_settings.prog_p4])))
+            "prog_p4", "P4 Button",
+            RadioSettingValueList(opts, opts[_settings.prog_p4])))
 
         # 40 PSWD
         password = ""
@@ -1101,24 +1102,28 @@
         # 41 RESUME
         opts = ["3 Sec", "5 Sec", "10 Sec", "Busy", "Hold"]
         scan.append(RadioSetting("resume", "Scan Resume Mode",
-                    RadioSettingValueList(opts, opts[_settings.resume])))
+                                 RadioSettingValueList(opts, opts[
+                                                       _settings.resume])))
 
         # 42 RF.SQL
         opts = ["Off"] + ["S-%d" % (x) for x in range(1, 10)]
         misc.append(RadioSetting("rf_sql", "RF Squelch Threshold",
-                    RadioSettingValueList(opts, opts[_settings.rf_sql])))
+                                 RadioSettingValueList(opts, opts[
+                                                       _settings.rf_sql])))
 
         # 43 RPT - per channel attribute, nothing to do here
 
         # 44 RVRT
         opts = ["Off", "On"]
         misc.append(RadioSetting("revert", "Priority Revert",
-                    RadioSettingValueList(opts, opts[_settings.revert])))
+                                 RadioSettingValueList(opts, opts[
+                                                       _settings.revert])))
 
         # 45 S.SRCH
         opts = ["Single", "Continuous"]
         misc.append(RadioSetting("s_search", "Smart Search Sweep Mode",
-                    RadioSettingValueList(opts, opts[_settings.s_search])))
+                                 RadioSettingValueList(opts, opts[
+                                                       _settings.s_search])))
 
         # 46 SHIFT - per channel setting, nothing to do here
 
@@ -1137,39 +1142,38 @@
         # 53 TOT
         opts = ["Off", "1 Min", "3 Min", "5 Min", "10 Min"]
         misc.append(RadioSetting("tot", "Timeout Timer",
-                                 RadioSettingValueList(opts,
-                                                       opts[_settings.tot])))
+                                 RadioSettingValueList(opts, opts[
+                                                       _settings.tot])))
 
         # 54 TS MUT
         opts = ["Off", "On"]
         ctcss.append(RadioSetting("ts_mut", "Tone Search Mute",
-                                  RadioSettingValueList(opts,
-                                                        opts[_settings
-                                                             .ts_mut])))
+                                  RadioSettingValueList(opts, opts[
+                                                        _settings.ts_mut])))
 
         # 55 TS SPEED
         opts = ["Fast", "Slow"]
         ctcss.append(RadioSetting("ts_speed", "Tone Search Scanner Speed",
-                                  RadioSettingValueList(opts,
-                                                        opts[_settings
-                                                             .ts_speed])))
+                                  RadioSettingValueList(opts, opts[
+                                                        _settings.ts_speed])))
 
         # 56 VFO.SCN
         opts = ["+/- 1MHz", "+/- 2MHz", "+/-5MHz", "All"]
         scan.append(RadioSetting("vfo_scan", "VFO Scanner Width",
-                                 RadioSettingValueList(opts,
-                                                       opts[_settings
-                                                            .vfo_scan])))
+                                 RadioSettingValueList(opts, opts[
+                                                       _settings.vfo_scan])))
 
         # 57 WX.ALT
         opts = ["Off", "On"]
         misc.append(RadioSetting("wx_alert", "Weather Alert Scan",
-                    RadioSettingValueList(opts, opts[_settings.wx_alert])))
+                                 RadioSettingValueList(opts, opts[
+                                                       _settings.wx_alert])))
 
         # 58 WX.VOL
         opts = ["Normal", "Maximum"]
         misc.append(RadioSetting("wx_vol_max", "Weather Alert Volume",
-                    RadioSettingValueList(opts, opts[_settings.wx_vol_max])))
+                                 RadioSettingValueList(opts, opts[
+                                                       _settings.wx_vol_max])))
 
         # 59 W/N DV - this is a per-channel attribute, nothing to do here
 
@@ -1233,7 +1237,7 @@
 # to the R (USA) version, except for the model number and ID Block.  We
 # create and register a class for it, with only the needed overrides
 # NOTE: Disabled until detection is fixed
-#@directory.register
+# @directory.register
 class FT2900ERadio(FT2900Radio):
     """Yaesu FT-2900E"""
     MODEL = "FT-2900E/1900E"
diff -r cc28502a220f -r c83daa0abc46 chirp/drivers/ft60.py
--- a/chirp/drivers/ft60.py	Sun Oct 16 16:55:56 2016 -0700
+++ b/chirp/drivers/ft60.py	Tue Oct 25 16:48:11 2016 -0400
@@ -82,14 +82,14 @@
 
     for i in range(0, 448):
         offset = 8 + (i * 64)
-        _send(radio.pipe, radio.get_mmap()[offset:offset+64])
+        _send(radio.pipe, radio.get_mmap()[offset:offset + 64])
         ack = radio.pipe.read(1)
         if ack != ACK:
             raise Exception(_("Radio did not ack block %i") % i)
 
         if radio.status_fn:
             status = chirp_common.Status()
-            status.cur = offset+64
+            status.cur = offset + 64
             status.max = radio.get_memsize()
             status.msg = "Cloning to radio"
             radio.status_fn(status)
@@ -133,7 +133,7 @@
 
 
 def _encode_name(mem):
-    name = [None]*6
+    name = [None] * 6
     for i in range(0, 6):
         try:
             name[i] = CHARSET.index(mem[i])
@@ -291,6 +291,7 @@
 
 
 class FT60BankModel(chirp_common.BankModel):
+
     def get_num_mappings(self):
         return 10
 
@@ -436,7 +437,7 @@
                                 wires, eai, switch, misc, mbls)
 
         # APO
-        opts = ["OFF"] + ["%0.1f" % (x * 0.5) for x in range(1, 24+1)]
+        opts = ["OFF"] + ["%0.1f" % (x * 0.5) for x in range(1, 24 + 1)]
         misc.append(
             RadioSetting(
                 "apo", "Automatic Power Off",
@@ -466,15 +467,15 @@
         # BCLO
         opts = ["OFF", "ON"]
         misc.append(RadioSetting(
-                "bclo", "Busy Channel Lock-Out",
-                RadioSettingValueList(opts, opts[_settings.bclo])))
+            "bclo", "Busy Channel Lock-Out",
+            RadioSettingValueList(opts, opts[_settings.bclo])))
 
         # BEEP
         opts = ["OFF", "KEY", "KEY+SC"]
         rs = RadioSetting(
-                "beep_key", "Enable the Beeper",
-                RadioSettingValueList(
-                    opts, opts[_settings.beep_key + _settings.beep_sc]))
+            "beep_key", "Enable the Beeper",
+            RadioSettingValueList(
+                opts, opts[_settings.beep_key + _settings.beep_sc]))
 
         def apply_beep(s, obj):
             setattr(obj, "beep_key",
@@ -486,27 +487,32 @@
         # BELL
         opts = ["OFF", "1T", "3T", "5T", "8T", "CONT"]
         ctcss.append(RadioSetting("bell", "Bell Repetitions",
-                     RadioSettingValueList(opts, opts[_settings.bell])))
+                                  RadioSettingValueList(opts, opts[
+                                                        _settings.bell])))
 
         # BSY.LED
         opts = ["ON", "OFF"]
         misc.append(RadioSetting("bsy_led", "Busy LED",
-                    RadioSettingValueList(opts, opts[_settings.bsy_led])))
+                                 RadioSettingValueList(opts, opts[
+                                                       _settings.bsy_led])))
 
         # DCS.NR
         opts = ["TR/X N", "RX R", "TX R", "T/RX R"]
         ctcss.append(RadioSetting("dcs_nr", "\"Inverted\" DCS Code Decoding",
-                     RadioSettingValueList(opts, opts[_settings.dcs_nr])))
+                                  RadioSettingValueList(opts, opts[
+                                                        _settings.dcs_nr])))
 
         # DT.DLY
         opts = ["50 MS", "100 MS", "250 MS", "450 MS", "750 MS", "1000 MS"]
         ctcss.append(RadioSetting("dt_dly", "DTMF Autodialer Delay Time",
-                     RadioSettingValueList(opts, opts[_settings.dt_dly])))
+                                  RadioSettingValueList(opts, opts[
+                                                        _settings.dt_dly])))
 
         # DT.SPD
         opts = ["50 MS", "100 MS"]
         ctcss.append(RadioSetting("dt_spd", "DTMF Autodialer Sending Speed",
-                     RadioSettingValueList(opts, opts[_settings.dt_spd])))
+                                  RadioSettingValueList(opts, opts[
+                                                        _settings.dt_spd])))
 
         # DT.WRT
         for i in range(0, 9):
@@ -519,8 +525,9 @@
                     str += DTMF_CHARS[c]
             val = RadioSettingValueString(0, 16, str, False)
             val.set_charset(DTMF_CHARS + list("abcd"))
-            rs = RadioSetting("dtmf_%i" % i, 
-                        "DTMF Autodialer Memory %i" % (i + 1), val)
+            rs = RadioSetting("dtmf_%i" % i,
+                              "DTMF Autodialer Memory %i" % (i + 1), val)
+
             def apply_dtmf(s, obj):
                 str = s.value.get_value().upper().rstrip()
                 val = [DTMF_CHARS.index(x) for x in str]
@@ -533,13 +540,14 @@
         # EDG.BEP
         opts = ["OFF", "ON"]
         misc.append(RadioSetting("edg_bep", "Band Edge Beeper",
-                    RadioSettingValueList(opts, opts[_settings.edg_bep])))
+                                 RadioSettingValueList(opts, opts[
+                                                       _settings.edg_bep])))
 
         # I.NET
         opts = ["OFF", "COD", "MEM"]
         rs = RadioSetting("inet", "Internet Link Connection",
-                          RadioSettingValueList(
-                              opts, opts[_settings.inet - 1]))
+                          RadioSettingValueList(opts, opts[
+                                                _settings.inet - 1]))
 
         def apply_inet(s, obj):
             setattr(obj, s.get_name(), int(s.value) + 1)
@@ -551,25 +559,27 @@
                 "CODE 5", "CODE 6", "CODE 7", "CODE 8", "CODE 9",
                 "CODE A", "CODE B", "CODE C", "CODE D", "CODE E", "CODE F"]
         wires.append(RadioSetting("int_cd", "Access Number for WiRES(TM)",
-                     RadioSettingValueList(opts, opts[_settings.int_cd])))
+                                  RadioSettingValueList(opts, opts[
+                                                        _settings.int_cd])))
 
         # INT.MR
         opts = ["d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9"]
         wires.append(RadioSetting(
-                    "int_mr", "Access Number (DTMF) for Non-WiRES(TM)",
+            "int_mr", "Access Number (DTMF) for Non-WiRES(TM)",
                      RadioSettingValueList(opts, opts[_settings.int_mr])))
 
         # LAMP
         opts = ["KEY", "5SEC", "TOGGLE"]
         switch.append(RadioSetting("lamp", "Lamp Mode",
-                      RadioSettingValueList(opts, opts[_settings.lamp])))
+                                   RadioSettingValueList(opts, opts[
+                                                         _settings.lamp])))
 
         # LOCK
         opts = ["LK KEY", "LKDIAL", "LK K+D", "LK PTT",
                 "LP P+K", "LK P+D", "LK ALL"]
         rs = RadioSetting("lock", "Control Locking",
-                          RadioSettingValueList(
-                              opts, opts[_settings.lock - 1]))
+                          RadioSettingValueList(opts, opts[
+                                                _settings.lock - 1]))
 
         def apply_lock(s, obj):
             setattr(obj, s.get_name(), int(s.value) + 1)
@@ -579,44 +589,51 @@
         # M/T-CL
         opts = ["MONI", "T-CALL"]
         switch.append(RadioSetting("mt_cl", "MONI Switch Function",
-                      RadioSettingValueList(opts, opts[_settings.mt_cl])))
+                                   RadioSettingValueList(opts, opts[
+                                                         _settings.mt_cl])))
 
         # PAG.ABK
         opts = ["OFF", "ON"]
         eai.append(RadioSetting("pag_abk", "Paging Answer Back",
-                   RadioSettingValueList(opts, opts[_settings.pag_abk])))
+                                RadioSettingValueList(opts, opts[
+                                                      _settings.pag_abk])))
 
         # RESUME
         opts = ["TIME", "HOLD", "BUSY"]
         scan.append(RadioSetting("resume", "Scan Resume Mode",
-                    RadioSettingValueList(opts, opts[_settings.resume])))
+                                 RadioSettingValueList(opts, opts[
+                                                       _settings.resume])))
 
         # REV/HM
         opts = ["REV", "HOME"]
         switch.append(RadioSetting("rev_hm", "HM/RV Key Function",
-                      RadioSettingValueList(opts, opts[_settings.rev_hm])))
+                                   RadioSettingValueList(opts, opts[
+                                                         _settings.rev_hm])))
 
         # RF.SQL
         opts = ["OFF", "S-1", "S-2", "S-3", "S-4", "S-5", "S-6",
                 "S-7", "S-8", "S-FULL"]
         misc.append(RadioSetting("rf_sql", "RF Squelch Threshold",
-                    RadioSettingValueList(opts, opts[_settings.rf_sql])))
+                                 RadioSettingValueList(opts, opts[
+                                                       _settings.rf_sql])))
 
         # PRI.RVT
         opts = ["OFF", "ON"]
         scan.append(RadioSetting("pri_rvt", "Priority Revert",
-                    RadioSettingValueList(opts, opts[_settings.pri_rvt])))
+                                 RadioSettingValueList(opts, opts[
+                                                       _settings.pri_rvt])))
 
         # RXSAVE
         opts = ["OFF", "200 MS", "300 MS", "500 MS", "1 S", "2 S"]
         power.append(RadioSetting(
-                    "rxsave", "Receive Mode Batery Savery Interval",
+            "rxsave", "Receive Mode Batery Savery Interval",
                      RadioSettingValueList(opts, opts[_settings.rxsave])))
 
         # S.SRCH
         opts = ["SINGLE", "CONT"]
         misc.append(RadioSetting("ssrch", "Smart Search Sweep Mode",
-                    RadioSettingValueList(opts, opts[_settings.ssrch])))
+                                 RadioSettingValueList(opts, opts[
+                                                       _settings.ssrch])))
 
         # SCN.MD
         opts = ["MEM", "ONLY"]
@@ -627,32 +644,38 @@
         # SCN.LMP
         opts = ["OFF", "ON"]
         scan.append(RadioSetting("scn_lmp", "Scan Lamp",
-                    RadioSettingValueList(opts, opts[_settings.scn_lmp])))
+                                 RadioSettingValueList(opts, opts[
+                                                       _settings.scn_lmp])))
 
         # TOT
-        opts = ["OFF"] + ["%dMIN" % (x) for x in range(1, 30+1)]
+        opts = ["OFF"] + ["%dMIN" % (x) for x in range(1, 30 + 1)]
         misc.append(RadioSetting("tot", "Timeout Timer",
-                    RadioSettingValueList(opts, opts[_settings.tot])))
+                                 RadioSettingValueList(opts, opts[
+                                                       _settings.tot])))
 
         # TX.LED
         opts = ["ON", "OFF"]
         misc.append(RadioSetting("tx_led", "TX LED",
-                    RadioSettingValueList(opts, opts[_settings.tx_led])))
+                                 RadioSettingValueList(opts, opts[
+                                                       _settings.tx_led])))
 
         # TXSAVE
         opts = ["OFF", "ON"]
         power.append(RadioSetting("txsave", "Transmitter Battery Saver",
-                     RadioSettingValueList(opts, opts[_settings.txsave])))
+                                  RadioSettingValueList(opts, opts[
+                                                        _settings.txsave])))
 
         # VFO.BND
         opts = ["BAND", "ALL"]
         misc.append(RadioSetting("vfo_bnd", "VFO Band Edge Limiting",
-                    RadioSettingValueList(opts, opts[_settings.vfo_bnd])))
+                                 RadioSettingValueList(opts, opts[
+                                                       _settings.vfo_bnd])))
 
         # WX.ALT
         opts = ["OFF", "ON"]
         scan.append(RadioSetting("wx_alt", "Weather Alert Scan",
-                    RadioSettingValueList(opts, opts[_settings.wx_alt])))
+                                 RadioSettingValueList(opts, opts[
+                                                       _settings.wx_alt])))
 
         # MBS
         for i in range(0, 10):
diff -r cc28502a220f -r c83daa0abc46 chirp/drivers/ft817.py
--- a/chirp/drivers/ft817.py	Sun Oct 16 16:55:56 2016 -0700
+++ b/chirp/drivers/ft817.py	Tue Oct 25 16:48:11 2016 -0400
@@ -357,10 +357,10 @@
             moredata = self.pipe.read(2)
             if moredata:
                 raise Exception(
-                        _("Radio sent data after the last awaited block, "
-                            "this happens when the selected model is a non-US "
-                            "but the radio is a US one. "
-                            "Please choose the correct model and try again."))
+                    _("Radio sent data after the last awaited block, "
+                      "this happens when the selected model is a non-US "
+                      "but the radio is a US one. "
+                      "Please choose the correct model and try again."))
 
         LOG.info("Clone completed in %i seconds" % (time.time() - start))
 
@@ -389,7 +389,7 @@
                 LOG.debug(util.hexprint(chr(blocks)))
                 LOG.debug(util.hexprint(self.get_mmap()[pos:pos + block]))
                 LOG.debug(util.hexprint(chr(checksum.get_calculated(
-                            self.get_mmap()))))
+                    self.get_mmap()))))
                 self.pipe.write(chr(blocks))
                 self.pipe.write(self.get_mmap()[pos:pos + block])
                 self.pipe.write(chr(checksum.get_calculated(self.get_mmap())))
@@ -584,7 +584,7 @@
             if key != "extd_number":
                 if cur_mem.__dict__[key] != mem.__dict__[key]:
                     raise errors.RadioError("Editing field `%s' " % key +
-                                        "is not supported on this channel")
+                                            "is not supported on this channel")
 
         self._set_memory(mem, _mem)
 
@@ -746,7 +746,7 @@
         if mem.freq >= lo and mem.freq <= hi:
             if mem.mode != "FM":
                 msgs.append(chirp_common.ValidationError(
-                        "Only FM is supported in this band"))
+                    "Only FM is supported in this band"))
         # TODO check that step is valid in current mode
         return msgs
 
@@ -782,7 +782,7 @@
                           RadioSettingValueList(options,
                                                 options[
                                                     _settings.disable_amfm_dial
-                                                    ]))
+                                                ]))
         panel.append(rs)
         rs = RadioSetting("am_mic", "AM mic level",
                           RadioSettingValueInteger(0, 100, _settings.am_mic))
@@ -1007,7 +1007,8 @@
         antenna.append(rs)
 
         st = RadioSettingValueString(0, 7, ''.join([self._CALLSIGN_CHARSET[x]
-                                     for x in self._memobj.callsign]))
+                                                    for x in
+                                                    self._memobj.callsign]))
         st.set_charset(self._CALLSIGN_CHARSET)
         rs = RadioSetting("callsign", "Callsign", st)
         cw.append(rs)
@@ -1042,7 +1043,7 @@
                           RadioSettingValueList(options,
                                                 options[
                                                     _settings.pwr_meter_mode
-                                                        ]))
+                                                ]))
         panelcontr.append(rs)
         rs = RadioSetting("vox", "Vox",
                           RadioSettingValueBoolean(_settings.vox))
@@ -1084,7 +1085,8 @@
                     setting = element.get_name()
                 try:
                     LOG.debug("Setting %s(%s) <= %s" % (setting,
-                              getattr(obj, setting), element.value))
+                                                        getattr(obj, setting),
+                                                        element.value))
                 except AttributeError:
                     LOG.debug("Setting %s <= %s" % (setting, element.value))
                 if setting == "contrast":
@@ -1130,7 +1132,7 @@
         "M-603": -40,
         "M-604": -39,
         "M-605": -38,
-        }
+    }
     LAST_SPECIAL60M_INDEX = -42
 
     SPECIAL_MEMORIES = dict(FT817Radio.SPECIAL_MEMORIES)
diff -r cc28502a220f -r c83daa0abc46 chirp/drivers/h777.py
--- a/chirp/drivers/h777.py	Sun Oct 16 16:55:56 2016 -0700
+++ b/chirp/drivers/h777.py	Tue Oct 25 16:48:11 2016 -0400
@@ -91,7 +91,7 @@
 
 SETTING_LISTS = {
     "voice": VOICE_LIST,
-    }
+}
 
 
 def _h777_enter_programming_mode(radio):
@@ -250,7 +250,7 @@
         (0x0000, 0x0110),
         (0x02B0, 0x02C0),
         (0x0380, 0x03E0),
-        ]
+    ]
     _memsize = 0x03E0
 
     def get_features(self):
@@ -402,9 +402,9 @@
         # When set to one, official programming software (BF-480) shows always
         # "WFM", even if we choose "NFM". Therefore, for compatibility
         # purposes, we will set these to zero.
-        _mem.unknown1 = 0;
-        _mem.unknown2 = 0;
-        _mem.unknown3 = 0;
+        _mem.unknown1 = 0
+        _mem.unknown2 = 0
+        _mem.unknown3 = 0
 
     def get_settings(self):
         _settings = self._memobj.settings
@@ -527,6 +527,7 @@
 
 
 class H777TestCase(unittest.TestCase):
+
     def setUp(self):
         self.driver = H777Radio(None)
         self.testdata = bitwise.parse("lbcd foo[2];",
diff -r cc28502a220f -r c83daa0abc46 chirp/drivers/kguv8d.py
--- a/chirp/drivers/kguv8d.py	Sun Oct 16 16:55:56 2016 -0700
+++ b/chirp/drivers/kguv8d.py	Tue Oct 25 16:48:11 2016 -0400
@@ -20,9 +20,9 @@
 import logging
 from chirp import util, chirp_common, bitwise, memmap, errors, directory
 from chirp.settings import RadioSetting, RadioSettingGroup, \
-                RadioSettingValueBoolean, RadioSettingValueList, \
-                RadioSettingValueInteger, RadioSettingValueString, \
-                RadioSettings
+    RadioSettingValueBoolean, RadioSettingValueList, \
+    RadioSettingValueInteger, RadioSettingValueString, \
+    RadioSettings
 
 LOG = logging.getLogger(__name__)
 
@@ -47,7 +47,7 @@
 PF3KEY_LIST = ["Scan", "Lamp", "Tele Alarm", "SOS-CH", "Radio", "Disable"]
 WORKMODE_LIST = ["VFO", "Channel No.", "Ch. No.+Freq.", "Ch. No.+Name"]
 BACKLIGHT_LIST = ["Always On"] + [str(x) + "s" for x in range(1, 21)] + \
-                ["Always Off"]
+    ["Always Off"]
 OFFSET_LIST = ["+", "-"]
 PONMSG_LIST = ["Bitmap", "Battery Volts"]
 SPMUTE_LIST = ["QT", "QT+DTMF", "QT*DTMF"]
@@ -464,14 +464,14 @@
         rf.valid_skips = ["", "S"]
         rf.valid_tmodes = ["", "Tone", "TSQL", "DTCS", "Cross"]
         rf.valid_cross_modes = [
-                        "Tone->Tone",
-                        "Tone->DTCS",
-                        "DTCS->Tone",
-                        "DTCS->",
-                        "->Tone",
-                        "->DTCS",
-                        "DTCS->DTCS",
-                    ]
+            "Tone->Tone",
+            "Tone->DTCS",
+            "DTCS->Tone",
+            "DTCS->",
+            "->Tone",
+            "->DTCS",
+            "DTCS->DTCS",
+        ]
         rf.valid_modes = ["FM", "NFM"]
         rf.valid_power_levels = self.POWER_LEVELS
         rf.valid_name_length = 8
@@ -681,117 +681,127 @@
                           RadioSettingValueBoolean(_settings.channel_menu))
         cfg_grp.append(rs)
         rs = RadioSetting("ponmsg", "Poweron message",
-                        RadioSettingValueList(
-                            PONMSG_LIST, PONMSG_LIST[_settings.ponmsg]))
+                          RadioSettingValueList(
+                              PONMSG_LIST, PONMSG_LIST[_settings.ponmsg]))
         cfg_grp.append(rs)
         rs = RadioSetting("voice", "Voice Guide",
-                        RadioSettingValueBoolean(_settings.voice))
+                          RadioSettingValueBoolean(_settings.voice))
         cfg_grp.append(rs)
         rs = RadioSetting("language", "Language",
-                        RadioSettingValueList(LANGUAGE_LIST,
-                            LANGUAGE_LIST[_settings.language]))
+                          RadioSettingValueList(LANGUAGE_LIST,
+                                                LANGUAGE_LIST[
+                                                    _settings.language]))
         cfg_grp.append(rs)
         rs = RadioSetting("timeout", "Timeout Timer",
-                        RadioSettingValueInteger(15, 900,
-                            _settings.timeout * 15, 15))
+                          RadioSettingValueInteger(15, 900,
+                                                   _settings.timeout * 15, 15))
         cfg_grp.append(rs)
         rs = RadioSetting("toalarm", "Timeout Alarm",
-                        RadioSettingValueInteger(0, 10, _settings.toalarm))
+                          RadioSettingValueInteger(0, 10, _settings.toalarm))
         cfg_grp.append(rs)
         rs = RadioSetting("roger_beep", "Roger Beep",
-                        RadioSettingValueBoolean(_settings.roger_beep))
+                          RadioSettingValueBoolean(_settings.roger_beep))
         cfg_grp.append(rs)
         rs = RadioSetting("power_save", "Power save",
-                        RadioSettingValueBoolean(_settings.power_save))
+                          RadioSettingValueBoolean(_settings.power_save))
         cfg_grp.append(rs)
         rs = RadioSetting("autolock", "Autolock",
-                        RadioSettingValueBoolean(_settings.autolock))
+                          RadioSettingValueBoolean(_settings.autolock))
         cfg_grp.append(rs)
         rs = RadioSetting("keylock", "Keypad Lock",
-                        RadioSettingValueBoolean(_settings.keylock))
+                          RadioSettingValueBoolean(_settings.keylock))
         cfg_grp.append(rs)
         rs = RadioSetting("beep", "Keypad Beep",
-                        RadioSettingValueBoolean(_settings.beep))
+                          RadioSettingValueBoolean(_settings.beep))
         cfg_grp.append(rs)
         rs = RadioSetting("stopwatch", "Stopwatch",
-                        RadioSettingValueBoolean(_settings.stopwatch))
+                          RadioSettingValueBoolean(_settings.stopwatch))
         cfg_grp.append(rs)
         rs = RadioSetting("backlight", "Backlight",
-                        RadioSettingValueList(BACKLIGHT_LIST,
-                            BACKLIGHT_LIST[_settings.backlight]))
+                          RadioSettingValueList(BACKLIGHT_LIST,
+                                                BACKLIGHT_LIST[
+                                                    _settings.backlight]))
         cfg_grp.append(rs)
         rs = RadioSetting("dtmf_st", "DTMF Sidetone",
-                        RadioSettingValueList(DTMFST_LIST,
-                            DTMFST_LIST[_settings.dtmf_st]))
+                          RadioSettingValueList(DTMFST_LIST,
+                                                DTMFST_LIST[
+                                                    _settings.dtmf_st]))
         cfg_grp.append(rs)
         rs = RadioSetting("ani-id_sw", "ANI-ID Switch",
-                        RadioSettingValueBoolean(_settings.ani_sw))
+                          RadioSettingValueBoolean(_settings.ani_sw))
         cfg_grp.append(rs)
         rs = RadioSetting("ptt-id_delay", "PTT-ID Delay",
-                        RadioSettingValueList(PTTID_LIST,
-                            PTTID_LIST[_settings.ptt_id]))
+                          RadioSettingValueList(PTTID_LIST,
+                                                PTTID_LIST[_settings.ptt_id]))
         cfg_grp.append(rs)
         rs = RadioSetting("ring_time", "Ring Time",
-                        RadioSettingValueList(LIST_10,
-                            LIST_10[_settings.ring_time]))
+                          RadioSettingValueList(LIST_10,
+                                                LIST_10[_settings.ring_time]))
         cfg_grp.append(rs)
         rs = RadioSetting("scan_rev", "Scan Mode",
-                        RadioSettingValueList(SCANMODE_LIST,
-                            SCANMODE_LIST[_settings.scan_rev]))
+                          RadioSettingValueList(SCANMODE_LIST,
+                                                SCANMODE_LIST[
+                                                    _settings.scan_rev]))
         cfg_grp.append(rs)
         rs = RadioSetting("vox", "VOX",
-                        RadioSettingValueList(LIST_10,
-                            LIST_10[_settings.vox]))
+                          RadioSettingValueList(LIST_10,
+                                                LIST_10[_settings.vox]))
         cfg_grp.append(rs)
         rs = RadioSetting("prich_sw", "Priority Channel Switch",
-                        RadioSettingValueBoolean(_settings.prich_sw))
+                          RadioSettingValueBoolean(_settings.prich_sw))
         cfg_grp.append(rs)
         rs = RadioSetting("pri_ch", "Priority Channel",
-                        RadioSettingValueInteger(1, 999, _settings.pri_ch))
+                          RadioSettingValueInteger(1, 999, _settings.pri_ch))
         cfg_grp.append(rs)
         rs = RadioSetting("rpt_mode", "Radio Mode",
-                        RadioSettingValueList(RPTMODE_LIST,
-                            RPTMODE_LIST[_settings.rpt_mode]))
+                          RadioSettingValueList(RPTMODE_LIST,
+                                                RPTMODE_LIST[
+                                                    _settings.rpt_mode]))
         cfg_grp.append(rs)
         rs = RadioSetting("rpt_set", "Repeater Setting",
-                        RadioSettingValueList(RPTSET_LIST,
-                            RPTSET_LIST[_settings.rpt_set]))
+                          RadioSettingValueList(RPTSET_LIST,
+                                                RPTSET_LIST[
+                                                    _settings.rpt_set]))
         cfg_grp.append(rs)
         rs = RadioSetting("rpt_spk", "Repeater Mode Speaker",
-                        RadioSettingValueBoolean(_settings.rpt_spk))
+                          RadioSettingValueBoolean(_settings.rpt_spk))
         cfg_grp.append(rs)
         rs = RadioSetting("rpt_ptt", "Repeater PTT",
-                        RadioSettingValueBoolean(_settings.rpt_ptt))
+                          RadioSettingValueBoolean(_settings.rpt_ptt))
         cfg_grp.append(rs)
         rs = RadioSetting("dtmf_tx_time", "DTMF Tx Duration",
-                        RadioSettingValueList(DTMF_TIMES,
-                            DTMF_TIMES[_settings.dtmf_tx_time]))
+                          RadioSettingValueList(DTMF_TIMES,
+                                                DTMF_TIMES[
+                                                    _settings.dtmf_tx_time]))
         cfg_grp.append(rs)
         rs = RadioSetting("dtmf_interval", "DTMF Interval",
-                        RadioSettingValueList(DTMF_TIMES,
-                            DTMF_TIMES[_settings.dtmf_interval]))
+                          RadioSettingValueList(DTMF_TIMES,
+                                                DTMF_TIMES[
+                                                    _settings.dtmf_interval]))
         cfg_grp.append(rs)
         rs = RadioSetting("alert", "Alert Tone",
-                        RadioSettingValueList(ALERTS_LIST,
-                            ALERTS_LIST[_settings.alert]))
+                          RadioSettingValueList(ALERTS_LIST,
+                                                ALERTS_LIST[_settings.alert]))
         cfg_grp.append(rs)
         rs = RadioSetting("rpt_tone", "Repeater Tone",
-                        RadioSettingValueBoolean(_settings.rpt_tone))
+                          RadioSettingValueBoolean(_settings.rpt_tone))
         cfg_grp.append(rs)
         rs = RadioSetting("rpt_hold", "Repeater Hold Time",
-                        RadioSettingValueList(HOLD_TIMES,
-                            HOLD_TIMES[_settings.rpt_hold]))
+                          RadioSettingValueList(HOLD_TIMES,
+                                                HOLD_TIMES[
+                                                    _settings.rpt_hold]))
         cfg_grp.append(rs)
         rs = RadioSetting("scan_det", "Scan DET",
-                        RadioSettingValueBoolean(_settings.scan_det))
+                          RadioSettingValueBoolean(_settings.scan_det))
         cfg_grp.append(rs)
         rs = RadioSetting("sc_qt", "SC-QT",
-                        RadioSettingValueList(SCQT_LIST,
-                            SCQT_LIST[_settings.smuteset]))
+                          RadioSettingValueList(SCQT_LIST,
+                                                SCQT_LIST[_settings.smuteset]))
         cfg_grp.append(rs)
         rs = RadioSetting("smuteset", "SubFreq Mute",
-                        RadioSettingValueList(SMUTESET_LIST,
-                            SMUTESET_LIST[_settings.smuteset]))
+                          RadioSettingValueList(SMUTESET_LIST,
+                                                SMUTESET_LIST[
+                                                    _settings.smuteset]))
         cfg_grp.append(rs)
         _pwd = "".join(map(chr, _settings.mode_sw_pwd))
         val = RadioSettingValueString(0, 6, _pwd)
@@ -807,45 +817,46 @@
         # VFO A Settings
         #
         rs = RadioSetting("vfoa_mode", "VFO A Workmode",
-                        RadioSettingValueList(WORKMODE_LIST,
-                              WORKMODE_LIST[_settings.workmode_a]))
+                          RadioSettingValueList(WORKMODE_LIST,
+                                                WORKMODE_LIST[
+                                                    _settings.workmode_a]))
         vfoa_grp.append(rs)
         rs = RadioSetting("vfoa_chan", "VFO A Channel",
-                        RadioSettingValueInteger(1, 999, _settings.work_cha))
+                          RadioSettingValueInteger(1, 999, _settings.work_cha))
         vfoa_grp.append(rs)
         rs = RadioSetting("rxfreqa", "VFO A Rx Frequency",
-                        RadioSettingValueInteger(
+                          RadioSettingValueInteger(
                               134000000, 520000000, _vfoa.rxfreq * 10, 5000))
         vfoa_grp.append(rs)
         rs = RadioSetting("txoffa", "VFO A Tx Offset",
-                        RadioSettingValueInteger(
+                          RadioSettingValueInteger(
                               0, 520000000, _vfoa.txoffset * 10, 5000))
         vfoa_grp.append(rs)
         #   u16   rxtone;
         #   u16   txtone;
         rs = RadioSetting("vfoa_power", "VFO A Power",
-                        RadioSettingValueList(
+                          RadioSettingValueList(
                               POWER_LIST, POWER_LIST[_vfoa.power]))
         vfoa_grp.append(rs)
         #         shift_dir:2
         rs = RadioSetting("vfoa_iswide", "VFO A NBFM",
-                        RadioSettingValueList(
+                          RadioSettingValueList(
                               BANDWIDTH_LIST, BANDWIDTH_LIST[_vfoa.iswide]))
         vfoa_grp.append(rs)
         rs = RadioSetting("vfoa_mute_mode", "VFO A Mute",
-                        RadioSettingValueList(
+                          RadioSettingValueList(
                               SPMUTE_LIST, SPMUTE_LIST[_vfoa.mute_mode]))
         vfoa_grp.append(rs)
         rs = RadioSetting("vfoa_step", "VFO A Step (kHz)",
-                        RadioSettingValueList(
+                          RadioSettingValueList(
                               STEP_LIST, STEP_LIST[_vfoa.step]))
         vfoa_grp.append(rs)
         rs = RadioSetting("vfoa_squelch", "VFO A Squelch",
-                        RadioSettingValueList(
+                          RadioSettingValueList(
                               LIST_10, LIST_10[_vfoa.squelch]))
         vfoa_grp.append(rs)
         rs = RadioSetting("bcl_a", "Busy Channel Lock-out A",
-                        RadioSettingValueBoolean(_settings.bcl_a))
+                          RadioSettingValueBoolean(_settings.bcl_a))
         vfoa_grp.append(rs)
         #
         # VFO B Settings
@@ -890,7 +901,7 @@
                               LIST_10, LIST_10[_vfob.squelch]))
         vfob_grp.append(rs)
         rs = RadioSetting("bcl_b", "Busy Channel Lock-out B",
-                        RadioSettingValueBoolean(_settings.bcl_b))
+                          RadioSettingValueBoolean(_settings.bcl_b))
         vfob_grp.append(rs)
         #
         # Key Settings
diff -r cc28502a220f -r c83daa0abc46 chirp/drivers/leixen.py
--- a/chirp/drivers/leixen.py	Sun Oct 16 16:55:56 2016 -0700
+++ b/chirp/drivers/leixen.py	Tue Oct 25 16:48:11 2016 -0400
@@ -276,7 +276,7 @@
         #           util.hexprint(hdr + data).replace("\n", "\n          "))
         if len(data) != length:
             raise errors.RadioError("Radio sent %i bytes (expected %i)" % (
-                    len(data), length))
+                len(data), length))
         chk = radio.pipe.read(1)
     else:
         data = ""
@@ -424,7 +424,8 @@
         self.process_mmap()
 
     def process_mmap(self):
-        self._memobj = bitwise.parse(MEM_FORMAT % self._mem_formatter, self._mmap)
+        self._memobj = bitwise.parse(
+            MEM_FORMAT % self._mem_formatter, self._mmap)
 
     def sync_out(self):
         try:
@@ -437,7 +438,7 @@
 
     def get_raw_memory(self, number):
         return repr(self._memobj.name[number - 1]) + \
-               repr(self._memobj.memory[number - 1])
+            repr(self._memobj.memory[number - 1])
 
     def _get_tone(self, mem, _mem):
         rx_tone = tx_tone = None
@@ -459,7 +460,7 @@
         rx_pol = _mem.rx_tmode == 0x03 and "R" or "N"
 
         chirp_common.split_tone_decode(mem, (tx_tmode, tx_tone, tx_pol),
-                                            (rx_tmode, rx_tone, rx_pol))
+                                       (rx_tmode, rx_tone, rx_pol))
 
     def _is_txinh(self, _mem):
         raw_tx = ""
@@ -952,7 +953,8 @@
 
 
 class VV898E(chirp_common.Alias):
-    '''Leixen has called this radio both 898E and S historically, ident is identical'''
+    '''Leixen has called this radio both 898E and S historically, ident is
+    identical'''
     VENDOR = "Leixen"
     MODEL = "VV-898E"
 
diff -r cc28502a220f -r c83daa0abc46 chirp/drivers/thd72.py
--- a/chirp/drivers/thd72.py	Sun Oct 16 16:55:56 2016 -0700
+++ b/chirp/drivers/thd72.py	Tue Oct 25 16:48:11 2016 -0400
@@ -185,6 +185,8 @@
 
 # Uploads result in "MCP Error" and garbage data in memory
 # Clone driver disabled in favor of error-checking live driver.
+
+
 @directory.register
 class THD72Radio(chirp_common.CloneModeRadio):
     BAUD_RATE = 9600
@@ -200,10 +202,12 @@
     _LCD_CONTRAST = ["Level %d" % x for x in range(1, 16)]
     _LAMP_CONTROL = ["Manual", "Auto"]
     _LAMP_TIMER = ["Seconds %d" % x for x in range(2, 11)]
-    _BATTERY_SAVER = [ "OFF", "0.03 Seconds", "0.2 Seconds", "0.4 Seconds", "0.6 Seconds", "0.8 Seconds", "1 Seconds", "2 Seconds", "3 Seconds", "4 Seconds", "5 Seconds" ]
-    _APO = [ "OFF", "15 Minutes", "30 Minutes", "60 Minutes" ]
-    _AUDIO_BALANCE = [ "Center", "A +50%", "A +100%", "B +50%", "B +100%" ]
-    _KEY_BEEP = [ "OFF", "Radio & GPS", "Radio Only", "GPS Only" ]
+    _BATTERY_SAVER = ["OFF", "0.03 Seconds", "0.2 Seconds", "0.4 Seconds",
+                      "0.6 Seconds", "0.8 Seconds", "1 Seconds", "2 Seconds",
+                      "3 Seconds", "4 Seconds", "5 Seconds"]
+    _APO = ["OFF", "15 Minutes", "30 Minutes", "60 Minutes"]
+    _AUDIO_BALANCE = ["Center", "A +50%", "A +100%", "B +50%", "B +100%"]
+    _KEY_BEEP = ["OFF", "Radio & GPS", "Radio Only", "GPS Only"]
 
     def get_features(self):
         rf = chirp_common.RadioFeatures()
@@ -267,7 +271,7 @@
         return name[:name.index('\xff')].rstrip()
 
     def set_channel_name(self, number, name):
-        name = name[:8] + '\xff'*8
+        name = name[:8] + '\xff' * 8
         if number < 999:
             self._memobj.channel_name[number].name = name[:8]
             self.add_dirty_block(self._memobj.channel_name[number])
@@ -290,7 +294,7 @@
 
         if number < 0 or number > (max(THD72_SPECIAL.values()) + 1):
             raise errors.InvalidMemoryLocation(
-                    "Number must be between 0 and 999")
+                "Number must be between 0 and 999")
 
         _mem = self._memobj.memory[number]
         flag = self._memobj.flag[number]
@@ -406,7 +410,7 @@
     def write_block(self, block, map):
         self.pipe.write(struct.pack("<cBHB", "W", 0, block, 0))
         base = block * 256
-        self.pipe.write(map[base:base+256])
+        self.pipe.write(map[base:base + 256])
 
         ack = self.pipe.read(1)
 
@@ -416,12 +420,12 @@
         if blocks is None:
             blocks = range(self._memsize / 256)
         else:
-            blocks = [b for b in blocks if b < self._memsize/256]
+            blocks = [b for b in blocks if b < self._memsize / 256]
 
         if self.command("0M PROGRAM") != "0M":
             raise errors.RadioError("No response from self")
 
-        allblocks = range(self._memsize/256)
+        allblocks = range(self._memsize / 256)
         self.pipe.baudrate = 57600
         try:
             self.pipe.setRTS()
@@ -434,7 +438,7 @@
         count = 0
         for i in allblocks:
             if i not in blocks:
-                data += 256*'\xff'
+                data += 256 * '\xff'
                 continue
             data += self.read_block(i)
             count += 1
@@ -455,7 +459,7 @@
         if blocks is None:
             blocks = range((self._memsize / 256) - 2)
         else:
-            blocks = [b for b in blocks if b < self._memsize/256]
+            blocks = [b for b in blocks if b < self._memsize / 256]
 
         if self.command("0M PROGRAM") != "0M":
             raise errors.RadioError("No response from self")
@@ -546,7 +550,7 @@
                 try:
                     old_val = getattr(obj, setting)
                     LOG.debug("Setting %s(%r) <= %s" % (
-                            element.get_name(), old_val, element.value))
+                        element.get_name(), old_val, element.value))
                     setattr(obj, setting, element.value)
                 except AttributeError as e:
                     LOG.error("Setting %s is not in the memory map: %s" %
@@ -592,7 +596,7 @@
         rs = RadioSetting("display.power_on_msg", "Power on message", val)
         rs.set_apply_callback(self.apply_power_on_msg, display_settings)
         menu.append(rs)
-        
+
         val = RadioSettingValueList(
             self._LCD_CONTRAST,
             self._LCD_CONTRAST[display_settings.contrast - 1])
@@ -600,7 +604,7 @@
                           val)
         rs.set_apply_callback(self.apply_lcd_contrast, display_settings)
         menu.append(rs)
-        
+
         val = RadioSettingValueList(
             self._LAMP_CONTROL,
             self._LAMP_CONTROL[display_settings.lamp_control])
diff -r cc28502a220f -r c83daa0abc46 chirp/settings.py
--- a/chirp/settings.py	Sun Oct 16 16:55:56 2016 -0700
+++ b/chirp/settings.py	Tue Oct 25 16:48:11 2016 -0400
@@ -28,6 +28,7 @@
 
 class RadioSettingValue:
     """Base class for a single radio setting"""
+
     def __init__(self):
         self._current = None
         self._has_changed = False
@@ -69,6 +70,7 @@
 
 class RadioSettingValueInteger(RadioSettingValue):
     """An integer setting"""
+
     def __init__(self, minval, maxval, current, step=1):
         RadioSettingValue.__init__(self)
         self._min = minval
@@ -101,6 +103,7 @@
 
 class RadioSettingValueFloat(RadioSettingValue):
     """A floating-point setting"""
+
     def __init__(self, minval, maxval, current, resolution=0.001, precision=4):
         RadioSettingValue.__init__(self)
         self._min = minval
@@ -123,8 +126,8 @@
             raise InvalidValueError("A floating point value is required")
         if value > self._max or value < self._min:
             raise InvalidValueError("Value %s not in range %s-%s" % (
-                    self.format(value),
-                    self.format(self._min), self.format(self._max)))
+                self.format(value),
+                self.format(self._min), self.format(self._max)))
 
         # FIXME: honor resolution
 
@@ -140,6 +143,7 @@
 
 class RadioSettingValueBoolean(RadioSettingValue):
     """A boolean setting"""
+
     def __init__(self, current):
         RadioSettingValue.__init__(self)
         self.set_value(current)
@@ -157,6 +161,7 @@
 
 class RadioSettingValueList(RadioSettingValue):
     """A list-of-strings setting"""
+
     def __init__(self, options, current):
         RadioSettingValue.__init__(self)
         self._options = options
@@ -177,6 +182,7 @@
 
 class RadioSettingValueString(RadioSettingValue):
     """A string setting"""
+
     def __init__(self, minlength, maxlength, current,
                  autopad=True, charset=chirp_common.CHARSET_ASCII):
         RadioSettingValue.__init__(self)
@@ -214,6 +220,7 @@
     conversions not needed.
 
     """
+
     def __init__(self, map_entries, mem_val=None, user_option=None):
         """Create new map
 
@@ -242,10 +249,12 @@
             index = self._mem_vals.index(mem_val)
             self.set_value(self._options[index])
         else:
-            raise InvalidValueError("%s is not valid for this setting" % mem_val)
+            raise InvalidValueError(
+                "%s is not valid for this setting" % mem_val)
 
     def get_mem_val(self):
-        """Get the mem val corresponding to the currently selected user option"""
+        """Get the mem val corresponding to the currently selected user
+        option"""
         return self._mem_vals[self._options.index(self.get_value())]
 
     def __trunc__(self):
@@ -268,6 +277,7 @@
 
 
 class RadioSettings(list):
+
     def __init__(self, *groups):
         list.__init__(self, groups)
 
@@ -278,6 +288,7 @@
 
 class RadioSettingGroup(object):
     """A group of settings"""
+
     def _validate(self, element):
         # RadioSettingGroup can only contain RadioSettingGroup objects
         if not isinstance(element, RadioSettingGroup):
@@ -368,6 +379,7 @@
 
 class RadioSetting(RadioSettingGroup):
     """A single setting, which could be an array of items like a group"""
+
     def __init__(self, *args):
         super(RadioSetting, self).__init__(*args)
         self._apply_callback = None
diff -r cc28502a220f -r c83daa0abc46 chirp/ui/mainapp.py
--- a/chirp/ui/mainapp.py	Sun Oct 16 16:55:56 2016 -0700
+++ b/chirp/ui/mainapp.py	Tue Oct 25 16:48:11 2016 -0400
@@ -81,6 +81,7 @@
 
 
 class ChirpMain(gtk.Window):
+
     def get_current_editorset(self):
         page = self.tabs.get_current_page()
         if page is not None:
@@ -137,7 +138,7 @@
     def ev_editor_selected(self, editorset, editortype):
         mappings = {
             "memedit": ["view", "edit"],
-            }
+        }
 
         for _editortype, actions in mappings.items():
             for _action in actions:
@@ -443,7 +444,7 @@
         ).replace('/', '_')
 
         types = [(label + " (*.%s)" % eset.radio.FILE_EXTENSION,
-                 eset.radio.FILE_EXTENSION)]
+                  eset.radio.FILE_EXTENSION)]
 
         if isinstance(eset.radio, vx7.VX7Radio):
             types += [(_("VX7 Commander") + " (*.vx7)", "vx7")]
@@ -517,7 +518,7 @@
 
             file_basename = os.path.basename(fname).replace("_", "__")
             action = gtk.Action(
-                action_name, "_%i. %s" % (i+1, file_basename),
+                action_name, "_%i. %s" % (i + 1, file_basename),
                 _("Open recent file {name}").format(name=fname), "")
             action.connect("activate", lambda a, f: self.do_open(f), fname)
             mid = self.menu_uim.new_merge_id()
@@ -644,7 +645,7 @@
             _("Don't show instructions for any radio again"))
         again.show()
         again.connect("toggled", lambda action:
-            self.clonemenu.set_active(not action.get_active()))
+                      self.clonemenu.set_active(not action.get_active()))
         d.vbox.pack_start(again, 0, 0, 0)
         h_button_box = d.vbox.get_children()[2]
         try:
@@ -657,7 +658,6 @@
         d.run()
         d.destroy()
 
-
     def do_download(self, port=None, rtype=None):
         d = clone.CloneSettingsDialog(parent=self)
         settings = d.run()
@@ -989,7 +989,7 @@
             "Latitude": (gtk.Entry(), lambda x: float(x.get_text())),
             "Longitude": (gtk.Entry(), lambda x: float(x.get_text())),
             "Range": (gtk.Entry(), lambda x: int(x.get_text())),
-            }
+        }
         for name in sorted(fields.keys()):
             value, fn = fields[name]
             d.add_field(name, value)
@@ -1371,11 +1371,13 @@
             devaction.set_visible(action.get_active())
 
     def do_toggle_clone_instructions(self, action):
-        CONF.set_bool("clone_instructions", not action.get_active(), "noconfirm")
+        CONF.set_bool("clone_instructions",
+                      not action.get_active(), "noconfirm")
 
     def do_change_language(self):
         langs = ["Auto", "English", "Polish", "Italian", "Dutch", "German",
-                 "Hungarian", "Russian", "Portuguese (BR)", "French", "Spanish"]
+                 "Hungarian", "Russian", "Portuguese (BR)", "French",
+                 "Spanish"]
         d = inputdialog.ChoiceDialog(langs, parent=self,
                                      title="Choose Language")
         d.label.set_text(_("Choose a language or Auto to use the "
@@ -1629,7 +1631,7 @@
             ('help', None, _('Help'), None, None, self.mh),
             ('about', gtk.STOCK_ABOUT, None, None, None, self.mh),
             ('gethelp', None, _("Get Help Online..."), None, None, self.mh),
-            ]
+        ]
 
         conf = config.get()
         re = not conf.get_bool("no_report")
@@ -1660,7 +1662,8 @@
 
         self.add_accel_group(self.menu_uim.get_accel_group())
 
-        self.clonemenu = self.menu_uim.get_widget("/MenuBar/help/clone_instructions")
+        self.clonemenu = self.menu_uim.get_widget(
+            "/MenuBar/help/clone_instructions")
 
         # Initialize
         self.do_toggle_developer(self.menu_ag.get_action("developer"))
@@ -1719,7 +1722,7 @@
 
         actions = [
             # ("action_name", "key", function)
-            ]
+        ]
 
         for name, key, fn in actions:
             a = gtk.Action(name, name, name, "")
