[chirp_devel] [PATCH 25/35] Fix style issues in ic9x.py (#2355)
Zachary T Welch
Tue Mar 3 17:48:37 PST 2015
# HG changeset patch
# User Zachary T Welch <zach at mandolincreekfarm.com>
# Fake Node ID 0518541d76df55cb292432deae4a0e9516b612e0
Fix style issues in ic9x.py (#2355)
diff --git a/chirp/drivers/ic9x.py b/chirp/drivers/ic9x.py
index 5726b09..405b114 100644
--- a/chirp/drivers/ic9x.py
+++ b/chirp/drivers/ic9x.py
@@ -49,6 +49,7 @@ CHARSET = chirp_common.CHARSET_ALPHANUMERIC + \
LOCK = threading.Lock()
+
class IC9xBank(icf.IcomNamedBank):
"""Icom 9x Bank"""
def get_name(self):
@@ -60,6 +61,7 @@ class IC9xBank(icf.IcomNamedBank):
banks[self.index] = name
self._model._radio._ic9x_set_banks(banks)
+
@directory.register
class IC9xRadio(icf.IcomLiveRadio):
"""Base class for Icom IC-9x radios"""
@@ -120,7 +122,7 @@ class IC9xRadio(icf.IcomLiveRadio):
if number < -2 or number > 999:
raise errors.InvalidValueError("Number must be between 0 and 999")
- if self.__memcache.has_key(number):
+ if number in self.__memcache:
return self.__memcache[number]
self._lock.acquire()
@@ -242,12 +244,12 @@ class IC9xRadio(icf.IcomLiveRadio):
def _ic9x_set_banks(self, banks):
if len(banks) != len(self.__bankcache.keys()):
- raise errors.InvalidDataError("Invalid bank list length (%i:%i)" %\
- (len(banks),
- len(self.__bankcache.keys())))
+ raise errors.InvalidDataError("Invalid bank list length (%i:%i)" %
+ (len(banks),
+ len(self.__bankcache.keys())))
- cached_names = [str(self.__bankcache[x]) \
- for x in sorted(self.__bankcache.keys())]
+ cached_names = [str(self.__bankcache[x])
+ for x in sorted(self.__bankcache.keys())]
need_update = False
for i in range(0, 26):
@@ -279,6 +281,7 @@ class IC9xRadio(icf.IcomLiveRadio):
return rf
+
class IC9xRadioA(IC9xRadio):
"""IC9x Band A subdevice"""
VARIANT = "Band A"
@@ -301,6 +304,7 @@ class IC9xRadioA(IC9xRadio):
rf.valid_name_length = 8
return rf
+
class IC9xRadioB(IC9xRadio, chirp_common.IcomDstarSupport):
"""IC9x Band B subdevice"""
VARIANT = "Band B"
@@ -406,6 +410,7 @@ class IC9xRadioB(IC9xRadio, chirp_common.IcomDstarSupport):
self.RPTCALL_LIMIT[1],
calls)
+
def _test():
import serial
ser = IC9xRadioB(serial.Serial(port="/dev/ttyUSB1",
@@ -414,5 +419,6 @@ def _test():
print "-- FOO --"
ser.set_urcall_list(["K7TAY", "FOOBAR", "BAZ"])
+
if __name__ == "__main__":
_test()
diff --git a/tools/cpep8.blacklist b/tools/cpep8.blacklist
index b15e6c5..6d3cf8f 100644
--- a/tools/cpep8.blacklist
+++ b/tools/cpep8.blacklist
@@ -1,7 +1,6 @@
# 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.
-./chirp/drivers/ic9x.py
./chirp/drivers/ic9x_icf.py
./chirp/drivers/ic9x_icf_ll.py
./chirp/drivers/ic9x_ll.py
More information about the chirp_devel
mailing list