utils: flake8 and yapf cleanup

pass PYTHONPATH for v2x to remove modifying syspath

Signed-off-by: Elms <elmsfu@freshred.net>
diff --git a/vlog_to_model.py b/vlog_to_model.py
index 445a6e7..f388f7e 100755
--- a/vlog_to_model.py
+++ b/vlog_to_model.py
@@ -16,15 +16,16 @@
     instance. A model will not be generated for the `lut`, `routing` or `flipflop`
     class.
 """
-import argparse, re, json
-import os, sys
+import argparse
+import os
+import re
+import sys
 
 import lxml.etree as ET
 
 import yosys.run
 from yosys.json import YosysJSON
 
-sys.path.insert(0, "..")
 from lib import xmlinc
 
 
@@ -126,14 +127,16 @@
         top = wm.group(1).upper()
     else:
         print(
-            "ERROR file name not of format %.sim.v ({}), cannot detect top level. Manually specify the top level module using --top"
+            """ERROR file name not of format %.sim.v ({}), cannot detect top level.
+            Manually specify the top level module using --top"""
         ).format(iname)
         sys.exit(1)
     yj = YosysJSON(aig_json, top)
 
 if top is None:
     print(
-        "ERROR: more than one module in design, cannot detect top level. Manually specify the top level module using --top"
+        """ERROR: more than one module in design, cannot detect top level.
+        Manually specify the top level module using --top"""
     )
     sys.exit(1)
 
diff --git a/vlog_to_pbtype.py b/vlog_to_pbtype.py
index ab29714..7fde071 100755
--- a/vlog_to_pbtype.py
+++ b/vlog_to_pbtype.py
@@ -28,7 +28,8 @@
 
     - `(* CLK_TO_Q="clk 10e-12" *)` : specify clock-to-output time for a given clock
 
-    - `(* DELAY_CONST_{input}="30e-12" *)` : specify a constant max delay from an input (applied to the output)
+    - `(* DELAY_CONST_{input}="30e-12" *)` : specify a constant max delay from an input,
+       applied to the output
 
     - `(* DELAY_MATRIX_{input}="30e-12 35e-12; 20e-12 25e-12; ..." *)` : specify a VPR
         delay matrix (semicolons indicate rows). In this format columns specify
@@ -44,15 +45,16 @@
 The Verilog define "PB_TYPE" is set during generation.
 """
 
-import os, sys
-import argparse, re
+import argparse
+import os
+import re
+import sys
 
 import lxml.etree as ET
 
 import yosys.run
 from yosys.json import YosysJSON
 
-sys.path.insert(0, "..")
 from lib import xmlinc
 
 parser = argparse.ArgumentParser(
@@ -110,8 +112,8 @@
         top = wm.group(1).upper()
     else:
         print(
-            "ERROR file name not of format %.sim.v ({}), cannot detect top level. Manually specify the top level module using --top"
-            .format(iname)
+            """ERROR file name not of format %.sim.v ({}), cannot detect top level.
+            Manually specify the top level module using --top""".format(iname)
         )
         sys.exit(1)
 
@@ -156,7 +158,7 @@
     elif is_mod_blackbox(mod) and not has_modes:
         return mod.name
     else:
-        #TODO: other types
+        # TODO: other types
         return mod.name
 
 
@@ -222,8 +224,8 @@
 
         dir_xml = ET.SubElement(ic_xml, 'direct')
 
-        s_port_xml = ET.SubElement(dir_xml, 'port', s_port)
-        d_port_xml = ET.SubElement(dir_xml, 'port', d_port)
+        ET.SubElement(dir_xml, 'port', s_port)
+        ET.SubElement(dir_xml, 'port', d_port)
 
     # Find out whether or not the module we are generating content for is a blackbox
     is_blackbox = is_mod_blackbox(mod) or not mod.cells
@@ -333,8 +335,8 @@
                 for sink_cell, sink_pin in sinks:
                     if sink_cell != mod.name:
                         continue
-                    # Only consider outputs from cell to top level IO. Inputs to other cells will be dealt with
-                    # in those cells.
+                    # Only consider outputs from cell to top level IO. Inputs to
+                    # other cells will be dealt with in those cells.
                     interconn.append(
                         (
                             (cname, pin), (sink_cell, sink_pin), instance,
@@ -546,8 +548,9 @@
             top = wm.group(1).upper()
         else:
             print(
-                "ERROR file name not of format %.sim.v ({}), cannot detect top level. Manually specify the top level module using --top"
-                .format(iname)
+                """ERROR file name not of format %.sim.v ({}), cannot detect top level.
+                Manually specify the top level module using --top""".
+                format(iname)
             )
             sys.exit(1)
 
diff --git a/yosys/json.py b/yosys/json.py
index bdbaa74..b13ddc2 100755
--- a/yosys/json.py
+++ b/yosys/json.py
@@ -6,7 +6,6 @@
 be used before outputting the JSON.
 """
 
-import os, sys
 import json
 import pprint
 
@@ -124,7 +123,6 @@
 
     def net_attr(self, netname, attr, defval=None):
         """Get an attribute of a given net (specified by name), or defval is not set"""
-        pnet = None
         if attr in self.net_attrs(netname):
             return self.net_attrs(netname)[attr]
         else:
diff --git a/yosys/run.py b/yosys/run.py
index 41ccdb3..e22c8ce 100755
--- a/yosys/run.py
+++ b/yosys/run.py
@@ -1,6 +1,9 @@
 #!/usr/bin/env python3
-import os, subprocess, re
-import tempfile, json
+import json
+import os
+import re
+import subprocess
+import tempfile
 import yosys.utils
 
 
@@ -73,7 +76,8 @@
 
 
 def get_defines():
-    """Return a list of set Verilog defines, as a list of arguments to pass to Yosys `read_verilog`"""
+    """Return a list of set Verilog defines, as a list of arguments to pass to Yosys
+`read_verilog`"""
     return " ".join(["-D" + _ for _ in defines])
 
 
@@ -83,7 +87,8 @@
 
 
 def get_includes():
-    """Return a list of include directories, as a list of arguments to pass to Yosys `read_verilog`"""
+    """Return a list of include directories, as a list of arguments to pass to Yosys
+`read_verilog`"""
     return " ".join(["-I" + _ for _ in includes])