Skip to content

Commit 753a06e

Browse files
authored
Bump to ruff 0.9.0, apply ruff 2025 style, and ignore A005 (stdlib-module-shadowing) violations (#3763)
* Ignore A005 errors * Apply ruff styling changes in 2025 * Bump to ruff 0.9.0
1 parent 5041384 commit 753a06e

File tree

13 files changed

+19
-36
lines changed

13 files changed

+19
-36
lines changed

doc/conf.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,12 +210,10 @@
210210
repository = "GenericMappingTools/pygmt"
211211
repository_url = "https://github.com/GenericMappingTools/pygmt"
212212
if __commit__:
213-
commit_link = (
214-
f'<a href="{repository_url}/commit/{ __commit__ }">{ __commit__[:8] }</a>'
215-
)
213+
commit_link = f'<a href="{repository_url}/commit/{__commit__}">{__commit__[:8]}</a>'
216214
else:
217215
commit_link = (
218-
f'<a href="{repository_url}/releases/tag/{ __version__ }">{ __version__ }</a>'
216+
f'<a href="{repository_url}/releases/tag/{__version__}">{__version__}</a>'
219217
)
220218
html_context = {
221219
"menu_links": [

environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ dependencies:
2727
# Dev dependencies (style checks)
2828
- codespell
2929
- pre-commit
30-
- ruff>=0.8.2
30+
- ruff>=0.9.0
3131
# Dev dependencies (unit testing)
3232
- matplotlib-base
3333
- pytest>=6.0

examples/tutorials/advanced/cartesian_histograms.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@
348348
# of the bin width
349349
# Offset ("+o") the bars to align each bar with the left limit of the corresponding
350350
# bin
351-
barwidth=f"{binwidth/2}+o-{binwidth/4}",
351+
barwidth=f"{binwidth / 2}+o-{binwidth / 4}",
352352
label="data01",
353353
)
354354

@@ -359,7 +359,7 @@
359359
fill="orange",
360360
pen="1p,darkgray,solid",
361361
histtype=0,
362-
barwidth=f"{binwidth/2}+o{binwidth/4}",
362+
barwidth=f"{binwidth / 2}+o{binwidth / 4}",
363363
label="data02",
364364
)
365365

pygmt/_show_versions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from pygmt.clib import Session, __gmt_version__
1717

1818
# Get semantic version through setuptools-scm
19-
__version__ = f'v{version("pygmt")}' # e.g. v0.1.2.dev3+g0ab3cd78
19+
__version__ = f"v{version('pygmt')}" # e.g. v0.1.2.dev3+g0ab3cd78
2020
__commit__ = __version__.split("+g")[-1] if "+g" in __version__ else "" # 0ab3cd78
2121

2222

pygmt/encodings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# noqa: A005
12
"""
23
Character encodings supported by GMT.
34

pygmt/helpers/tempfile.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# noqa: A005
12
"""
23
Utilities for dealing with temporary file management.
34
"""

pygmt/helpers/utils.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -574,9 +574,8 @@ def launch_external_viewer(fname: str, waiting: float = 0) -> None:
574574
}
575575

576576
match sys.platform:
577-
case name if (
578-
(name == "linux" or name.startswith("freebsd"))
579-
and (xdgopen := shutil.which("xdg-open"))
577+
case name if (name == "linux" or name.startswith("freebsd")) and (
578+
xdgopen := shutil.which("xdg-open")
580579
): # Linux/FreeBSD
581580
subprocess.run([xdgopen, fname], check=False, **run_args) # type:ignore[call-overload]
582581
case "darwin": # macOS

pygmt/io.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# noqa: A005
12
"""
23
PyGMT input/output (I/O) utilities.
34
"""

pygmt/src/grd2xyz.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,7 @@ def grd2xyz(
145145

146146
if kwargs.get("o") is not None and output_type == "pandas":
147147
msg = (
148-
"If 'outcols' is specified, 'output_type' must be either 'numpy' "
149-
"or 'file'."
148+
"If 'outcols' is specified, 'output_type' must be either 'numpy' or 'file'."
150149
)
151150
raise GMTInvalidInput(msg)
152151
# Set the default column names for the pandas DataFrame header.

pygmt/src/select.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# noqa: A005
12
"""
23
select - Select data table subsets based on multiple spatial criteria.
34
"""

0 commit comments

Comments
 (0)