Skip to content

Commit

Permalink
Enable ruff's flake8-unused-arguments (ARG) rules (#2900)
Browse files Browse the repository at this point in the history
  • Loading branch information
seisman authored Dec 21, 2023
1 parent 2c81690 commit 06ae818
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pygmt/clib/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ def create(self, name):
self._error_log = []

@ctp.CFUNCTYPE(ctp.c_int, ctp.c_void_p, ctp.c_char_p)
def print_func(file_pointer, message):
def print_func(file_pointer, message): # noqa: ARG001
"""
Callback function that the GMT C API will use to print log and
error messages.
Expand Down
2 changes: 1 addition & 1 deletion pygmt/sphinx_gallery.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class PyGMTScraper:
``conf.py`` as the ``"image_scrapers"`` argument.
"""

def __call__(self, block, block_vars, gallery_conf):
def __call__(self, block, block_vars, gallery_conf): # noqa: ARG002
"""
Called by sphinx-gallery to save the figures generated after running
code.
Expand Down
6 changes: 3 additions & 3 deletions pygmt/tests/test_clib.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def mock(session, func, returns=None, mock_func=None):
"""
if mock_func is None:

def mock_api_function(*args):
def mock_api_function(*args): # noqa: ARG001
"""
A mock GMT API function that always returns a given value.
"""
Expand Down Expand Up @@ -523,7 +523,7 @@ def test_info_dict():
assert lib.info

# Mock GMT_Get_Default to return always the same string
def mock_defaults(api, name, value):
def mock_defaults(api, name, value): # noqa: ARG001
"""
Put 'bla' in the value buffer.
"""
Expand Down Expand Up @@ -552,7 +552,7 @@ def test_fails_for_wrong_version():
"""

# Mock GMT_Get_Default to return an old version
def mock_defaults(api, name, value):
def mock_defaults(api, name, value): # noqa: ARG001
"""
Return an old version.
"""
Expand Down
4 changes: 3 additions & 1 deletion pygmt/tests/test_clib_loading.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ def test_load_libgmt_fails(monkeypatch):
"darwin" if sys.platform == "linux" else "linux",
)
mpatch.setattr(
subprocess, "check_output", lambda cmd, encoding: "libfakegmt.so"
subprocess,
"check_output",
lambda cmd, encoding: "libfakegmt.so", # noqa: ARG005
)
with pytest.raises(GMTCLibNotFoundError):
check_libgmt(load_libgmt())
Expand Down
2 changes: 1 addition & 1 deletion pygmt/tests/test_figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def test_figure_savefig():
"""
kwargs_saved = []

def mock_psconvert(*args, **kwargs):
def mock_psconvert(*args, **kwargs): # noqa: ARG001
"""
Just record the arguments.
"""
Expand Down
2 changes: 1 addition & 1 deletion pygmt/tests/test_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def test_info_dataframe(dtype):
"""
Make sure info works on pandas.DataFrame inputs.
"""
table = pd.read_csv(POINTS_DATA, sep=" ", header=None)
table = pd.read_csv(POINTS_DATA, sep=" ", header=None, dtype=dtype)
output = info(data=table)
expected_output = (
"<vector memory>: N = 20 <11.5309/61.7074> <-2.9289/7.8648> <0.1412/0.9338>\n"
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ line-ending = "lf" # Use UNIX `\n` line endings for all files
[tool.ruff.lint]
select = [
"A", # flake8-builtins
"ARG", # flake8-unused-arguments
"B", # flake8-bugbear
"BLE", # flake8-blind-except
"C4", # flake8-comprehensions
Expand Down

0 comments on commit 06ae818

Please sign in to comment.