Skip to content

Commit

Permalink
lint: Check for unused arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
dalcinl committed Mar 10, 2024
1 parent cd7fedf commit 0e56ae4
Show file tree
Hide file tree
Showing 12 changed files with 20 additions and 13 deletions.
5 changes: 4 additions & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
[flake8]
ignore = W503
ignore = W503,U101
per-file-ignores =
conf/*: D
docs/*: D
src/mpi4py/futures/_core.py: D,B036
src/mpi4py/futures/aplus.py: B036
src/mpi4py/futures/util.py: B036
src/mpi4py/typing.py: U100
src/mpi4py/util/pkl5.py: U100
unused-arguments-ignore-variadic-names = True
1 change: 1 addition & 0 deletions .ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ lint.select = [
"S",
"W",
"UP",
"ARG",
"ISC",
"PIE",
#"PTH",
Expand Down
2 changes: 1 addition & 1 deletion .spin/cmds.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def install(editable, quiet, pip_args):
@click.option("-q", "--quiet", is_flag=True, help="Run quietly.")
@click.argument("pip_args", nargs=-1)
@click.pass_context
def editable(ctx, quiet, pip_args):
def editable(ctx, quiet, pip_args): # noqa: ARG001
"""🔧 Install package in editable mode."""
ctx.forward(install, editable=True)

Expand Down
2 changes: 1 addition & 1 deletion conf/cycoverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def line_is_excluded(_):
return code_lines, exec_lines, excluded_lines


def coverage_init(reg, options):
def coverage_init(reg, options): # noqa: ARG001
plugin = CythonCoveragePlugin()
reg.add_configurer(plugin)
reg.add_file_tracer(plugin)
6 changes: 3 additions & 3 deletions conf/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
import sys


def get_name(settings=None):
def get_name(settings=None): # noqa: ARG001
name = "mpi4py"
suffix = os.environ.get("MPI4PY_DIST_SUFFIX")
if suffix:
name = "{name}-{suffix}".format(**vars())
return name


def get_version(settings=None):
def get_version(settings=None): # noqa: ARG001
confdir = os.path.dirname(os.path.abspath(__file__))
topdir = os.path.dirname(confdir)
srcdir = os.path.join(topdir, "src")
Expand All @@ -25,7 +25,7 @@ def get_version(settings=None):
return version


def get_readme(settings=None):
def get_readme(settings=None): # noqa: ARG001
confdir = os.path.dirname(__file__)
topdir = os.path.dirname(confdir)
filelist = ("DESCRIPTION.rst", "CITATION.rst", "INSTALL.rst")
Expand Down
6 changes: 4 additions & 2 deletions conf/mpidistutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,8 @@ def cython_run(
args = []
if with_coverage():
args += ['-X', 'linetrace=True']
if includes:
args += [f'-I{incdir}' for incdir in includes]
if workdir:
args += ['--working', workdir]
args += [source]
Expand Down Expand Up @@ -948,7 +950,7 @@ def configure_mpi(ext, config_cmd):
configure_dl(ext, config_cmd)


def configure_pyexe(exe, config_cmd):
def configure_pyexe(exe, _config_cmd):
if sys.platform.startswith('win'):
return
if (sys.platform == 'darwin' and
Expand Down Expand Up @@ -1027,7 +1029,7 @@ def has_executables (self):
return self.distribution.has_executables()

sub_commands = [
('build_src', lambda *args: True),
('build_src', lambda *_: True),
*cmd_build.build.sub_commands,
('build_exe', has_executables),
]
Expand Down
2 changes: 1 addition & 1 deletion conf/mpistubgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ def Intersect(cls, group1: Group, group2: Group) -> Self: ...
"""


def visit_mpi4py_MPI(done=None):
def visit_mpi4py_MPI():
from mpi4py import MPI as module
lines = Lines()
lines.add = IMPORTS
Expand Down
1 change: 1 addition & 0 deletions conf/requirements-lint.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ flake8-assertive
flake8-bandit
flake8-bugbear
flake8-docstrings
flake8-unused-arguments
flake8-use-fstring
pylint
ruff
Expand Down
2 changes: 1 addition & 1 deletion docs/source/apidoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ def _def(cls, name):
"""


def visit_mpi4py_MPI(done=None):
def visit_mpi4py_MPI():
from mpi4py import MPI as module
lines = Lines()
lines.add = f'"""{module.__doc__}"""'
Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ class TypeDocumenter(autodoc.DataDocumenter):
priority = autodoc.ClassDocumenter.priority + 1

@classmethod
def can_document_member(cls, member, membername, isattr, parent):
def can_document_member(cls, member, _membername, _isattr, parent):
return (
isinstance(parent, autodoc.ModuleDocumenter)
and parent.name == 'mpi4py.typing'
Expand Down
2 changes: 1 addition & 1 deletion src/mpi4py/futures/aplus.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def catch(future, on_failure=None):
"""
if on_failure is None:
return then(future, None, lambda exc: None)
return then(future, None, lambda _: None)
return then(future, None, on_failure)


Expand Down
2 changes: 1 addition & 1 deletion src/mpi4py/util/pkl5.py
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@ def recv(self,
return _recv(self, MPI.Comm.Recv, buf, source, tag, status)

def irecv(self,
buf=None, source=ANY_SOURCE, tag=ANY_TAG):
buf=None, source=ANY_SOURCE, tag=ANY_TAG): # noqa: ARG002
"""Nonblocking receive."""
raise RuntimeError("unsupported")

Expand Down

0 comments on commit 0e56ae4

Please sign in to comment.