slight style-alteration on pinmap.txt parsing
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 23 Mar 2018 05:34:10 +0000 (05:34 +0000)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 23 Mar 2018 05:34:10 +0000 (05:34 +0000)
src/parse.py

index d9358779b4cf06fcaed5af18c2d6e7f77b2f8322..a11e45dff5081091884082dbf30eee6b018c929d 100644 (file)
@@ -37,17 +37,20 @@ class Parse(object):
     muxed_cells = []
     dedicated_cells = []
     pinnumbers = []
+
     for lineno, line in enumerate(pinmapfile):
         line1 = line.split()
-        if(len(line1) > 1):
-            pinnumbers.append(int(line1[0]))
-            if(len(line1) == 2):  # dedicated
-                dedicated_cells.append(line1)
-            if(len(line1) > 2):
-                muxed_cells.append(line1)
-    pinnumbers = sorted(pinnumbers)
+        if len(line1) <= 1:
+            continue
+        pinnumbers.append(int(line1[0]))
+        if len(line1) == 2:  # dedicated
+            dedicated_cells.append(line1)
+        else:
+            muxed_cells.append(line1)
 
+    pinnumbers = sorted(pinnumbers)
     upper_offset = lower_offset + int(math.log(len(muxed_cells), 2))
+
     # ============================================= #
     # ======= Multiple checks to see if the user has not screwed ======#
     missing_pins = missing_numbers(pinnumbers)