Skip to content

Commit

Permalink
Fixed linting related to too many positional arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
LarsAsplund committed Nov 4, 2024
1 parent 80bba05 commit 994283e
Show file tree
Hide file tree
Showing 19 changed files with 64 additions and 28 deletions.
1 change: 1 addition & 0 deletions tools/doc_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def highlight_code(
code_path,
output_path,
snippet_name=None,
*,
line_no_offset=None,
functions=None,
types=None,
Expand Down
2 changes: 1 addition & 1 deletion vunit/cached.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from vunit.ostools import read_file


def cached(key, function, file_name, encoding, database=None, newline=None):
def cached(key, function, file_name, encoding, *, database=None, newline=None):
"""
Call function with file content if an update is needed
"""
Expand Down
2 changes: 2 additions & 0 deletions vunit/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def __init__( # pylint: disable=too-many-arguments
self,
name,
design_unit,
*,
generics=None,
sim_options=None,
pre_config=None,
Expand Down Expand Up @@ -282,6 +283,7 @@ def _check_architectures(design_unit):
def add_config( # pylint: disable=too-many-arguments
self,
name,
*,
generics=None,
pre_config=None,
post_check=None,
Expand Down
3 changes: 2 additions & 1 deletion vunit/design_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def __init__(
name,
source_file,
unit_type,
*,
is_primary=True,
primary_design_unit=None,
):
Expand All @@ -66,7 +67,7 @@ class Entity(VHDLDesignUnit):
"""

def __init__(self, name, source_file, generic_names=None):
VHDLDesignUnit.__init__(self, name, source_file, "entity", True)
VHDLDesignUnit.__init__(self, name, source_file, "entity", is_primary=True)
self.generic_names = [] if generic_names is None else generic_names
self._add_architecture_callback = None
self._architecture_names = {}
Expand Down
1 change: 1 addition & 0 deletions vunit/parsing/verilog/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ class VerilogDesignFile(object):

def __init__( # pylint: disable=too-many-arguments
self,
*,
modules=None,
packages=None,
imports=None,
Expand Down
8 changes: 5 additions & 3 deletions vunit/parsing/verilog/preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def _preprocess(self, tokens, defines=None, include_paths=None, included_files=N

return result

def preprocessor( # pylint: disable=too-many-arguments,too-many-branches
def preprocessor( # pylint: disable=too-many-arguments,too-many-branches,too-many-positional-arguments
self, token, stream, defines, include_paths, included_files
):
"""
Expand Down Expand Up @@ -162,7 +162,7 @@ def _skip_protected_region(stream):
if token.value == "end_protected":
return

def expand_macro( # pylint: disable=too-many-arguments
def expand_macro( # pylint: disable=too-many-arguments,too-many-positional-arguments
self, macro_token, stream, defines, include_paths, included_files
):
"""
Expand Down Expand Up @@ -254,7 +254,9 @@ def determine_if_taken(if_token, arg):
stream.skip_while(NEWLINE)
return result

def include(self, token, stream, include_paths, included_files, defines): # pylint: disable=too-many-arguments
def include(
self, token, stream, include_paths, included_files, defines
): # pylint: disable=too-many-arguments,too-many-positional-arguments
"""
Handle `include directive
"""
Expand Down
1 change: 1 addition & 0 deletions vunit/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ def add_source_file( # pylint: disable=too-many-arguments
self,
file_name,
library_name,
*,
file_type="vhdl",
include_dirs=None,
defines=None,
Expand Down
12 changes: 8 additions & 4 deletions vunit/sim_if/ghdl.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ def __init__( # pylint: disable=too-many-arguments
self,
output_path,
prefix,
*,
gui=False,
viewer_fmt=None,
viewer_args="",
Expand Down Expand Up @@ -286,7 +287,7 @@ def compile_vhdl_file_command(self, source_file):

def _get_command(
self, config, output_path, elaborate_only, ghdl_e, test_suite_name, wave_file
): # pylint: disable=too-many-branches,too-many-arguments
): # pylint: disable=too-many-branches,too-many-arguments,too-many-positional-arguments
"""
Return GHDL simulation command
"""
Expand Down Expand Up @@ -392,9 +393,12 @@ def simulate(self, output_path, test_suite_name, config, elaborate_only): # pyl
status = False

if config.sim_options.get(self.name + ".gtkwave_script.gui", None):
LOGGER.warning("%s.gtkwave_script.gui is deprecated and will be removed "
"in a future version, use %s.viewer_script.gui instead",
self.name, self.name)
LOGGER.warning(
"%s.gtkwave_script.gui is deprecated and will be removed "
"in a future version, use %s.viewer_script.gui instead",
self.name,
self.name,
)

if self._gui and not elaborate_only:
cmd = [self._get_viewer(config)] + shlex.split(self._viewer_args) + [data_file_name]
Expand Down
2 changes: 1 addition & 1 deletion vunit/sim_if/incisive.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def supports_vhdl_contexts():
return False

def __init__( # pylint: disable=too-many-arguments
self, prefix, output_path, gui=False, log_level=None, cdslib=None, hdlvar=None
self, prefix, output_path, *, gui=False, log_level=None, cdslib=None, hdlvar=None
):
SimulatorInterface.__init__(self, output_path, gui)
self._prefix = prefix
Expand Down
11 changes: 7 additions & 4 deletions vunit/sim_if/nvc.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def find_prefix_from_path(cls):
return cls.find_toolchain([cls.executable])

def __init__( # pylint: disable=too-many-arguments
self, output_path, prefix, num_threads, gui=False, viewer_fmt=None, viewer_args="", viewer=None
self, output_path, prefix, *, num_threads, gui=False, viewer_fmt=None, viewer_args="", viewer=None
):
SimulatorInterface.__init__(self, output_path, gui)
if viewer_fmt == "ghw":
Expand Down Expand Up @@ -305,9 +305,12 @@ def simulate(
status = False

if config.sim_options.get(self.name + ".gtkwave_script.gui", None):
LOGGER.warning("%s.gtkwave_script.gui is deprecated and will be removed "
"in a future version, use %s.viewer_script.gui instead",
self.name, self.name)
LOGGER.warning(
"%s.gtkwave_script.gui is deprecated and will be removed "
"in a future version, use %s.viewer_script.gui instead",
self.name,
self.name,
)

if self._gui and not elaborate_only:
cmd = [self._get_viewer(config)] + shlex.split(self._viewer_args) + [str(wave_file)]
Expand Down
12 changes: 9 additions & 3 deletions vunit/source_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ def __init__( # pylint: disable=too-many-arguments
file_type,
name,
library,
*,
verilog_parser,
database,
include_dirs=None,
Expand Down Expand Up @@ -206,6 +207,7 @@ def __init__( # pylint: disable=too-many-arguments
self,
name: Union[str, Path],
library: Library,
*,
vhdl_parser,
database,
vhdl_standard: VHDLStandard,
Expand Down Expand Up @@ -311,16 +313,20 @@ def _find_design_units(self, design_file):
architecture.identifier,
self,
"architecture",
False,
architecture.entity,
is_primary=False,
primary_design_unit=architecture.entity,
)
)

for configuration in design_file.configurations:
result.append(VHDLDesignUnit(configuration.identifier, self, "configuration"))

for body in design_file.package_bodies:
result.append(VHDLDesignUnit(body.identifier, self, "package body", False, body.identifier))
result.append(
VHDLDesignUnit(
body.identifier, self, "package body", is_primary=False, primary_design_unit=body.identifier
)
)

return result

Expand Down
11 changes: 10 additions & 1 deletion vunit/test/bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ def set_attribute(self, name, value):
def add_config( # pylint: disable=too-many-arguments
self,
name,
*,
generics=None,
pre_config=None,
post_check=None,
Expand Down Expand Up @@ -257,7 +258,15 @@ def add_config( # pylint: disable=too-many-arguments
self._individual_tests = not run_all_in_same_sim and len(self._test_cases) > 0
del attributes["run_all_in_same_sim"]

super().add_config(name, generics, pre_config, post_check, sim_options, attributes, vhdl_configuration_name)
super().add_config(
name,
generics=generics,
pre_config=pre_config,
post_check=post_check,
sim_options=sim_options,
attributes=attributes,
vhdl_configuration_name=vhdl_configuration_name,
)


class FileLocation(object):
Expand Down
11 changes: 8 additions & 3 deletions vunit/test/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def __init__( # pylint: disable=too-many-arguments
self,
report,
output_path,
*,
verbosity=VERBOSITY_NORMAL,
num_threads=1,
fail_fast=False,
Expand Down Expand Up @@ -193,7 +194,9 @@ def _get_output_path(self, test_suite_name):

return str(Path(output_path) / full_name)

def _add_skipped_tests(self, test_suite, results, start_time, num_tests, output_file_name):
def _add_skipped_tests(
self, test_suite, results, start_time, num_tests, output_file_name
): # pylint: disable=too-many-positional-arguments
"""
Add skipped tests
"""
Expand All @@ -203,7 +206,7 @@ def _add_skipped_tests(self, test_suite, results, start_time, num_tests, output_

def _run_test_suite( # pylint: disable=too-many-locals
self, test_suite, write_stdout, num_tests, output_path, output_file_name
):
): # pylint: disable=too-many-positional-arguments
"""
Run the actual test suite
"""
Expand Down Expand Up @@ -313,7 +316,9 @@ def _print_output(self, output_file_name):
for line in fread.readlines():
self._stdout_ansi.write(line)

def _add_results(self, test_suite, results, start_time, num_tests, output_file_name):
def _add_results(
self, test_suite, results, start_time, num_tests, output_file_name
): # pylint: disable=too-many-positional-arguments
"""
Add results to test report
"""
Expand Down
2 changes: 1 addition & 1 deletion vunit/test/suites.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class TestRun(object):
A single simulation run yielding the results for one or several test cases
"""

def __init__(self, simulator_if, config, elaborate_only, test_suite_name, test_cases):
def __init__(self, *, simulator_if, config, elaborate_only, test_suite_name, test_cases):
self._simulator_if = simulator_if
self._config = config
self._elaborate_only = elaborate_only
Expand Down
4 changes: 2 additions & 2 deletions vunit/ui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ def get_source_files(

return SourceFileList(results)

def add_source_files( # pylint: disable=too-many-arguments
def add_source_files( # pylint: disable=too-many-arguments,too-many-positional-arguments
self,
pattern,
library_name: str,
Expand Down Expand Up @@ -563,7 +563,7 @@ def add_source_files( # pylint: disable=too-many-arguments
file_type=file_type,
)

def add_source_file( # pylint: disable=too-many-arguments
def add_source_file( # pylint: disable=too-many-arguments,too-many-positional-arguments
self,
file_name: Union[str, Path],
library_name: str,
Expand Down
4 changes: 2 additions & 2 deletions vunit/ui/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ 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( # pylint: disable=too-many-arguments
def add_source_files( # pylint: disable=too-many-arguments, too-many-positional-arguments
self,
pattern,
preprocessors=None,
Expand Down Expand Up @@ -375,7 +375,7 @@ def add_source_files( # pylint: disable=too-many-arguments
]
)

def add_source_file( # pylint: disable=too-many-arguments
def add_source_file( # pylint: disable=too-many-arguments,too-many-positional-arguments
self,
file_name,
preprocessors=None,
Expand Down
2 changes: 1 addition & 1 deletion vunit/ui/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def name(self):
"""
return self._test_case.name

def add_config( # pylint: disable=too-many-arguments
def add_config( # pylint: disable=too-many-arguments,too-many-positional-arguments
self,
name,
generics=None,
Expand Down
2 changes: 1 addition & 1 deletion vunit/ui/testbench.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def set_post_check(self, value):
"""
self._test_bench.set_post_check(value)

def add_config( # pylint: disable=too-many-arguments
def add_config( # pylint: disable=too-many-arguments,too-many-positional-arguments
self,
name,
generics=None,
Expand Down
1 change: 1 addition & 0 deletions vunit/vhdl_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class VHDLDesignFile(object): # pylint: disable=too-many-instance-attributes

def __init__( # pylint: disable=too-many-arguments
self,
*,
entities=None,
packages=None,
package_bodies=None,
Expand Down

0 comments on commit 994283e

Please sign in to comment.