[dvsim] PEP8 fixes in dvsim
These should cause no functional change. Detailed list of code changes:
- Get rid of 'import *': this defeats static analysis tools. Don't
do it.
- Add newline after colon in "if foo: bar"
- Use 'is' to check for equality with boolean literals
- Don't catch exceptions when running os.system in Deploy.py: the
os.system function returns the program's exit code.
- Delete some variables that are written but not read.
- Minor whitespace changes (missing blank lines between functions;
weird indentation; missing space after '#')
- Delete autogenerated module docstrings (they didn't contain any
information. Maybe it would be good to have a docstring, but at
the moment it's just noise).
- Don't use \ as a line continuation character. Use parentheses if
necessary.
- Replace code like "foo" + \ "bar" with just "foo" "bar" (Python
concatenates adjacent string literals just like C). (I didn't do
this everywhere, but it happened a lot next to the backslash
continuations, so I got rid of the unnecessary '+' then).
- Replace "not foo in bar" with "foo not in bar"
- Use raw strings for regexes with backslashes (r'a\+', not 'a\+')
With these changes, you can run:
find util/dvsim -name '*.py' | xargs flake8
and see no errors.
Signed-off-by: Rupert Swarbrick <rswarbrick@lowrisc.org>
diff --git a/util/dvsim/LintCfg.py b/util/dvsim/LintCfg.py
index cac0867..3184aab 100644
--- a/util/dvsim/LintCfg.py
+++ b/util/dvsim/LintCfg.py
@@ -5,16 +5,14 @@
Class describing lint configuration object
"""
+import hjson
import logging as log
-import sys
from pathlib import Path
from tabulate import tabulate
-from Deploy import *
-from Modes import *
from OneShotCfg import OneShotCfg
-from utils import *
+from utils import subst_wildcards
# helper function for printing messages
@@ -24,7 +22,6 @@
md_results += "### %s\n" % msg_list_name
md_results += "```\n"
for msg in msg_list:
- msg_parts = msg.split()
md_results += msg + "\n\n"
md_results += "```\n"
return md_results
@@ -209,7 +206,7 @@
self.result["lint_errors"])
fail_msgs += _print_msg_list("Lint Warnings",
self.result["lint_warnings"])
- #fail_msgs += _print_msg_list("Lint Infos", results["lint_infos"])
+ # fail_msgs += _print_msg_list("Lint Infos", results["lint_infos"])
if len(table) > 1:
self.results_md = results_str + tabulate(