use assert not if/print/exit
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 23 Mar 2018 05:11:58 +0000 (05:11 +0000)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 23 Mar 2018 05:11:58 +0000 (05:11 +0000)
src/actual_pinmux.py

index bdfcc2e46b1797b4e1f926c7a2bc96a58bb874e7..e5aa4994b8da15d9e34bd93e2edfa801db158fa6 100644 (file)
@@ -70,13 +70,10 @@ def init(p):
             temp = cell[i + 1].translate(digits)
             temp = temp.replace(' ', '')
             x = dictionary.get(temp)
-            if x is None:
-                print(
-                    "ERROR: The signal : " +
-                    str(cell[i + 1]) +
-                    " of pinmap.txt isn't present in the current dictionary.\
-                  \nUpdate dictionary or fix-typo.")
-                exit(1)
+            assert x is not None, "ERROR: The signal : " + \
+                    str(cell[i + 1]) + \
+                    " of pinmap.txt isn't present \nin the current" + \
+                  " dictionary. Update dictionary or fix-typo."
             if x == "input":
                 p.pinmux += \
                     mux_wire.format(cell[0], i, "wr" + cell[i + 1]) + "\n"