Skip to content

Commit 43f8c63

Browse files
committed
Enable ruff's pep8-naming (N) rules
1 parent c15014a commit 43f8c63

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

pygmt/exceptions.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class GMTCLibNoSessionError(GMTCLibError):
3535
"""
3636

3737

38-
class GMTInvalidInput(GMTError):
38+
class GMTInvalidInput(GMTError): # noqa: N818
3939
"""
4040
Raised when the input of a function/method is invalid.
4141
"""
@@ -47,7 +47,7 @@ class GMTVersionError(GMTError):
4747
"""
4848

4949

50-
class GMTImageComparisonFailure(AssertionError):
50+
class GMTImageComparisonFailure(AssertionError): # noqa: N818
5151
"""
5252
Raised when a comparison between two images fails.
5353
"""

pygmt/helpers/testing.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ def check_figures_equal(*, extensions=("png",), tol=0.0, result_dir="result_imag
7373
...
7474
>>> shutil.rmtree(path="tmp_result_images") # cleanup folder if tests pass
7575
"""
76-
ALLOWED_CHARS = set(string.digits + string.ascii_letters + "_-[]()")
77-
KEYWORD_ONLY = inspect.Parameter.KEYWORD_ONLY
76+
allowed_chars = set(string.digits + string.ascii_letters + "_-[]()")
77+
keyword_only = inspect.Parameter.KEYWORD_ONLY
7878

7979
def decorator(func):
8080
import pytest
@@ -90,7 +90,7 @@ def wrapper(*args, ext="png", request=None, **kwargs):
9090
if "request" in old_sig.parameters:
9191
kwargs["request"] = request
9292
try:
93-
file_name = "".join(c for c in request.node.name if c in ALLOWED_CHARS)
93+
file_name = "".join(c for c in request.node.name if c in allowed_chars)
9494
except AttributeError: # 'NoneType' object has no attribute 'node'
9595
file_name = func.__name__
9696
try:
@@ -129,9 +129,9 @@ def wrapper(*args, ext="png", request=None, **kwargs):
129129
if param.name not in {"fig_test", "fig_ref"}
130130
]
131131
if "ext" not in old_sig.parameters:
132-
parameters += [inspect.Parameter("ext", KEYWORD_ONLY)]
132+
parameters += [inspect.Parameter("ext", keyword_only)]
133133
if "request" not in old_sig.parameters:
134-
parameters += [inspect.Parameter("request", KEYWORD_ONLY)]
134+
parameters += [inspect.Parameter("request", keyword_only)]
135135
new_sig = old_sig.replace(parameters=parameters)
136136
wrapper.__signature__ = new_sig
137137

pygmt/src/config.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from pygmt.clib import Session
77

88

9-
class config:
9+
class config: # noqa: N801
1010
"""
1111
Set GMT defaults globally or locally.
1212

pygmt/src/grdhisteq.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
__doctest_skip__ = ["grdhisteq.*"]
2020

2121

22-
class grdhisteq:
22+
class grdhisteq: # noqa: N801
2323
r"""
2424
Perform histogram equalization for a grid.
2525

pygmt/src/triangulate.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from pygmt.io import load_dataarray
1818

1919

20-
class triangulate:
20+
class triangulate: # noqa: N801
2121
"""
2222
Delaunay triangulation or Voronoi partitioning and gridding of Cartesian
2323
data.

0 commit comments

Comments
 (0)