Skip to content

Commit 06ae818

Browse files
authored
Enable ruff's flake8-unused-arguments (ARG) rules (#2900)
1 parent 2c81690 commit 06ae818

File tree

7 files changed

+11
-8
lines changed

7 files changed

+11
-8
lines changed

pygmt/clib/session.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ def create(self, name):
369369
self._error_log = []
370370

371371
@ctp.CFUNCTYPE(ctp.c_int, ctp.c_void_p, ctp.c_char_p)
372-
def print_func(file_pointer, message):
372+
def print_func(file_pointer, message): # noqa: ARG001
373373
"""
374374
Callback function that the GMT C API will use to print log and
375375
error messages.

pygmt/sphinx_gallery.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class PyGMTScraper:
1919
``conf.py`` as the ``"image_scrapers"`` argument.
2020
"""
2121

22-
def __call__(self, block, block_vars, gallery_conf):
22+
def __call__(self, block, block_vars, gallery_conf): # noqa: ARG002
2323
"""
2424
Called by sphinx-gallery to save the figures generated after running
2525
code.

pygmt/tests/test_clib.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def mock(session, func, returns=None, mock_func=None):
3838
"""
3939
if mock_func is None:
4040

41-
def mock_api_function(*args):
41+
def mock_api_function(*args): # noqa: ARG001
4242
"""
4343
A mock GMT API function that always returns a given value.
4444
"""
@@ -523,7 +523,7 @@ def test_info_dict():
523523
assert lib.info
524524

525525
# Mock GMT_Get_Default to return always the same string
526-
def mock_defaults(api, name, value):
526+
def mock_defaults(api, name, value): # noqa: ARG001
527527
"""
528528
Put 'bla' in the value buffer.
529529
"""
@@ -552,7 +552,7 @@ def test_fails_for_wrong_version():
552552
"""
553553

554554
# Mock GMT_Get_Default to return an old version
555-
def mock_defaults(api, name, value):
555+
def mock_defaults(api, name, value): # noqa: ARG001
556556
"""
557557
Return an old version.
558558
"""

pygmt/tests/test_clib_loading.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@ def test_load_libgmt_fails(monkeypatch):
7979
"darwin" if sys.platform == "linux" else "linux",
8080
)
8181
mpatch.setattr(
82-
subprocess, "check_output", lambda cmd, encoding: "libfakegmt.so"
82+
subprocess,
83+
"check_output",
84+
lambda cmd, encoding: "libfakegmt.so", # noqa: ARG005
8385
)
8486
with pytest.raises(GMTCLibNotFoundError):
8587
check_libgmt(load_libgmt())

pygmt/tests/test_figure.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ def test_figure_savefig():
225225
"""
226226
kwargs_saved = []
227227

228-
def mock_psconvert(*args, **kwargs):
228+
def mock_psconvert(*args, **kwargs): # noqa: ARG001
229229
"""
230230
Just record the arguments.
231231
"""

pygmt/tests/test_info.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def test_info_dataframe(dtype):
9999
"""
100100
Make sure info works on pandas.DataFrame inputs.
101101
"""
102-
table = pd.read_csv(POINTS_DATA, sep=" ", header=None)
102+
table = pd.read_csv(POINTS_DATA, sep=" ", header=None, dtype=dtype)
103103
output = info(data=table)
104104
expected_output = (
105105
"<vector memory>: N = 20 <11.5309/61.7074> <-2.9289/7.8648> <0.1412/0.9338>\n"

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ line-ending = "lf" # Use UNIX `\n` line endings for all files
100100
[tool.ruff.lint]
101101
select = [
102102
"A", # flake8-builtins
103+
"ARG", # flake8-unused-arguments
103104
"B", # flake8-bugbear
104105
"BLE", # flake8-blind-except
105106
"C4", # flake8-comprehensions

0 commit comments

Comments
 (0)