Skip to content

Commit 8d25f4d

Browse files
authored
Fix docstrings for blackdoc v0.3 by adding newline after block (#680)
1 parent 0c36187 commit 8d25f4d

File tree

4 files changed

+15
-0
lines changed

4 files changed

+15
-0
lines changed

pygmt/clib/session.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ class Session:
115115
... )
116116
... # Read the contents of the temp file before it's deleted.
117117
... print(fout.read().strip())
118+
...
118119
-180 180 -90 90 -8182 5651.5 1 1 360 180 1 1
119120
"""
120121

@@ -273,6 +274,7 @@ def get_libgmt_func(self, name, argtypes=None, restype=None):
273274
... func = lib.get_libgmt_func(
274275
... "GMT_Destroy_Session", argtypes=[c_void_p], restype=c_int
275276
... )
277+
...
276278
>>> type(func)
277279
<class 'ctypes.CDLL.__init__.<locals>._FuncPtr'>
278280
@@ -707,11 +709,13 @@ def _check_dtype_and_dim(self, array, ndim):
707709
>>> with Session() as ses:
708710
... gmttype = ses._check_dtype_and_dim(data, ndim=1)
709711
... gmttype == ses["GMT_DOUBLE"]
712+
...
710713
True
711714
>>> data = np.ones((5, 2), dtype="float32")
712715
>>> with Session() as ses:
713716
... gmttype = ses._check_dtype_and_dim(data, ndim=2)
714717
... gmttype == ses["GMT_FLOAT"]
718+
...
715719
True
716720
717721
"""
@@ -1041,6 +1045,7 @@ def open_virtual_file(self, family, geometry, direction, data):
10411045
... args = "{} ->{}".format(vfile, ofile.name)
10421046
... lib.call_module("info", args)
10431047
... print(ofile.read().strip())
1048+
...
10441049
<vector memory>: N = 5 <0/4> <5/9>
10451050
10461051
"""
@@ -1137,6 +1142,7 @@ def virtualfile_from_vectors(self, *vectors):
11371142
... "info", "{} ->{}".format(fin, fout.name)
11381143
... )
11391144
... print(fout.read().strip())
1145+
...
11401146
<vector memory>: N = 3 <1/3> <4/6> <7/9>
11411147
11421148
"""
@@ -1249,6 +1255,7 @@ def virtualfile_from_matrix(self, matrix):
12491255
... "info", "{} ->{}".format(fin, fout.name)
12501256
... )
12511257
... print(fout.read().strip())
1258+
...
12521259
<matrix memory>: N = 4 <0/9> <1/10> <2/11>
12531260
12541261
"""
@@ -1331,6 +1338,7 @@ def virtualfile_from_grid(self, grid):
13311338
... args = "{} -L0 -Cn ->{}".format(fin, fout.name)
13321339
... ses.call_module("grdinfo", args)
13331340
... print(fout.read().strip())
1341+
...
13341342
-180 180 -90 90 -8182 5651.5 1 1 360 180 1 1
13351343
>>> # The output is: w e s n z0 z1 dx dy n_columns n_rows reg gtype
13361344
@@ -1387,6 +1395,7 @@ def extract_region(self):
13871395
... )
13881396
>>> with Session() as lib:
13891397
... wesn = lib.extract_region()
1398+
...
13901399
>>> print(", ".join(["{:.2f}".format(x) for x in wesn]))
13911400
0.00, 10.00, -20.00, -10.00
13921401
@@ -1399,6 +1408,7 @@ def extract_region(self):
13991408
... )
14001409
>>> with Session() as lib:
14011410
... wesn = lib.extract_region()
1411+
...
14021412
>>> print(", ".join(["{:.2f}".format(x) for x in wesn]))
14031413
-164.71, -154.81, 18.91, 23.58
14041414
@@ -1412,6 +1422,7 @@ def extract_region(self):
14121422
... )
14131423
>>> with Session() as lib:
14141424
... wesn = lib.extract_region()
1425+
...
14151426
>>> print(", ".join(["{:.2f}".format(x) for x in wesn]))
14161427
-165.00, -150.00, 15.00, 25.00
14171428

pygmt/helpers/tempfile.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ class GMTTempFile:
5050
... print(lines)
5151
... nx, ny, nz = tmpfile.loadtxt(unpack=True, dtype=float)
5252
... print(nx, ny, nz)
53+
...
5354
0.0 1.0 2.0
5455
0.0 1.0 2.0
5556
0.0 1.0 2.0

pygmt/helpers/testing.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,15 @@ def check_figures_equal(*, extensions=("png",), tol=0.0, result_dir="result_imag
5757
... return fig_ref, fig_test
5858
>>> with pytest.raises(GMTImageComparisonFailure):
5959
... test_check_figures_unequal()
60+
...
6061
>>> for suffix in ["", "-expected", "-failed-diff"]:
6162
... assert os.path.exists(
6263
... os.path.join(
6364
... "tmp_result_images",
6465
... f"test_check_figures_unequal{suffix}.png",
6566
... )
6667
... )
68+
...
6769
>>> shutil.rmtree(path="tmp_result_images") # cleanup folder if tests pass
6870
"""
6971
# pylint: disable=invalid-name

pygmt/helpers/utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ def dummy_context(arg):
9696
9797
>>> with dummy_context("some argument") as temp:
9898
... print(temp)
99+
...
99100
some argument
100101
101102
"""

0 commit comments

Comments
 (0)