diff --git a/tools/create_release_notes.py b/tools/create_release_notes.py index 7fb5b6523..127b6bf81 100644 --- a/tools/create_release_notes.py +++ b/tools/create_release_notes.py @@ -117,6 +117,9 @@ def __init__(self, file_name, is_latest): def _get_date(commit): + """ + Get date + """ date_str = ( check_output(["git", "log", "-1", "--format=%ci", commit]).decode().strip() ) diff --git a/vunit/configuration.py b/vunit/configuration.py index 7d273a729..c12a2b332 100644 --- a/vunit/configuration.py +++ b/vunit/configuration.py @@ -30,8 +30,8 @@ class Configuration(object): # pylint: disable=too-many-instance-attributes Represents a configuration of a test bench """ - def __init__( - self, # pylint: disable=too-many-arguments + def __init__( # pylint: disable=too-many-arguments + self, name, design_unit, generics=None, @@ -145,9 +145,9 @@ def call_pre_config(self, output_path, simulator_output_path): if self.pre_config is None: return True - args = inspect.getargspec( + args = inspect.getargspec( # pylint: disable=deprecated-method self.pre_config - ).args # pylint: disable=deprecated-method + ).args kwargs = { "output_path": output_path, @@ -167,9 +167,9 @@ def call_post_check(self, output_path, read_output): if self.post_check is None: return True - args = inspect.getargspec( + args = inspect.getargspec( # pylint: disable=deprecated-method self.post_check - ).args # pylint: disable=deprecated-method + ).args kwargs = {"output_path": lambda: output_path, "output": read_output} @@ -246,9 +246,9 @@ def set_post_check(self, value): for config in configs.values(): config.post_check = value - def add_config( + def add_config( # pylint: disable=too-many-arguments self, - name, # pylint: disable=too-many-arguments + name, generics=None, pre_config=None, post_check=None, diff --git a/vunit/ghdl_interface.py b/vunit/ghdl_interface.py index 872e20e01..cb08a9238 100644 --- a/vunit/ghdl_interface.py +++ b/vunit/ghdl_interface.py @@ -84,8 +84,8 @@ def find_prefix_from_path(cls): """ return cls.find_toolchain([cls.executable]) - def __init__( - self, # pylint: disable=too-many-arguments + def __init__( # pylint: disable=too-many-arguments + self, output_path, prefix, gui=False, @@ -260,8 +260,8 @@ def _get_command(self, config, output_path, ghdl_e): return cmd - def simulate( - self, # pylint: disable=too-many-locals + def simulate( # pylint: disable=too-many-locals + self, output_path, test_suite_name, config, diff --git a/vunit/incisive_interface.py b/vunit/incisive_interface.py index 48e832ce9..a17c280b7 100644 --- a/vunit/incisive_interface.py +++ b/vunit/incisive_interface.py @@ -26,9 +26,9 @@ LOGGER = logging.getLogger(__name__) -class IncisiveInterface( +class IncisiveInterface( # pylint: disable=too-many-instance-attributes SimulatorInterface -): # pylint: disable=too-many-instance-attributes +): """ Interface for the Cadence Incisive simulator """ @@ -91,8 +91,8 @@ def supports_vhdl_2008_contexts(): """ return False - def __init__( - self, # pylint: disable=too-many-arguments + def __init__( # pylint: disable=too-many-arguments + self, prefix, output_path, gui=False, @@ -314,8 +314,8 @@ def _get_mapped_libraries(self): cds = CDSFile.parse(self._cdslib) return cds - def simulate( - self, # pylint: disable=too-many-locals + def simulate( # pylint: disable=too-many-locals + self, output_path, test_suite_name, config, @@ -436,7 +436,7 @@ def _generic_args(entity_name, generics): def _generic_needs_quoting(value): # pylint: disable=missing-docstring if sys.version_info.major == 2: return isinstance( - value, (str, bool, unicode) - ) # pylint: disable=undefined-variable + value, (str, bool, unicode) # pylint: disable=undefined-variable + ) return isinstance(value, (str, bool)) diff --git a/vunit/parsing/verilog/parser.py b/vunit/parsing/verilog/parser.py index a4e09bfbc..15388ca90 100644 --- a/vunit/parsing/verilog/parser.py +++ b/vunit/parsing/verilog/parser.py @@ -154,8 +154,8 @@ class VerilogDesignFile(object): Contains Verilog objecs found within a file """ - def __init__( - self, # pylint: disable=too-many-arguments + def __init__( # pylint: disable=too-many-arguments + self, modules=None, packages=None, imports=None, diff --git a/vunit/parsing/verilog/preprocess.py b/vunit/parsing/verilog/preprocess.py index 92d21716e..eee4f2a65 100644 --- a/vunit/parsing/verilog/preprocess.py +++ b/vunit/parsing/verilog/preprocess.py @@ -71,8 +71,8 @@ def _preprocess( return result - def preprocessor( - self, # pylint: disable=too-many-arguments,too-many-branches + def preprocessor( # pylint: disable=too-many-arguments,too-many-branches + self, token, stream, defines, @@ -161,8 +161,8 @@ def _skip_protected_region(stream): if token.value == "end_protected": return - def expand_macro( - self, # pylint: disable=too-many-arguments + def expand_macro( # pylint: disable=too-many-arguments + self, macro_token, stream, defines, @@ -262,8 +262,8 @@ def determine_if_taken(if_token, arg): stream.skip_while(NEWLINE) return result - def include( - self, # pylint: disable=too-many-arguments + def include( # pylint: disable=too-many-arguments + self, token, stream, include_paths, diff --git a/vunit/project.py b/vunit/project.py index 630bbe4c0..73950ef9b 100644 --- a/vunit/project.py +++ b/vunit/project.py @@ -6,6 +6,8 @@ # # Copyright (c) 2014-2019, Lars Asplund lars.anders.asplund@gmail.com +# pylint: disable=too-many-lines + """ Functionality to represent and operate on a HDL code project """ @@ -105,8 +107,8 @@ def add_library( self._libraries[logical_name] = library self._lower_library_names_dict[logical_name.lower()] = library.name - def add_source_file( - self, # pylint: disable=too-many-arguments + def add_source_file( # pylint: disable=too-many-arguments + self, file_name, library_name, file_type="vhdl", @@ -195,8 +197,8 @@ def _find_vhdl_library_reference(self, library_name): real_library_name = self._lower_library_names_dict[library_name] return self._libraries[real_library_name] - def _find_other_vhdl_design_unit_dependencies( - self, # pylint: disable=too-many-branches + def _find_other_vhdl_design_unit_dependencies( # pylint: disable=too-many-branches + self, source_file, depend_on_package_body, implementation_dependencies, @@ -860,8 +862,8 @@ class VerilogSourceFile(SourceFile): Represents a Verilog source file """ - def __init__( - self, # pylint: disable=too-many-arguments + def __init__( # pylint: disable=too-many-arguments + self, file_type, name, library, @@ -940,8 +942,8 @@ class VHDLSourceFile(SourceFile): Represents a VHDL source file """ - def __init__( - self, # pylint: disable=too-many-arguments + def __init__( # pylint: disable=too-many-arguments + self, name, library, vhdl_parser, diff --git a/vunit/simulator_interface.py b/vunit/simulator_interface.py index 6f9959453..d059f1998 100644 --- a/vunit/simulator_interface.py +++ b/vunit/simulator_interface.py @@ -158,9 +158,9 @@ def supports_vhpi(): """ return False - def merge_coverage( + def merge_coverage( # pylint: disable=unused-argument, no-self-use self, file_name, args - ): # pylint: disable=unused-argument, no-self-use + ): """ Hook for simulator interface to creating coverage reports """ @@ -282,9 +282,9 @@ def compile_source_files( else: printer.write("Re-compile not needed\n") - def compile_source_file_command( + def compile_source_file_command( # pylint: disable=unused-argument self, source_file - ): # pylint: disable=unused-argument + ): raise NotImplementedError @staticmethod @@ -322,8 +322,8 @@ def check_output(command, env=None): Wrapper arround subprocess.check_output """ try: - output = subprocess.check_output( - command, # pylint: disable=unexpected-keyword-arg + output = subprocess.check_output( # pylint: disable=unexpected-keyword-arg + command, env=env, stderr=subprocess.STDOUT, ) diff --git a/vunit/test/mock_2or3.py b/vunit/test/mock_2or3.py index 7506d2372..cd5d3f0c8 100644 --- a/vunit/test/mock_2or3.py +++ b/vunit/test/mock_2or3.py @@ -11,9 +11,9 @@ try: # Python 3.x (builtin) - from unittest import ( + from unittest import ( # pylint: disable=import-error, no-name-in-module, unused-import mock, - ) # pylint: disable=import-error, no-name-in-module, unused-import + ) except ImportError: # Python 2.7 (needs separate install) import mock # pylint: disable=import-error, unused-import diff --git a/vunit/test/unit/test_csv_logs.py b/vunit/test/unit/test_csv_logs.py index 33b995b4e..d7b7a7a6c 100644 --- a/vunit/test/unit/test_csv_logs.py +++ b/vunit/test/unit/test_csv_logs.py @@ -29,6 +29,9 @@ def setUp(self): self._few_fields_files = join(self._few_fields_dir, "*.csv") def make_log(directory, contents): + """ + Make log + """ with NamedTemporaryFile( "w+", delete=False, dir=directory, suffix=".csv" ) as file_obj: diff --git a/vunit/test/unit/test_ghdl_interface.py b/vunit/test/unit/test_ghdl_interface.py index e9f615479..d5ba835f6 100644 --- a/vunit/test/unit/test_ghdl_interface.py +++ b/vunit/test/unit/test_ghdl_interface.py @@ -106,8 +106,8 @@ def test_assertion_on_unknown_backend(self, check_output): @mock.patch( "vunit.simulator_interface.check_output", autospec=True, return_value="" - ) - def test_compile_project_2008(self, check_output): # pylint: disable=no-self-use + ) # pylint: disable=no-self-use + def test_compile_project_2008(self, check_output): simif = GHDLInterface(prefix="prefix", output_path="") write_file("file.vhd", "") @@ -132,8 +132,8 @@ def test_compile_project_2008(self, check_output): # pylint: disable=no-self-us @mock.patch( "vunit.simulator_interface.check_output", autospec=True, return_value="" - ) - def test_compile_project_2002(self, check_output): # pylint: disable=no-self-use + ) # pylint: disable=no-self-use + def test_compile_project_2002(self, check_output): simif = GHDLInterface(prefix="prefix", output_path="") write_file("file.vhd", "") @@ -158,8 +158,8 @@ def test_compile_project_2002(self, check_output): # pylint: disable=no-self-us @mock.patch( "vunit.simulator_interface.check_output", autospec=True, return_value="" - ) - def test_compile_project_93(self, check_output): # pylint: disable=no-self-use + ) # pylint: disable=no-self-use + def test_compile_project_93(self, check_output): simif = GHDLInterface(prefix="prefix", output_path="") write_file("file.vhd", "") @@ -182,10 +182,10 @@ def test_compile_project_93(self, check_output): # pylint: disable=no-self-use @mock.patch( "vunit.simulator_interface.check_output", autospec=True, return_value="" - ) + ) # pylint: disable=no-self-use def test_compile_project_extra_flags( self, check_output - ): # pylint: disable=no-self-use + ): simif = GHDLInterface(prefix="prefix", output_path="") write_file("file.vhd", "") @@ -221,14 +221,14 @@ def test_elaborate_e_project(self): simif = GHDLInterface(prefix="prefix", output_path="") simif._vhdl_standard = "2008" # pylint: disable=protected-access simif._project = Project() # pylint: disable=protected-access - simif._project.add_library( + simif._project.add_library( # pylint: disable=protected-access "lib", "lib_path" - ) # pylint: disable=protected-access + ) self.assertEqual( - simif._get_command( + simif._get_command( # pylint: disable=protected-access config, join("output_path", "ghdl"), True - ), # pylint: disable=protected-access + ), [ join("prefix", "ghdl"), "-e", diff --git a/vunit/test/unit/test_incisive_interface.py b/vunit/test/unit/test_incisive_interface.py index 8818be243..a32d4236d 100644 --- a/vunit/test/unit/test_incisive_interface.py +++ b/vunit/test/unit/test_incisive_interface.py @@ -4,7 +4,7 @@ # # Copyright (c) 2014-2019, Lars Asplund lars.anders.asplund@gmail.com -# pylint: disable=too-many-public-methods +# pylint: disable=too-many-public-methods, too-many-lines """ Test the Incisive interface diff --git a/vunit/test/unit/test_project.py b/vunit/test/unit/test_project.py index 126226470..3a3174557 100644 --- a/vunit/test/unit/test_project.py +++ b/vunit/test/unit/test_project.py @@ -1875,9 +1875,9 @@ def hash_file_name_of(self, source_file): """ Get the hash file name of a source_file """ - return self.project._hash_file_name_of( + return self.project._hash_file_name_of( # pylint: disable=protected-access source_file - ) # pylint: disable=protected-access + ) def update(self, source_file): """ @@ -1968,8 +1968,8 @@ def assert_has_component_instantiation(self, source_file_name, component_name): "Did not find component " + component_name + " in " + source_file_name, ) - def _find_design_unit( - self, # pylint: disable=too-many-arguments + def _find_design_unit( # pylint: disable=too-many-arguments + self, source_file_name, design_unit_type, design_unit_name, diff --git a/vunit/test/unit/test_test_bench.py b/vunit/test/unit/test_test_bench.py index d3bf56786..03c13d5c1 100644 --- a/vunit/test/unit/test_test_bench.py +++ b/vunit/test/unit/test_test_bench.py @@ -4,7 +4,7 @@ # # Copyright (c) 2014-2019, Lars Asplund lars.anders.asplund@gmail.com -# pylint: disable=too-many-public-methods +# pylint: disable=too-many-public-methods, too-many-lines """ Tests the test test_bench module diff --git a/vunit/test/unit/test_test_suites.py b/vunit/test/unit/test_test_suites.py index ba8b5e480..c367369e1 100644 --- a/vunit/test/unit/test_test_suites.py +++ b/vunit/test/unit/test_test_suites.py @@ -106,9 +106,9 @@ def _read_test_results(self, expected, contents): test_suite_name=None, test_cases=expected, ) - results = run._read_test_results( + results = run._read_test_results( # pylint: disable=protected-access file_name=file_name - ) # pylint: disable=protected-access + ) self.assertEqual(results, expected) return results @@ -183,9 +183,9 @@ def func(): test_cases=expected, ) - results = run._read_test_results( + results = run._read_test_results( # pylint: disable=protected-access file_name=file_name - ) # pylint: disable=protected-access + ) self.assertEqual( run._check_results(results, sim_ok), # pylint: disable=protected-access (waschecked, expected), diff --git a/vunit/test/unit/test_ui.py b/vunit/test/unit/test_ui.py index 4556e6420..054231ab7 100644 --- a/vunit/test/unit/test_ui.py +++ b/vunit/test/unit/test_ui.py @@ -1197,20 +1197,20 @@ def create_csv_file(file_name, contents=""): with open(file_name, "w") as fprt: fprt.write(contents) - def assertRaisesRegex( + def assertRaisesRegex( # pylint: disable=invalid-name,arguments-differ self, *args, **kwargs - ): # pylint: disable=invalid-name,arguments-differ + ): """ Python 2/3 compatability """ if hasattr(unittest.TestCase, "assertRaisesRegex"): - unittest.TestCase.assertRaisesRegex( + unittest.TestCase.assertRaisesRegex( # pylint: disable=no-member self, *args, **kwargs - ) # pylint: disable=no-member + ) else: - unittest.TestCase.assertRaisesRegexp( + unittest.TestCase.assertRaisesRegexp( # pylint: disable=deprecated-method self, *args, **kwargs - ) # pylint: disable=deprecated-method + ) class TestPreprocessor(object): @@ -1273,9 +1273,9 @@ def compile_source_file_command(source_file): # pylint: disable=unused-argument return True @staticmethod - def simulate( + def simulate( # pylint: disable=unused-argument output_path, test_suite_name, config, elaborate_only - ): # pylint: disable=unused-argument + ): return True diff --git a/vunit/test_runner.py b/vunit/test_runner.py index b72a0ec0f..4a27c9fcd 100644 --- a/vunit/test_runner.py +++ b/vunit/test_runner.py @@ -36,8 +36,8 @@ class TestRunner(object): # pylint: disable=too-many-instance-attributes VERBOSITY_NORMAL = 1 VERBOSITY_VERBOSE = 2 - def __init__( - self, # pylint: disable=too-many-arguments + def __init__( # pylint: disable=too-many-arguments + self, report, output_path, verbosity=VERBOSITY_NORMAL, @@ -177,6 +177,9 @@ def _run_thread(self, write_stdout, scheduler, num_tests, is_main): def _add_skipped_tests( self, test_suite, results, start_time, num_tests, output_file_name ): + """ + Add skipped tests + """ for name in test_suite.test_names: results[name] = SKIPPED self._add_results(test_suite, results, start_time, num_tests, output_file_name) diff --git a/vunit/ui.py b/vunit/ui.py index e63e59263..8a93733f3 100644 --- a/vunit/ui.py +++ b/vunit/ui.py @@ -277,9 +277,9 @@ LOGGER = logging.getLogger(__name__) -class VUnit( +class VUnit( # pylint: disable=too-many-instance-attributes, too-many-public-methods object -): # pylint: disable=too-many-instance-attributes, too-many-public-methods +): """ The public interface of VUnit @@ -720,8 +720,8 @@ def get_source_files(self, pattern="*", library_name=None, allow_empty=False): return SourceFileList(results) - def add_source_files( - self, # pylint: disable=too-many-arguments + def add_source_files( # pylint: disable=too-many-arguments + self, pattern, library_name, preprocessors=None, @@ -765,8 +765,8 @@ def add_source_files( file_type=file_type, ) - def add_source_file( - self, # pylint: disable=too-many-arguments + def add_source_file( # pylint: disable=too-many-arguments + self, file_name, library_name, preprocessors=None, @@ -1376,8 +1376,8 @@ def get_source_files(self, pattern="*", allow_empty=False): """ return self._parent.get_source_files(pattern, self._library_name, allow_empty) - def add_source_files( - self, # pylint: disable=too-many-arguments + def add_source_files( # pylint: disable=too-many-arguments + self, pattern, preprocessors=None, include_dirs=None, @@ -1437,8 +1437,8 @@ def add_source_files( ] ) - def add_source_file( - self, # pylint: disable=too-many-arguments + def add_source_file( # pylint: disable=too-many-arguments + self, file_name, preprocessors=None, include_dirs=None, @@ -1686,8 +1686,8 @@ def set_post_check(self, value): """ self._test_bench.set_post_check(value) - def add_config( - self, # pylint: disable=too-many-arguments + def add_config( # pylint: disable=too-many-arguments + self, name, generics=None, parameters=None, @@ -1844,8 +1844,8 @@ def name(self): """ return self._test_case.name - def add_config( - self, # pylint: disable=too-many-arguments + def add_config( # pylint: disable=too-many-arguments + self, name, generics=None, parameters=None, @@ -2120,8 +2120,8 @@ def add_dependency_on(self, source_file): """ if isinstance(source_file, SourceFile): private_source_file = ( - source_file._source_file - ) # pylint: disable=protected-access + source_file._source_file # pylint: disable=protected-access + ) self._project.add_manual_dependency( self._source_file, depends_on=private_source_file ) diff --git a/vunit/vhdl_parser.py b/vunit/vhdl_parser.py index d34081083..e084cfd2c 100644 --- a/vunit/vhdl_parser.py +++ b/vunit/vhdl_parser.py @@ -47,8 +47,8 @@ class VHDLDesignFile(object): # pylint: disable=too-many-instance-attributes Contains VHDL objects found within a file """ - def __init__( - self, # pylint: disable=too-many-arguments + def __init__( # pylint: disable=too-many-arguments + self, entities=None, packages=None, package_bodies=None, @@ -202,7 +202,7 @@ def find(cls, code): yield VHDLArchitecture(identifier, entity_id) -PACKAGE_INSTANCE_PATTERN = r"\bpackage\s+(?P[a-zA-Z]\w*)\s+is\s+new\s+(?P[a-zA-Z]\w*)\.(?P[a-zA-Z]\w*)" +PACKAGE_INSTANCE_PATTERN = r"\bpackage\s+(?P[a-zA-Z]\w*)\s+is\s+new\s+(?P[a-zA-Z]\w*)\.(?P[a-zA-Z]\w*)" # pylint: disable=line-too-long class VHDLPackage(object):