From 3636a88cf690bbf54d6fb9e4b7e39a7e194e07f0 Mon Sep 17 00:00:00 2001 From: Tim Hutt Date: Tue, 5 Nov 2024 14:32:12 +0000 Subject: [PATCH] Enable Pylint in CI and fix its errors (#311) * Remove wildcard imports Use explicit imports rather than wildcards. This is more maintainable. * Enable Pylint in CI and fix its errors The main fixes were: * Specify encoding for all file opens. By default it depends on environment variables which is bad. * Use `with` to open files. Otherwise they don't necessarily get closed. There were also a few minor things like using `enumerate`, not using objects as default arguments, etc. In some cases I slightly refactored the code. --- test.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/test.py b/test.py index eea105a6..a8f19c97 100644 --- a/test.py +++ b/test.py @@ -4,7 +4,25 @@ import unittest from unittest.mock import Mock, patch -from shared_utils import * +from shared_utils import ( + InstrDict, + check_arg_lut, + check_overlapping_bits, + extract_isa_type, + find_extension_file, + handle_arg_lut_mapping, + initialize_encoding, + is_rv_variant, + overlaps, + pad_to_equal_length, + parse_instruction_line, + process_enc_line, + process_fixed_ranges, + process_standard_instructions, + same_base_isa, + update_encoding_for_fixed_range, + validate_bit_range, +) class EncodingUtilsTest(unittest.TestCase):