Skip to content

Commit

Permalink
Fix docstrings for blackdoc v0.3 by adding newline after block (#680)
Browse files Browse the repository at this point in the history
  • Loading branch information
weiji14 authored Nov 5, 2020
1 parent 0c36187 commit 8d25f4d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pygmt/clib/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ class Session:
... )
... # Read the contents of the temp file before it's deleted.
... print(fout.read().strip())
...
-180 180 -90 90 -8182 5651.5 1 1 360 180 1 1
"""

Expand Down Expand Up @@ -273,6 +274,7 @@ def get_libgmt_func(self, name, argtypes=None, restype=None):
... func = lib.get_libgmt_func(
... "GMT_Destroy_Session", argtypes=[c_void_p], restype=c_int
... )
...
>>> type(func)
<class 'ctypes.CDLL.__init__.<locals>._FuncPtr'>
Expand Down Expand Up @@ -707,11 +709,13 @@ def _check_dtype_and_dim(self, array, ndim):
>>> with Session() as ses:
... gmttype = ses._check_dtype_and_dim(data, ndim=1)
... gmttype == ses["GMT_DOUBLE"]
...
True
>>> data = np.ones((5, 2), dtype="float32")
>>> with Session() as ses:
... gmttype = ses._check_dtype_and_dim(data, ndim=2)
... gmttype == ses["GMT_FLOAT"]
...
True
"""
Expand Down Expand Up @@ -1041,6 +1045,7 @@ def open_virtual_file(self, family, geometry, direction, data):
... args = "{} ->{}".format(vfile, ofile.name)
... lib.call_module("info", args)
... print(ofile.read().strip())
...
<vector memory>: N = 5 <0/4> <5/9>
"""
Expand Down Expand Up @@ -1137,6 +1142,7 @@ def virtualfile_from_vectors(self, *vectors):
... "info", "{} ->{}".format(fin, fout.name)
... )
... print(fout.read().strip())
...
<vector memory>: N = 3 <1/3> <4/6> <7/9>
"""
Expand Down Expand Up @@ -1249,6 +1255,7 @@ def virtualfile_from_matrix(self, matrix):
... "info", "{} ->{}".format(fin, fout.name)
... )
... print(fout.read().strip())
...
<matrix memory>: N = 4 <0/9> <1/10> <2/11>
"""
Expand Down Expand Up @@ -1331,6 +1338,7 @@ def virtualfile_from_grid(self, grid):
... args = "{} -L0 -Cn ->{}".format(fin, fout.name)
... ses.call_module("grdinfo", args)
... print(fout.read().strip())
...
-180 180 -90 90 -8182 5651.5 1 1 360 180 1 1
>>> # The output is: w e s n z0 z1 dx dy n_columns n_rows reg gtype
Expand Down Expand Up @@ -1387,6 +1395,7 @@ def extract_region(self):
... )
>>> with Session() as lib:
... wesn = lib.extract_region()
...
>>> print(", ".join(["{:.2f}".format(x) for x in wesn]))
0.00, 10.00, -20.00, -10.00
Expand All @@ -1399,6 +1408,7 @@ def extract_region(self):
... )
>>> with Session() as lib:
... wesn = lib.extract_region()
...
>>> print(", ".join(["{:.2f}".format(x) for x in wesn]))
-164.71, -154.81, 18.91, 23.58
Expand All @@ -1412,6 +1422,7 @@ def extract_region(self):
... )
>>> with Session() as lib:
... wesn = lib.extract_region()
...
>>> print(", ".join(["{:.2f}".format(x) for x in wesn]))
-165.00, -150.00, 15.00, 25.00
Expand Down
1 change: 1 addition & 0 deletions pygmt/helpers/tempfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class GMTTempFile:
... print(lines)
... nx, ny, nz = tmpfile.loadtxt(unpack=True, dtype=float)
... print(nx, ny, nz)
...
0.0 1.0 2.0
0.0 1.0 2.0
0.0 1.0 2.0
Expand Down
2 changes: 2 additions & 0 deletions pygmt/helpers/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,15 @@ def check_figures_equal(*, extensions=("png",), tol=0.0, result_dir="result_imag
... return fig_ref, fig_test
>>> with pytest.raises(GMTImageComparisonFailure):
... test_check_figures_unequal()
...
>>> for suffix in ["", "-expected", "-failed-diff"]:
... assert os.path.exists(
... os.path.join(
... "tmp_result_images",
... f"test_check_figures_unequal{suffix}.png",
... )
... )
...
>>> shutil.rmtree(path="tmp_result_images") # cleanup folder if tests pass
"""
# pylint: disable=invalid-name
Expand Down
1 change: 1 addition & 0 deletions pygmt/helpers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ def dummy_context(arg):
>>> with dummy_context("some argument") as temp:
... print(temp)
...
some argument
"""
Expand Down

0 comments on commit 8d25f4d

Please sign in to comment.