Skip to content

Commit

Permalink
fix: relocate pylint comments and docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
1138-4EB committed Sep 24, 2019
1 parent 6442ffd commit 88d3a38
Show file tree
Hide file tree
Showing 19 changed files with 106 additions and 95 deletions.
3 changes: 3 additions & 0 deletions tools/create_release_notes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
)
Expand Down
16 changes: 8 additions & 8 deletions vunit/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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}

Expand Down Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions vunit/ghdl_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
16 changes: 8 additions & 8 deletions vunit/incisive_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
"""
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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))
4 changes: 2 additions & 2 deletions vunit/parsing/verilog/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
12 changes: 6 additions & 6 deletions vunit/parsing/verilog/preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
18 changes: 10 additions & 8 deletions vunit/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
"""
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
12 changes: 6 additions & 6 deletions vunit/simulator_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
"""
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
)
Expand Down
4 changes: 2 additions & 2 deletions vunit/test/mock_2or3.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions vunit/test/unit/test_csv_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
24 changes: 12 additions & 12 deletions vunit/test/unit/test_ghdl_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -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", "")

Expand All @@ -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", "")

Expand All @@ -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", "")

Expand All @@ -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", "")

Expand Down Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion vunit/test/unit/test_incisive_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions vunit/test/unit/test_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion vunit/test/unit/test_test_bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit 88d3a38

Please sign in to comment.