[chirp_devel] [PATCH 27/35] Fix style issues in ic9x_icf_ll.py (#2355)
Zachary T Welch
Tue Mar 3 17:48:39 PST 2015
# HG changeset patch
# User Zachary T Welch <zach at mandolincreekfarm.com>
# Fake Node ID 717073835c3fb70eb69b98317b6499db7e6b97be
Fix style issues in ic9x_icf_ll.py (#2355)
diff --git a/chirp/drivers/ic9x_icf_ll.py b/chirp/drivers/ic9x_icf_ll.py
index 30376d7..e1619d5 100644
--- a/chirp/drivers/ic9x_icf_ll.py
+++ b/chirp/drivers/ic9x_icf_ll.py
@@ -20,15 +20,16 @@ from chirp.memmap import MemoryMap
MEM_LOC_SIZE_A = 20
MEM_LOC_SIZE_B = MEM_LOC_SIZE_A + 1 + (3 * 8)
-POS_FREQ = 0
-POS_OFFSET = 3
-POS_TONE = 5
-POS_MODE = 6
-POS_DTCS = 7
-POS_TS = 8
-POS_DTCSPOL = 11
-POS_DUPLEX = 11
-POS_NAME = 12
+POS_FREQ = 0
+POS_OFFSET = 3
+POS_TONE = 5
+POS_MODE = 6
+POS_DTCS = 7
+POS_TS = 8
+POS_DTCSPOL = 11
+POS_DUPLEX = 11
+POS_NAME = 12
+
def get_mem_offset(number):
"""Get the offset into the memory map for memory @number"""
@@ -37,6 +38,7 @@ def get_mem_offset(number):
else:
return (MEM_LOC_SIZE_A * 850) + (MEM_LOC_SIZE_B * (number - 850))
+
def get_raw_memory(mmap, number):
"""Return a raw representation of memory @number"""
offset = get_mem_offset(number)
@@ -46,6 +48,7 @@ def get_raw_memory(mmap, number):
size = MEM_LOC_SIZE_A
return MemoryMap(mmap[offset:offset+size])
+
def get_freq(mmap):
"""Return the memory frequency"""
if ord(mmap[10]) & 0x10:
@@ -55,26 +58,31 @@ def get_freq(mmap):
val, = struct.unpack(">I", "\x00" + mmap[POS_FREQ:POS_FREQ+3])
return val * mult
+
def get_offset(mmap):
"""Return the memory offset"""
val, = struct.unpack(">H", mmap[POS_OFFSET:POS_OFFSET+2])
return val * 5000
+
def get_rtone(mmap):
"""Return the memory rtone"""
val = (ord(mmap[POS_TONE]) & 0xFC) >> 2
return chirp_common.TONES[val]
+
def get_ctone(mmap):
"""Return the memory ctone"""
val = (ord(mmap[POS_TONE]) & 0x03) | ((ord(mmap[POS_TONE+1]) & 0xF0) >> 4)
return chirp_common.TONES[val]
+
def get_dtcs(mmap):
"""Return the memory dtcs value"""
val = ord(mmap[POS_DTCS]) >> 1
return chirp_common.DTCS_CODES[val]
+
def get_mode(mmap):
"""Return the memory mode"""
val = ord(mmap[POS_MODE]) & 0x07
@@ -83,11 +91,12 @@ def get_mode(mmap):
return modemap[val]
+
def get_ts(mmap):
"""Return the memory tuning step"""
val = (ord(mmap[POS_TS]) & 0xF0) >> 4
if val == 14:
- return 5.0 # Coerce "Auto" to 5.0
+ return 5.0 # Coerce "Auto" to 5.0
icf_ts = list(chirp_common.TUNING_STEPS)
icf_ts.insert(2, 8.33)
@@ -98,6 +107,7 @@ def get_ts(mmap):
return icf_ts[val]
+
def get_dtcs_polarity(mmap):
"""Return the memory dtcs polarity"""
val = (ord(mmap[POS_DTCSPOL]) & 0x03)
@@ -106,6 +116,7 @@ def get_dtcs_polarity(mmap):
return pols[val]
+
def get_duplex(mmap):
"""Return the memory duplex"""
val = (ord(mmap[POS_DUPLEX]) & 0x0C) >> 2
@@ -114,10 +125,12 @@ def get_duplex(mmap):
return dup[val]
+
def get_name(mmap):
"""Return the memory name"""
return mmap[POS_NAME:POS_NAME+8]
+
def get_memory(_mmap, number):
"""Get memory @number from global memory map @_mmap"""
mmap = get_raw_memory(_mmap, number)
diff --git a/tools/cpep8.blacklist b/tools/cpep8.blacklist
index 1573e99..6cca27c 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_icf_ll.py
./chirp/drivers/ic9x_ll.py
./chirp/drivers/icf.py
./chirp/drivers/icq7.py
More information about the chirp_devel
mailing list