[chirp_devel] [PATCH] Driver Maintenance: vgc.py

Jim Unroe
Fri Jan 1 11:31:51 PST 2021


# HG changeset patch
# User Jim Unroe <rock.unroe at gmail.com>
# Date 1609529379 18000
#      Fri Jan 01 14:29:39 2021 -0500
# Node ID 9fabd46fef4f534ae8e75b4ceb8d29aecf091c52
# Parent  829aa26aa81f9409e7b398872f3c48b24370a486
Driver Maintenance: vgc.py

1. Add to PEP8 manifest
2. Perform PEP8 cleanup

fixes #8633

diff -r 829aa26aa81f -r 9fabd46fef4f chirp/drivers/vgc.py
--- a/chirp/drivers/vgc.py	Fri Jan 01 13:55:35 2021 -0500
+++ b/chirp/drivers/vgc.py	Fri Jan 01 14:29:39 2021 -0500
@@ -20,8 +20,6 @@
 import logging
 import re
 
-LOG = logging.getLogger(__name__)
-
 from chirp import chirp_common, directory, memmap
 from chirp import bitwise, errors, util
 from chirp.settings import RadioSettingGroup, RadioSetting, \
@@ -30,6 +28,8 @@
     RadioSettingValueFloat, RadioSettings
 from textwrap import dedent
 
+LOG = logging.getLogger(__name__)
+
 MEM_FORMAT = """
 struct mem {
   lbcd rxfreq[4];
@@ -261,8 +261,8 @@
 LIST_SCANR = ["Busy", "Hold", "1 sec", "3 sec", "5 sec"]
 LIST_APO = ["Off", ".5", "1", "1.5"] + ["%s" % x for x in range(2, 13)]
 LIST_BEEP = ["Off", "Low", "High"]
-LIST_FKEY = ["MHz/AD-F", "AF Dual 1(line-in)", "AF Dual 2(AM)", "AF Dual 3(FM)",
-             "PA", "SQL off", "T-call", "WX"]
+LIST_FKEY = ["MHz/AD-F", "AF Dual 1(line-in)", "AF Dual 2(AM)",
+             "AF Dual 3(FM)", "PA", "SQL off", "T-call", "WX"]
 LIST_PFKEY = ["Off", "SQL off", "TX power", "Scan", "RPT shift", "Reverse",
               "T-Call"]
 LIST_AB = ["A", "B"]
@@ -345,7 +345,7 @@
                 chirp_common.PowerLevel("High", watts=50)]
 
 # B-TECH UV-50X3 id string
-UV50X3_id  = "VGC6600MD"
+UV50X3_id = "VGC6600MD"
 
 
 def _clean_buffer(radio):
@@ -451,7 +451,7 @@
     if ident != radio.IDENT:
         # bad ident
         msg = "Incorrect model ID, got this:"
-        msg +=  util.hexprint(ident)
+        msg += util.hexprint(ident)
         LOG.debug(msg)
         raise errors.RadioError("Radio identification failed.")
 
@@ -551,7 +551,6 @@
     """Match the opened/downloaded image to the correct version"""
     rid = data[0x6140:0x6148]
 
-    #if rid in cls._fileid:
     if rid in cls.IDENT:
         return True
 
@@ -787,7 +786,7 @@
         mem.extra = RadioSettingGroup("extra", "Extra")
 
         bcl = RadioSetting("bcl", "Busy channel lockout",
-                              RadioSettingValueBoolean(bool(_mem.bcl)))
+                           RadioSettingValueBoolean(bool(_mem.bcl)))
         mem.extra.append(bcl)
 
         revert = RadioSetting("revert", "Revert",
@@ -924,7 +923,7 @@
         basic.append(aftone)
 
         spkr = RadioSetting("settings.spkr", "Speaker",
-                            RadioSettingValueList(LIST_SPKR,LIST_SPKR[
+                            RadioSettingValueList(LIST_SPKR, LIST_SPKR[
                                 _mem.settings.spkr]))
         basic.append(spkr)
 
@@ -946,7 +945,7 @@
         basic.append(mgain)
 
         ptt = RadioSetting("settings.ptt", "PTT mode",
-                           RadioSettingValueList(LIST_PTT,LIST_PTT[
+                           RadioSettingValueList(LIST_PTT, LIST_PTT[
                                _mem.settings.ptt]))
         basic.append(ptt)
 
@@ -954,7 +953,7 @@
         # B04 (per channel)
 
         rxexp = RadioSetting("settings.rxexp", "RX expansion",
-                             RadioSettingValueList(LIST_RXEXP,LIST_RXEXP[
+                             RadioSettingValueList(LIST_RXEXP, LIST_RXEXP[
                                  _mem.settings.rxexp]))
         basic.append(rxexp)
 
@@ -973,8 +972,9 @@
         # Display: C01-C06
 
         display = RadioSetting("settings.display", "Display select",
-                               RadioSettingValueList(LIST_DISPLAY,
-                                   LIST_DISPLAY[_mem.settings.display]))
+                               RadioSettingValueList(
+                                   LIST_DISPLAY, LIST_DISPLAY[
+                                       _mem.settings.display]))
         basic.append(display)
 
         lcdb = RadioSetting("settings.lcdb", "LCD brightness",
@@ -1022,12 +1022,12 @@
         basic.append(dwstop)
 
         scand = RadioSetting("settings.scand", "Scan direction",
-                             RadioSettingValueList(LIST_SCAND,LIST_SCAND[
+                             RadioSettingValueList(LIST_SCAND, LIST_SCAND[
                                  _mem.settings.scand]))
         basic.append(scand)
 
         scanr = RadioSetting("settings.scanr", "Scan resume",
-                             RadioSettingValueList(LIST_SCANR,LIST_SCANR[
+                             RadioSettingValueList(LIST_SCANR, LIST_SCANR[
                                  _mem.settings.scanr]))
         basic.append(scanr)
 
@@ -1047,12 +1047,12 @@
         basic.append(ars)
 
         beep = RadioSetting("settings.beep", "Beep volume",
-                            RadioSettingValueList(LIST_BEEP,LIST_BEEP[
+                            RadioSettingValueList(LIST_BEEP, LIST_BEEP[
                                 _mem.settings.beep]))
         basic.append(beep)
 
         fkey = RadioSetting("settings.fkey", "F key",
-                            RadioSettingValueList(LIST_FKEY,LIST_FKEY[
+                            RadioSettingValueList(LIST_FKEY, LIST_FKEY[
                                 _mem.settings.fkey]))
         basic.append(fkey)
 
@@ -1077,36 +1077,40 @@
         basic.append(pfkey4)
 
         omode = RadioSetting("settings.omode", "Operation mode",
-                             RadioSettingValueList(LIST_AB,LIST_AB[
+                             RadioSettingValueList(LIST_AB, LIST_AB[
                                  _mem.settings.omode]))
         basic.append(omode)
 
         rxcoverm = RadioSetting("settings.rxcoverm", "RX coverage - memory",
-                                RadioSettingValueList(LIST_COVERAGE, 
-                                    LIST_COVERAGE[_mem.settings.rxcoverm]))
+                                RadioSettingValueList(
+                                    LIST_COVERAGE, LIST_COVERAGE[
+                                        _mem.settings.rxcoverm]))
         basic.append(rxcoverm)
 
         rxcoverv = RadioSetting("settings.rxcoverv", "RX coverage - VFO",
-                                RadioSettingValueList(LIST_COVERAGE, 
-                                    LIST_COVERAGE[_mem.settings.rxcoverv]))
+                                RadioSettingValueList(
+                                    LIST_COVERAGE, LIST_COVERAGE[
+                                        _mem.settings.rxcoverv]))
         basic.append(rxcoverv)
 
         tot = RadioSetting("settings.tot", "Time out timer [min]",
                            RadioSettingValueList(LIST_TOT, LIST_TOT[
-                               _mem.settings.tot]))
+                                                 _mem.settings.tot]))
         basic.append(tot)
 
         # Timer/Clock: G01-G04
 
         # G01
         datefmt = RadioSetting("settings.datefmt", "Date format",
-                               RadioSettingValueList(LIST_DATEFMT,
-                                   LIST_DATEFMT[_mem.settings.datefmt]))
+                               RadioSettingValueList(
+                                   LIST_DATEFMT, LIST_DATEFMT[
+                                       _mem.settings.datefmt]))
         basic.append(datefmt)
 
         timefmt = RadioSetting("settings.timefmt", "Time format",
-                               RadioSettingValueList(LIST_TIMEFMT,
-                                   LIST_TIMEFMT[_mem.settings.timefmt]))
+                               RadioSettingValueList(
+                                   LIST_TIMEFMT, LIST_TIMEFMT[
+                                       _mem.settings.timefmt]))
         basic.append(timefmt)
 
         timesig = RadioSetting("settings.timesig", "Time signal",
@@ -1140,7 +1144,7 @@
         # H04 (per channel)
 
         decbandsel = RadioSetting("settings.decbandsel", "DTMF band select",
-                                  RadioSettingValueList(LIST_AB,LIST_AB[
+                                  RadioSettingValueList(LIST_AB, LIST_AB[
                                       _mem.settings.decbandsel]))
         basic.append(decbandsel)
 
@@ -1151,18 +1155,21 @@
         # Pkt: I01-I03
 
         databnd = RadioSetting("settings.databnd", "Packet data band",
-                               RadioSettingValueList(LIST_DATABND,LIST_DATABND[
-                                   _mem.settings.databnd]))
+                               RadioSettingValueList(
+                                   LIST_DATABND, LIST_DATABND[
+                                       _mem.settings.databnd]))
         basic.append(databnd)
 
         dataspd = RadioSetting("settings.dataspd", "Packet data speed",
-                               RadioSettingValueList(LIST_DATASPD,LIST_DATASPD[
-                                   _mem.settings.dataspd]))
+                               RadioSettingValueList(
+                                   LIST_DATASPD, LIST_DATASPD[
+                                       _mem.settings.dataspd]))
         basic.append(dataspd)
 
         datasql = RadioSetting("settings.datasql", "Packet data squelch",
-                               RadioSettingValueList(LIST_DATASQL,LIST_DATASQL[
-                                   _mem.settings.datasql]))
+                               RadioSettingValueList(
+                                   LIST_DATASQL, LIST_DATASQL[
+                                       _mem.settings.datasql]))
         basic.append(datasql)
 
         # Other
@@ -1172,7 +1179,7 @@
         other.append(dw)
 
         cpuclk = RadioSetting("settings.cpuclk", "CPU clock frequency",
-                              RadioSettingValueList(LIST_CPUCLK,LIST_CPUCLK[
+                              RadioSettingValueList(LIST_CPUCLK, LIST_CPUCLK[
                                   _mem.settings.cpuclk]))
         other.append(cpuclk)
 
@@ -1198,12 +1205,12 @@
         # Work
 
         workmoda = RadioSetting("settings.workmoda", "Work mode A",
-                                RadioSettingValueList(LIST_WORK,LIST_WORK[
+                                RadioSettingValueList(LIST_WORK, LIST_WORK[
                                     _mem.settings.workmoda]))
         work.append(workmoda)
 
         workmodb = RadioSetting("settings.workmodb", "Work mode B",
-                                RadioSettingValueList(LIST_WORK,LIST_WORK[
+                                RadioSettingValueList(LIST_WORK, LIST_WORK[
                                     _mem.settings.workmodb]))
         work.append(workmodb)
 
@@ -1228,23 +1235,23 @@
         work.append(sqlb)
 
         stepa = RadioSetting("settings.stepa", "Auto step A",
-                             RadioSettingValueList(LIST_STEP,LIST_STEP[
+                             RadioSettingValueList(LIST_STEP, LIST_STEP[
                                  _mem.settings.stepa]))
         work.append(stepa)
 
         stepb = RadioSetting("settings.stepb", "Auto step B",
-                             RadioSettingValueList(LIST_STEP,LIST_STEP[
+                             RadioSettingValueList(LIST_STEP, LIST_STEP[
                                  _mem.settings.stepb]))
         work.append(stepb)
 
         mrcha = RadioSetting("settings.mrcha", "Current channel A",
                              RadioSettingValueInteger(0, 499,
-                                 _mem.settings.mrcha))
+                                                      _mem.settings.mrcha))
         work.append(mrcha)
 
         mrchb = RadioSetting("settings.mrchb", "Current channel B",
                              RadioSettingValueInteger(0, 499,
-                                 _mem.settings.mrchb))
+                                                      _mem.settings.mrchb))
         work.append(mrchb)
 
         val = _mem.settings.offseta / 100.00
@@ -1259,16 +1266,16 @@
 
         wpricha = RadioSetting("settings.wpricha", "Priority channel A",
                                RadioSettingValueInteger(0, 499,
-                                   _mem.settings.wpricha))
+                                                        _mem.settings.wpricha))
         work.append(wpricha)
 
         wprichb = RadioSetting("settings.wprichb", "Priority channel B",
                                RadioSettingValueInteger(0, 499,
-                                   _mem.settings.wprichb))
+                                                        _mem.settings.wprichb))
         work.append(wprichb)
 
         smode = RadioSetting("settings.smode", "Smart function mode",
-                             RadioSettingValueList(LIST_SMODE,LIST_SMODE[
+                             RadioSettingValueList(LIST_SMODE, LIST_SMODE[
                                  _mem.settings.smode]))
         work.append(smode)
 
@@ -1280,13 +1287,13 @@
         dtmf.append(ttdkey)
 
         ttdgt = RadioSetting("dtmf.ttdgt", "Digit time",
-                              RadioSettingValueList(LIST_TT200, LIST_TT200[
-                                  (_mem.dtmf.ttdgt) - 5]))
+                             RadioSettingValueList(LIST_TT200, LIST_TT200[
+                                 (_mem.dtmf.ttdgt) - 5]))
         dtmf.append(ttdgt)
 
         ttint = RadioSetting("dtmf.ttint", "Interval time",
-                              RadioSettingValueList(LIST_TT200, LIST_TT200[
-                                  (_mem.dtmf.ttint) - 5]))
+                             RadioSettingValueList(LIST_TT200, LIST_TT200[
+                                 (_mem.dtmf.ttint) - 5]))
         dtmf.append(ttint)
 
         tt1stdgt = RadioSetting("dtmf.tt1stdgt", "1st digit time",
@@ -1310,8 +1317,9 @@
         dtmf.append(ttsig)
 
         ttautorst = RadioSetting("dtmf2.ttautorst", "Auto reset time",
-                                 RadioSettingValueList(LIST_TTAUTORST,
-                                     LIST_TTAUTORST[_mem.dtmf2.ttautorst]))
+                                 RadioSettingValueList(
+                                     LIST_TTAUTORST, LIST_TTAUTORST[
+                                         _mem.dtmf2.ttautorst]))
         dtmf.append(ttautorst)
 
         if _mem.dtmf2.ttgrpcode > 0x06:
@@ -1320,12 +1328,13 @@
             val = _mem.dtmf2.ttgrpcode
         ttgrpcode = RadioSetting("dtmf2.ttgrpcode", "Group code",
                                  RadioSettingValueList(LIST_TTGRPCODE,
-                                     LIST_TTGRPCODE[val]))
+                                                       LIST_TTGRPCODE[val]))
         dtmf.append(ttgrpcode)
 
         ttintcode = RadioSetting("dtmf2.ttintcode", "Interval code",
-                                 RadioSettingValueList(LIST_TTINTCODE,
-                                     LIST_TTINTCODE[_mem.dtmf2.ttintcode]))
+                                 RadioSettingValueList(
+                                     LIST_TTINTCODE, LIST_TTINTCODE[
+                                         _mem.dtmf2.ttintcode]))
         dtmf.append(ttintcode)
 
         if _mem.dtmf2.ttalert > 0x04:
@@ -1334,12 +1343,13 @@
             val = _mem.dtmf2.ttalert
         ttalert = RadioSetting("dtmf2.ttalert", "Alert tone/transpond",
                                RadioSettingValueList(LIST_TTALERT,
-                                   LIST_TTALERT[val]))
+                                                     LIST_TTALERT[val]))
         dtmf.append(ttalert)
 
         ttautod = RadioSetting("dtmf.ttautod", "Auto dial group",
-                               RadioSettingValueList(LIST_TTAUTOD,
-                                   LIST_TTAUTOD[_mem.dtmf.ttautod]))
+                               RadioSettingValueList(
+                                   LIST_TTAUTOD, LIST_TTAUTOD[
+                                       _mem.dtmf.ttautod]))
         dtmf.append(ttautod)
 
         # setup 9 dtmf autodial entries
@@ -1414,7 +1424,6 @@
                     LOG.debug(element.get_name())
                     raise
 
-
     @classmethod
     def match_model(cls, filedata, filename):
         match_size = False
diff -r 829aa26aa81f -r 9fabd46fef4f tools/cpep8.manifest
--- a/tools/cpep8.manifest	Fri Jan 01 13:55:35 2021 -0500
+++ b/tools/cpep8.manifest	Fri Jan 01 14:29:39 2021 -0500
@@ -103,6 +103,7 @@
 ./chirp/drivers/uv5X3.py
 ./chirp/drivers/uv6r.py
 ./chirp/drivers/uvb5.py
+./chirp/drivers/vgc.py
 ./chirp/drivers/vx170.py
 ./chirp/drivers/vx2.py
 ./chirp/drivers/vx3.py



More information about the chirp_devel mailing list