Skip to content

Commit 3589c88

Browse files
committed
Run "make format" to format docstrings
1 parent 488fdbe commit 3589c88

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+512
-919
lines changed

doc/conf.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
"""
3-
Sphinx documentation configuration file.
4-
"""
2+
"""Sphinx documentation configuration file."""
53
# pylint: disable=invalid-name
64

75
import datetime

pygmt/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ def test(doctest=True, verbose=True, coverage=False, figures=True):
164164
AssertionError
165165
If pytest returns a non-zero error code indicating that some tests have
166166
failed.
167-
168167
"""
169168
import pytest
170169

pygmt/_version.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False, env=
109109

110110

111111
def versions_from_parentdir(parentdir_prefix, root, verbose):
112-
"""Try to determine the version from the parent directory name.
112+
"""
113+
Try to determine the version from the parent directory name.
113114
114115
Source tarballs conventionally unpack into a directory that includes both
115116
the project name and a version string. We will also support searching up
@@ -232,7 +233,8 @@ def git_versions_from_keywords(keywords, tag_prefix, verbose):
232233

233234
@register_vcs_handler("git", "pieces_from_vcs")
234235
def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command):
235-
"""Get version from 'git describe' in the root of the source tree.
236+
"""
237+
Get version from 'git describe' in the root of the source tree.
236238
237239
This only gets called if the git-archive 'subst' keywords were *not*
238240
expanded, and _version.py hasn't already been rewritten with a short
@@ -339,7 +341,8 @@ def plus_or_dot(pieces):
339341

340342

341343
def render_pep440(pieces):
342-
"""Build up version string, with post-release "local version identifier".
344+
"""
345+
Build up version string, with post-release "local version identifier".
343346
344347
Our goal: TAG[+DISTANCE.gHEX[.dirty]] . Note that if you
345348
get a tagged build and then dirty it, you'll get TAG+0.gHEX.dirty
@@ -379,7 +382,8 @@ def render_pep440_pre(pieces):
379382

380383

381384
def render_pep440_post(pieces):
382-
"""TAG[.postDISTANCE[.dev0]+gHEX] .
385+
"""
386+
TAG[.postDISTANCE[.dev0]+gHEX] .
383387
384388
The ".dev0" means dirty. Note that .dev0 sorts backwards
385389
(a dirty tree will appear "older" than the corresponding clean one),
@@ -406,7 +410,8 @@ def render_pep440_post(pieces):
406410

407411

408412
def render_pep440_old(pieces):
409-
"""TAG[.postDISTANCE[.dev0]] .
413+
"""
414+
TAG[.postDISTANCE[.dev0]] .
410415
411416
The ".dev0" means dirty.
412417
@@ -428,7 +433,8 @@ def render_pep440_old(pieces):
428433

429434

430435
def render_git_describe(pieces):
431-
"""TAG[-DISTANCE-gHEX][-dirty].
436+
"""
437+
TAG[-DISTANCE-gHEX][-dirty].
432438
433439
Like 'git describe --tags --dirty --always'.
434440
@@ -448,7 +454,8 @@ def render_git_describe(pieces):
448454

449455

450456
def render_git_describe_long(pieces):
451-
"""TAG-DISTANCE-gHEX[-dirty].
457+
"""
458+
TAG-DISTANCE-gHEX[-dirty].
452459
453460
Like 'git describe --tags --dirty --always -long'.
454461
The distance/hash is unconditional.

pygmt/base_plotting.py

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""
22
Base class with plot generating commands.
3+
34
Does not define any special non-GMT methods (savefig, show, etc).
45
"""
56
import contextlib
@@ -50,7 +51,6 @@ def _preprocess(self, **kwargs): # pylint: disable=no-self-use
5051
>>> base = BasePlotting()
5152
>>> base._preprocess(resolution="low")
5253
{'resolution': 'low'}
53-
5454
"""
5555
return kwargs
5656

@@ -76,7 +76,7 @@ def _preprocess(self, **kwargs): # pylint: disable=no-self-use
7676
@kwargs_to_strings(R="sequence", p="sequence")
7777
def coast(self, **kwargs):
7878
"""
79-
Plot continents, shorelines, rivers, and borders on maps
79+
Plot continents, shorelines, rivers, and borders on maps.
8080
8181
Plots grayshaded, colored, or textured land-masses [or water-masses] on
8282
maps and [optionally] draws coastlines, rivers, and political
@@ -135,7 +135,6 @@ def coast(self, **kwargs):
135135
{XY}
136136
{p}
137137
{t}
138-
139138
"""
140139
kwargs = self._preprocess(**kwargs)
141140
with Session() as lib:
@@ -219,7 +218,6 @@ def colorbar(self, **kwargs):
219218
{XY}
220219
{p}
221220
{t}
222-
223221
"""
224222
kwargs = self._preprocess(**kwargs)
225223
with Session() as lib:
@@ -247,7 +245,7 @@ def colorbar(self, **kwargs):
247245
@kwargs_to_strings(R="sequence", L="sequence", A="sequence_plus", p="sequence")
248246
def grdcontour(self, grid, **kwargs):
249247
"""
250-
Convert grids or images to contours and plot them on maps
248+
Convert grids or images to contours and plot them on maps.
251249
252250
Takes a grid file name or an xarray.DataArray object as input.
253251
@@ -458,7 +456,6 @@ def grdimage(self, grid, **kwargs):
458456
{p}
459457
{t}
460458
{x}
461-
462459
"""
463460
kwargs = self._preprocess(**kwargs)
464461
kind = data_kind(grid, None, None)
@@ -567,7 +564,6 @@ def grdview(self, grid, **kwargs):
567564
{XY}
568565
{p}
569566
{t}
570-
571567
"""
572568
kwargs = self._preprocess(**kwargs)
573569
kind = data_kind(grid, None, None)
@@ -797,7 +793,6 @@ def contour(self, x=None, y=None, z=None, data=None, **kwargs):
797793
{XY}
798794
{p}
799795
{t}
800-
801796
"""
802797
kwargs = self._preprocess(**kwargs)
803798

@@ -867,7 +862,6 @@ def basemap(self, **kwargs):
867862
{XY}
868863
{p}
869864
{t}
870-
871865
"""
872866
kwargs = self._preprocess(**kwargs)
873867
if not ("B" in kwargs or "L" in kwargs or "T" in kwargs):
@@ -915,7 +909,6 @@ def logo(self, **kwargs):
915909
{XY}
916910
{p}
917911
{t}
918-
919912
"""
920913
kwargs = self._preprocess(**kwargs)
921914
if "D" not in kwargs:
@@ -1342,8 +1335,8 @@ def set_pointer(data_pointers, spec):
13421335

13431336
def update_pointers(data_pointers):
13441337
"""Updates variables based on the location of data, as the
1345-
following data can be passed as parameters or it can be
1346-
contained in `spec`."""
1338+
following data can be passed as parameters or it can be contained
1339+
in `spec`."""
13471340
# update all pointers
13481341
longitude = data_pointers["longitude"]
13491342
latitude = data_pointers["latitude"]

pygmt/clib/conversion.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
"""
2-
Functions to convert data types into ctypes friendly formats.
3-
"""
1+
"""Functions to convert data types into ctypes friendly formats."""
42
import numpy as np
53
import pandas as pd
64

@@ -80,7 +78,6 @@ def dataarray_to_matrix(grid):
8078
[-150.5, -78.5, -80.5, -48.5]
8179
>>> print(inc)
8280
[2.0, 2.0]
83-
8481
"""
8582
if len(grid.dims) != 2:
8683
raise GMTInvalidInput(
@@ -159,7 +156,6 @@ def vectors_to_arrays(vectors):
159156
>>> data = [[1, 2], (3, 4), range(5, 7)]
160157
>>> all(isinstance(i, np.ndarray) for i in vectors_to_arrays(data))
161158
True
162-
163159
"""
164160
arrays = [as_c_contiguous(np.asarray(i)) for i in vectors]
165161
return arrays
@@ -201,7 +197,6 @@ def as_c_contiguous(array):
201197
True
202198
>>> as_c_contiguous(x).flags.c_contiguous
203199
True
204-
205200
"""
206201
if not array.flags.c_contiguous:
207202
return array.copy(order="C")
@@ -239,7 +234,6 @@ def kwargs_to_ctypes_array(argument, kwargs, dtype):
239234
... )
240235
>>> print(should_be_none)
241236
None
242-
243237
"""
244238
if argument in kwargs:
245239
return dtype(*kwargs[argument])

pygmt/clib/loading.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ def load_libgmt():
3030
GMTCLibNotFoundError
3131
If there was any problem loading the library (couldn't find it or
3232
couldn't access the functions).
33-
3433
"""
3534
lib_fullnames = clib_full_names()
3635
error = True
@@ -64,7 +63,6 @@ def clib_names(os_name):
6463
-------
6564
libnames : list of str
6665
List of possible names of GMT's shared library.
67-
6866
"""
6967
if os_name.startswith("linux"):
7068
libnames = ["libgmt.so"]
@@ -92,7 +90,6 @@ def clib_full_names(env=None):
9290
-------
9391
lib_fullnames: list of str
9492
List of possible full names of GMT's shared library.
95-
9693
"""
9794
if env is None:
9895
env = os.environ
@@ -126,7 +123,6 @@ def check_libgmt(libgmt):
126123
Raises
127124
------
128125
GMTCLibError
129-
130126
"""
131127
# Check if a few of the functions we need are in the library
132128
functions = ["Create_Session", "Get_Enum", "Call_Module", "Destroy_Session"]

0 commit comments

Comments
 (0)