Skip to content

Commit

Permalink
Run "make format" to format docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
seisman committed Oct 4, 2020
1 parent 488fdbe commit 3589c88
Show file tree
Hide file tree
Showing 61 changed files with 512 additions and 919 deletions.
4 changes: 1 addition & 3 deletions doc/conf.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
"""
Sphinx documentation configuration file.
"""
"""Sphinx documentation configuration file."""
# pylint: disable=invalid-name

import datetime
Expand Down
1 change: 0 additions & 1 deletion pygmt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ def test(doctest=True, verbose=True, coverage=False, figures=True):
AssertionError
If pytest returns a non-zero error code indicating that some tests have
failed.
"""
import pytest

Expand Down
21 changes: 14 additions & 7 deletions pygmt/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False, env=


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

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


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


def render_pep440_post(pieces):
"""TAG[.postDISTANCE[.dev0]+gHEX] .
"""
TAG[.postDISTANCE[.dev0]+gHEX] .
The ".dev0" means dirty. Note that .dev0 sorts backwards
(a dirty tree will appear "older" than the corresponding clean one),
Expand All @@ -406,7 +410,8 @@ def render_pep440_post(pieces):


def render_pep440_old(pieces):
"""TAG[.postDISTANCE[.dev0]] .
"""
TAG[.postDISTANCE[.dev0]] .
The ".dev0" means dirty.
Expand All @@ -428,7 +433,8 @@ def render_pep440_old(pieces):


def render_git_describe(pieces):
"""TAG[-DISTANCE-gHEX][-dirty].
"""
TAG[-DISTANCE-gHEX][-dirty].
Like 'git describe --tags --dirty --always'.
Expand All @@ -448,7 +454,8 @@ def render_git_describe(pieces):


def render_git_describe_long(pieces):
"""TAG-DISTANCE-gHEX[-dirty].
"""
TAG-DISTANCE-gHEX[-dirty].
Like 'git describe --tags --dirty --always -long'.
The distance/hash is unconditional.
Expand Down
17 changes: 5 additions & 12 deletions pygmt/base_plotting.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""
Base class with plot generating commands.
Does not define any special non-GMT methods (savefig, show, etc).
"""
import contextlib
Expand Down Expand Up @@ -50,7 +51,6 @@ def _preprocess(self, **kwargs): # pylint: disable=no-self-use
>>> base = BasePlotting()
>>> base._preprocess(resolution="low")
{'resolution': 'low'}
"""
return kwargs

Expand All @@ -76,7 +76,7 @@ def _preprocess(self, **kwargs): # pylint: disable=no-self-use
@kwargs_to_strings(R="sequence", p="sequence")
def coast(self, **kwargs):
"""
Plot continents, shorelines, rivers, and borders on maps
Plot continents, shorelines, rivers, and borders on maps.
Plots grayshaded, colored, or textured land-masses [or water-masses] on
maps and [optionally] draws coastlines, rivers, and political
Expand Down Expand Up @@ -135,7 +135,6 @@ def coast(self, **kwargs):
{XY}
{p}
{t}
"""
kwargs = self._preprocess(**kwargs)
with Session() as lib:
Expand Down Expand Up @@ -219,7 +218,6 @@ def colorbar(self, **kwargs):
{XY}
{p}
{t}
"""
kwargs = self._preprocess(**kwargs)
with Session() as lib:
Expand Down Expand Up @@ -247,7 +245,7 @@ def colorbar(self, **kwargs):
@kwargs_to_strings(R="sequence", L="sequence", A="sequence_plus", p="sequence")
def grdcontour(self, grid, **kwargs):
"""
Convert grids or images to contours and plot them on maps
Convert grids or images to contours and plot them on maps.
Takes a grid file name or an xarray.DataArray object as input.
Expand Down Expand Up @@ -458,7 +456,6 @@ def grdimage(self, grid, **kwargs):
{p}
{t}
{x}
"""
kwargs = self._preprocess(**kwargs)
kind = data_kind(grid, None, None)
Expand Down Expand Up @@ -567,7 +564,6 @@ def grdview(self, grid, **kwargs):
{XY}
{p}
{t}
"""
kwargs = self._preprocess(**kwargs)
kind = data_kind(grid, None, None)
Expand Down Expand Up @@ -797,7 +793,6 @@ def contour(self, x=None, y=None, z=None, data=None, **kwargs):
{XY}
{p}
{t}
"""
kwargs = self._preprocess(**kwargs)

Expand Down Expand Up @@ -867,7 +862,6 @@ def basemap(self, **kwargs):
{XY}
{p}
{t}
"""
kwargs = self._preprocess(**kwargs)
if not ("B" in kwargs or "L" in kwargs or "T" in kwargs):
Expand Down Expand Up @@ -915,7 +909,6 @@ def logo(self, **kwargs):
{XY}
{p}
{t}
"""
kwargs = self._preprocess(**kwargs)
if "D" not in kwargs:
Expand Down Expand Up @@ -1342,8 +1335,8 @@ def set_pointer(data_pointers, spec):

def update_pointers(data_pointers):
"""Updates variables based on the location of data, as the
following data can be passed as parameters or it can be
contained in `spec`."""
following data can be passed as parameters or it can be contained
in `spec`."""
# update all pointers
longitude = data_pointers["longitude"]
latitude = data_pointers["latitude"]
Expand Down
8 changes: 1 addition & 7 deletions pygmt/clib/conversion.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
"""
Functions to convert data types into ctypes friendly formats.
"""
"""Functions to convert data types into ctypes friendly formats."""
import numpy as np
import pandas as pd

Expand Down Expand Up @@ -80,7 +78,6 @@ def dataarray_to_matrix(grid):
[-150.5, -78.5, -80.5, -48.5]
>>> print(inc)
[2.0, 2.0]
"""
if len(grid.dims) != 2:
raise GMTInvalidInput(
Expand Down Expand Up @@ -159,7 +156,6 @@ def vectors_to_arrays(vectors):
>>> data = [[1, 2], (3, 4), range(5, 7)]
>>> all(isinstance(i, np.ndarray) for i in vectors_to_arrays(data))
True
"""
arrays = [as_c_contiguous(np.asarray(i)) for i in vectors]
return arrays
Expand Down Expand Up @@ -201,7 +197,6 @@ def as_c_contiguous(array):
True
>>> as_c_contiguous(x).flags.c_contiguous
True
"""
if not array.flags.c_contiguous:
return array.copy(order="C")
Expand Down Expand Up @@ -239,7 +234,6 @@ def kwargs_to_ctypes_array(argument, kwargs, dtype):
... )
>>> print(should_be_none)
None
"""
if argument in kwargs:
return dtype(*kwargs[argument])
Expand Down
4 changes: 0 additions & 4 deletions pygmt/clib/loading.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ def load_libgmt():
GMTCLibNotFoundError
If there was any problem loading the library (couldn't find it or
couldn't access the functions).
"""
lib_fullnames = clib_full_names()
error = True
Expand Down Expand Up @@ -64,7 +63,6 @@ def clib_names(os_name):
-------
libnames : list of str
List of possible names of GMT's shared library.
"""
if os_name.startswith("linux"):
libnames = ["libgmt.so"]
Expand Down Expand Up @@ -92,7 +90,6 @@ def clib_full_names(env=None):
-------
lib_fullnames: list of str
List of possible full names of GMT's shared library.
"""
if env is None:
env = os.environ
Expand Down Expand Up @@ -126,7 +123,6 @@ def check_libgmt(libgmt):
Raises
------
GMTCLibError
"""
# Check if a few of the functions we need are in the library
functions = ["Create_Session", "Get_Enum", "Call_Module", "Destroy_Session"]
Expand Down
Loading

0 comments on commit 3589c88

Please sign in to comment.