Skip to content

Commit 01e180d

Browse files
author
Meghan Jones
authored
Merge branch 'main' into update-common-strings
2 parents 84c4608 + 2d2eb65 commit 01e180d

File tree

4 files changed

+11
-18
lines changed

4 files changed

+11
-18
lines changed

pygmt/sphinx_gallery.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
"""
22
Utilities for using pygmt with sphinx-gallery.
33
"""
4-
try:
5-
from sphinx_gallery.scrapers import figure_rst
6-
except ImportError:
7-
figure_rst = None
84

5+
import sphinx_gallery.scrapers
96
from pygmt.figure import SHOWED_FIGURES
107

118

@@ -32,4 +29,4 @@ def __call__(self, block, block_vars, gallery_conf):
3229
fig = figures.pop(0)
3330
fig.savefig(fname, transparent=True, dpi=200)
3431
image_names.append(fname)
35-
return figure_rst(image_names, gallery_conf["src_dir"])
32+
return sphinx_gallery.scrapers.figure_rst(image_names, gallery_conf["src_dir"])

pygmt/src/blockm.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def _blockm(block_method, table, outfile, x, y, z, **kwargs):
8181
r="registration",
8282
w="wrap",
8383
)
84-
@kwargs_to_strings(R="sequence", i="sequence_comma")
84+
@kwargs_to_strings(R="sequence", i="sequence_comma", o="sequence_comma")
8585
def blockmean(table=None, outfile=None, *, x=None, y=None, z=None, **kwargs):
8686
r"""
8787
Block average (x,y,z) data tables by mean estimation.
@@ -158,7 +158,7 @@ def blockmean(table=None, outfile=None, *, x=None, y=None, z=None, **kwargs):
158158
r="registration",
159159
w="wrap",
160160
)
161-
@kwargs_to_strings(R="sequence", i="sequence_comma")
161+
@kwargs_to_strings(R="sequence", i="sequence_comma", o="sequence_comma")
162162
def blockmedian(table=None, outfile=None, *, x=None, y=None, z=None, **kwargs):
163163
r"""
164164
Block average (x,y,z) data tables by median estimation.
@@ -241,7 +241,7 @@ def blockmedian(table=None, outfile=None, *, x=None, y=None, z=None, **kwargs):
241241
r="registration",
242242
w="wrap",
243243
)
244-
@kwargs_to_strings(R="sequence", i="sequence_comma")
244+
@kwargs_to_strings(R="sequence", i="sequence_comma", o="sequence_comma")
245245
def blockmode(table=None, outfile=None, *, x=None, y=None, z=None, **kwargs):
246246
r"""
247247
Block average (x,y,z) data tables by mode estimation.

pygmt/src/grdtrack.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
s="skiprows",
4141
w="wrap",
4242
)
43-
@kwargs_to_strings(R="sequence", S="sequence", i="sequence_comma")
43+
@kwargs_to_strings(R="sequence", S="sequence", i="sequence_comma", o="sequence_comma")
4444
def grdtrack(points, grid, newcolname=None, outfile=None, **kwargs):
4545
r"""
4646
Sample grids at specified (x,y) locations.

pygmt/tests/test_sphinx_gallery.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,13 @@
55
from tempfile import TemporaryDirectory
66

77
import pytest
8-
9-
try:
10-
import sphinx_gallery
11-
except ImportError:
12-
sphinx_gallery = None
13-
148
from pygmt.figure import SHOWED_FIGURES, Figure
15-
from pygmt.sphinx_gallery import PyGMTScraper
9+
10+
pygmt_sphinx_gallery = pytest.importorskip(
11+
"pygmt.sphinx_gallery", reason="requires sphinx-gallery to be installed"
12+
)
1613

1714

18-
@pytest.mark.skipif(sphinx_gallery is None, reason="requires sphinx-gallery")
1915
def test_pygmtscraper():
2016
"""
2117
Make sure the scraper finds the figures and removes them from the pool.
@@ -30,7 +26,7 @@ def test_pygmtscraper():
3026
fig.show()
3127
assert len(SHOWED_FIGURES) == 1
3228
assert SHOWED_FIGURES[0] is fig
33-
scraper = PyGMTScraper()
29+
scraper = pygmt_sphinx_gallery.PyGMTScraper()
3430
with TemporaryDirectory(dir=os.getcwd()) as tmpdir:
3531
conf = {"src_dir": "meh"}
3632
fname = os.path.join(tmpdir, "meh.png")

0 commit comments

Comments
 (0)