Skip to content

Commit

Permalink
Run "make format" to format all docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
seisman committed Nov 23, 2020
1 parent 5236ac2 commit 2557e8f
Show file tree
Hide file tree
Showing 62 changed files with 520 additions and 954 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 @@ -163,7 +163,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: 6 additions & 15 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 @@ -51,7 +52,6 @@ def _preprocess(self, **kwargs): # pylint: disable=no-self-use
>>> base = BasePlotting()
>>> base._preprocess(resolution="low")
{'resolution': 'low'}
"""
return kwargs

Expand All @@ -78,7 +78,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 @@ -138,7 +138,6 @@ def coast(self, **kwargs):
{XY}
{p}
{t}
"""
kwargs = self._preprocess(**kwargs)
with Session() as lib:
Expand Down Expand Up @@ -224,7 +223,6 @@ def colorbar(self, **kwargs):
{XY}
{p}
{t}
"""
kwargs = self._preprocess(**kwargs)
with Session() as lib:
Expand Down Expand Up @@ -253,7 +251,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 @@ -469,7 +467,6 @@ def grdimage(self, grid, **kwargs):
{p}
{t}
{x}
"""
kwargs = self._preprocess(**kwargs)
kind = data_kind(grid, None, None)
Expand Down Expand Up @@ -580,7 +577,6 @@ def grdview(self, grid, **kwargs):
{XY}
{p}
{t}
"""
kwargs = self._preprocess(**kwargs)
kind = data_kind(grid, None, None)
Expand Down Expand Up @@ -778,7 +774,6 @@ def plot(self, x=None, y=None, data=None, sizes=None, direction=None, **kwargs):
{t}
*transparency* can also be a 1d array to set varying transparency
for symbols.
"""
kwargs = self._preprocess(**kwargs)

Expand Down Expand Up @@ -851,7 +846,7 @@ def plot3d(
self, x=None, y=None, z=None, data=None, sizes=None, direction=None, **kwargs
):
"""
Plot lines, polygons, and symbols in 3-D
Plot lines, polygons, and symbols in 3-D.
Takes a matrix, (x,y,z) triplets, or a file name as input and plots
lines, polygons, or symbols at those locations in 3-D.
Expand Down Expand Up @@ -961,7 +956,6 @@ def plot3d(
{t}
*transparency* can also be a 1d array to set varying transparency
for symbols.
"""
kwargs = self._preprocess(**kwargs)

Expand Down Expand Up @@ -1083,7 +1077,6 @@ def contour(self, x=None, y=None, z=None, data=None, **kwargs):
{XY}
{p}
{t}
"""
kwargs = self._preprocess(**kwargs)

Expand Down Expand Up @@ -1159,7 +1152,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 @@ -1216,7 +1208,6 @@ def logo(self, **kwargs):
{V}
{XY}
{t}
"""
kwargs = self._preprocess(**kwargs)
with Session() as lib:
Expand Down Expand Up @@ -1658,8 +1649,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 @@ -93,7 +91,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 @@ -127,7 +124,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 2557e8f

Please sign in to comment.