From 972a11537cb50cb56ff0cbe6e58603f65be5cbb3 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Sun, 11 Dec 2022 21:58:02 -0500 Subject: [PATCH] Internals: Fix lint-py warnings --- bin/verilator_ccache_report | 2 +- bin/verilator_difftree | 8 ++++---- bin/verilator_gantt | 6 +++--- bin/verilator_profcfunc | 27 +++++++++++++-------------- docs/bin/vl_sphinx_extract | 6 +++--- docs/bin/vl_sphinx_fix | 6 +++--- docs/guide/conf.py | 2 +- examples/xml_py/vl_file_copy | 28 +++++++++++++--------------- examples/xml_py/vl_hier_graph | 30 ++++++++++++++---------------- nodist/code_coverage | 30 ++++++++++++++++-------------- nodist/dot_importer | 6 +++--- nodist/fuzzer/generate_dictionary | 4 ++-- nodist/install_test | 2 +- src/astgen | 14 +++++++------- src/bisonpre | 12 ++++++------ src/cppcheck_filtered | 6 +++--- src/vlcovgen | 8 ++++---- test_regress/t/t_pipe_filter.pf | 2 +- 18 files changed, 98 insertions(+), 101 deletions(-) diff --git a/bin/verilator_ccache_report b/bin/verilator_ccache_report index f895db4ae..bbb69b9af 100755 --- a/bin/verilator_ccache_report +++ b/bin/verilator_ccache_report @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# pylint: disable=C0103,C0114,C0115,C0116,C0123,C0301,R0902,R0913,R0914,R0912,R0915,W0621 +# pylint: disable=C0103,C0114,C0115,C0116,C0123,C0209,C0301,R0902,R0913,R0914,R0912,R0915,W0621 ###################################################################### import argparse diff --git a/bin/verilator_difftree b/bin/verilator_difftree index d7c65a28e..2bede0e8d 100755 --- a/bin/verilator_difftree +++ b/bin/verilator_difftree @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# pylint: disable=C0103,C0114,C0116 +# pylint: disable=C0103,C0114,C0116,C0209 ###################################################################### import argparse @@ -73,7 +73,7 @@ def diff_file(a, b): def version_from(filename): # Return dump format - with open(filename) as fh: + with open(filename, "r", encoding="utf8") as fh: lineno = 0 for line in fh: if lineno > 10: @@ -86,8 +86,8 @@ def version_from(filename): def filterf(fn1, fn2): # Remove hex numbers before diffing - with open(fn1) as fh1: - with open(fn2, "w") as fh2: + with open(fn1, "r", encoding="utf8") as fh1: + with open(fn2, "w", encoding="utf8") as fh2: for line in fh1: if re.search(r' This=', line): continue diff --git a/bin/verilator_gantt b/bin/verilator_gantt index 03a7a16af..cfab96456 100755 --- a/bin/verilator_gantt +++ b/bin/verilator_gantt @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# pylint: disable=C0103,C0114,C0116,C0301,R0914,R0912,R0915,W0511,eval-used +# pylint: disable=C0103,C0114,C0116,C0209,C0301,R0914,R0912,R0915,W0511,eval-used ###################################################################### import argparse @@ -29,7 +29,7 @@ def process(filename): def read_data(filename): - with open(filename) as fh: + with open(filename, "r", encoding="utf8") as fh: re_thread = re.compile(r'^VLPROFTHREAD (\d+)$') re_record = re.compile(r'^VLPROFEXEC (\S+) (\d+)(.*)$') re_payload_mtaskBegin = re.compile( @@ -318,7 +318,7 @@ def report_cpus(): def write_vcd(filename): print("Writing %s" % filename) - with open(filename, "w") as fh: + with open(filename, "w", encoding="utf8") as fh: vcd = { 'values': collections.defaultdict(lambda: {}), # {