Skip to content

DOC: Fix GL01 and GL02 errors in the docstrings #27988

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Aug 24, 2019
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 24 additions & 11 deletions pandas/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,18 +123,22 @@ def ip():

@pytest.fixture(params=[True, False, None])
def observed(request):
""" pass in the observed keyword to groupby for [True, False]
"""
pass in the observed keyword to groupby for [True, False]
This indicates whether categoricals should return values for
values which are not in the grouper [False / None], or only values which
appear in the grouper [True]. [None] is supported for future compatibility
if we decide to change the default (and would need to warn if this
parameter is not passed)"""
parameter is not passed)
"""
return request.param


@pytest.fixture(params=[True, False, None])
def ordered_fixture(request):
"""Boolean 'ordered' parameter for Categorical."""
"""
Boolean 'ordered' parameter for Categorical.
"""
return request.param


Expand Down Expand Up @@ -234,7 +238,8 @@ def cython_table_items(request):


def _get_cython_table_params(ndframe, func_names_and_expected):
"""combine frame, functions from SelectionMixin._cython_table
"""
combine frame, functions from SelectionMixin._cython_table
keys and expected result.

Parameters
Expand Down Expand Up @@ -341,7 +346,8 @@ def strict_data_files(pytestconfig):

@pytest.fixture
def datapath(strict_data_files):
"""Get the path to a data file.
"""
Get the path to a data file.

Parameters
----------
Expand Down Expand Up @@ -375,7 +381,9 @@ def deco(*args):

@pytest.fixture
def iris(datapath):
"""The iris dataset as a DataFrame."""
"""
The iris dataset as a DataFrame.
"""
return pd.read_csv(datapath("data", "iris.csv"))


Expand Down Expand Up @@ -504,7 +512,8 @@ def tz_aware_fixture(request):

@pytest.fixture(params=STRING_DTYPES)
def string_dtype(request):
"""Parametrized fixture for string dtypes.
"""
Parametrized fixture for string dtypes.

* str
* 'str'
Expand All @@ -515,7 +524,8 @@ def string_dtype(request):

@pytest.fixture(params=BYTES_DTYPES)
def bytes_dtype(request):
"""Parametrized fixture for bytes dtypes.
"""
Parametrized fixture for bytes dtypes.

* bytes
* 'bytes'
Expand All @@ -525,7 +535,8 @@ def bytes_dtype(request):

@pytest.fixture(params=OBJECT_DTYPES)
def object_dtype(request):
"""Parametrized fixture for object dtypes.
"""
Parametrized fixture for object dtypes.

* object
* 'object'
Expand All @@ -535,7 +546,8 @@ def object_dtype(request):

@pytest.fixture(params=DATETIME64_DTYPES)
def datetime64_dtype(request):
"""Parametrized fixture for datetime64 dtypes.
"""
Parametrized fixture for datetime64 dtypes.

* 'datetime64[ns]'
* 'M8[ns]'
Expand All @@ -545,7 +557,8 @@ def datetime64_dtype(request):

@pytest.fixture(params=TIMEDELTA64_DTYPES)
def timedelta64_dtype(request):
"""Parametrized fixture for timedelta64 dtypes.
"""
Parametrized fixture for timedelta64 dtypes.

* 'timedelta64[ns]'
* 'm8[ns]'
Expand Down
24 changes: 16 additions & 8 deletions pandas/io/html.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""":mod:`pandas.io.html` is a module containing functionality for dealing with
"""
:mod:`pandas.io.html` is a module containing functionality for dealing with
HTML IO.

"""
Expand Down Expand Up @@ -58,7 +59,8 @@ def _importers():


def _remove_whitespace(s, regex=_RE_WHITESPACE):
"""Replace extra whitespace inside of a string with a single space.
"""
Replace extra whitespace inside of a string with a single space.

Parameters
----------
Expand All @@ -77,7 +79,8 @@ def _remove_whitespace(s, regex=_RE_WHITESPACE):


def _get_skiprows(skiprows):
"""Get an iterator given an integer, slice or container.
"""
Get an iterator given an integer, slice or container.

Parameters
----------
Expand Down Expand Up @@ -107,7 +110,8 @@ def _get_skiprows(skiprows):


def _read(obj):
"""Try to read from a url, file or string.
"""
Try to read from a url, file or string.

Parameters
----------
Expand Down Expand Up @@ -136,7 +140,8 @@ def _read(obj):


class _HtmlFrameParser:
"""Base class for parsers that parse HTML into DataFrames.
"""
Base class for parsers that parse HTML into DataFrames.

Parameters
----------
Expand Down Expand Up @@ -515,7 +520,8 @@ def _handle_hidden_tables(self, tbl_list, attr_name):


class _BeautifulSoupHtml5LibFrameParser(_HtmlFrameParser):
"""HTML to DataFrame parser that uses BeautifulSoup under the hood.
"""
HTML to DataFrame parser that uses BeautifulSoup under the hood.

See Also
--------
Expand Down Expand Up @@ -622,7 +628,8 @@ def _build_xpath_expr(attrs):


class _LxmlFrameParser(_HtmlFrameParser):
"""HTML to DataFrame parser that uses lxml under the hood.
"""
HTML to DataFrame parser that uses lxml under the hood.

Warning
-------
Expand Down Expand Up @@ -937,7 +944,8 @@ def read_html(
keep_default_na=True,
displayed_only=True,
):
r"""Read HTML tables into a ``list`` of ``DataFrame`` objects.
r"""
Read HTML tables into a ``list`` of ``DataFrame`` objects.

Parameters
----------
Expand Down
4 changes: 3 additions & 1 deletion pandas/plotting/_matplotlib/hist.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ def _make_plot(self):
self._add_legend_handle(artists[0], label, index=i)

def _make_plot_keywords(self, kwds, y):
"""merge BoxPlot/KdePlot properties to passed kwds"""
"""
Merge BoxPlot/KdePlot properties to passed kwds.
"""
# y is required for KdePlot
kwds["bottom"] = self.bottom
kwds["bins"] = self.bins
Expand Down
4 changes: 3 additions & 1 deletion pandas/plotting/_matplotlib/style.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ def _get_standard_colors(
elif color_type == "random":

def random_color(column):
""" Returns a random color represented as a list of length 3"""
"""
Returns a random color represented as a list of length 3.
"""
# GH17525 use common._random_state to avoid resetting the seed
rs = com.random_state(column)
return rs.rand(3).tolist()
Expand Down
4 changes: 3 additions & 1 deletion pandas/plotting/_matplotlib/timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,9 @@ def _replot_ax(ax, freq, kwargs):


def _decorate_axes(ax, freq, kwargs):
"""Initialize axes for time-series plotting"""
"""
Initialize axes for time-series plotting.
"""
if not hasattr(ax, "_plot_data"):
ax._plot_data = []

Expand Down
3 changes: 2 additions & 1 deletion pandas/plotting/_matplotlib/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ def _subplots(
layout_type="box",
**fig_kw
):
"""Create a figure with a set of subplots already made.
"""
Create a figure with a set of subplots already made.

This utility wrapper makes it convenient to create common layouts of
subplots, including the enclosing figure object, in a single call.
Expand Down
6 changes: 4 additions & 2 deletions pandas/plotting/_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,8 @@ def parallel_coordinates(
sort_labels=False,
**kwds
):
"""Parallel coordinates plotting.
"""
Parallel coordinates plotting.
Parameters
----------
Expand Down Expand Up @@ -392,7 +393,8 @@ def parallel_coordinates(


def lag_plot(series, lag=1, ax=None, **kwds):
"""Lag plot for time series.
"""
Lag plot for time series.
Parameters
----------
Expand Down
15 changes: 11 additions & 4 deletions pandas/tests/io/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,32 @@

@pytest.fixture
def tips_file(datapath):
"""Path to the tips dataset"""
"""
Path to the tips dataset.
"""
return datapath("io", "parser", "data", "tips.csv")


@pytest.fixture
def jsonl_file(datapath):
"""Path a JSONL dataset"""
"""
Path a JSONL dataset.
"""
return datapath("io", "parser", "data", "items.jsonl")


@pytest.fixture
def salaries_table(datapath):
"""DataFrame with the salaries dataset"""
"""
DataFrame with the salaries dataset.
"""
return read_csv(datapath("io", "parser", "data", "salaries.csv"), sep="\t")


@pytest.fixture
def s3_resource(tips_file, jsonl_file):
"""Fixture for mocking S3 interaction.
"""
Fixture for mocking S3 interaction.

The primary bucket name is "pandas-test". The following datasets
are loaded.
Expand Down
4 changes: 3 additions & 1 deletion pandas/tests/io/generate_legacy_storage_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@ def _create_sp_frame():


def create_data():
""" create the pickle/msgpack data """
"""
Create the pickle/msgpack data.
"""

data = {
"A": [0.0, 1.0, 2.0, 3.0, np.nan],
Expand Down
4 changes: 3 additions & 1 deletion pandas/tests/io/msgpack/test_read_size.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"""Test Unpacker's read_array_header and read_map_header methods"""
"""
Test Unpacker's read_array_header and read_map_header methods.
"""
from pandas.io.msgpack import OutOfData, Unpacker, packb

UnexpectedTypeException = ValueError
Expand Down
4 changes: 3 additions & 1 deletion pandas/tests/io/msgpack/test_unpack_raw.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"""Tests for cases where the user seeks to obtain packed msgpack objects"""
"""
Tests for cases where the user seeks to obtain packed msgpack objects.
"""

import io

Expand Down
3 changes: 2 additions & 1 deletion pandas/tests/io/test_clipboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ def df(request):

@pytest.fixture
def mock_clipboard(monkeypatch, request):
"""Fixture mocking clipboard IO.
"""
Fixture mocking clipboard IO.

This mocks pandas.io.clipboard.clipboard_get and
pandas.io.clipboard.clipboard_set.
Expand Down
4 changes: 3 additions & 1 deletion pandas/tests/io/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@


class CustomFSPath:
"""For testing fspath on unknown objects"""
"""
For testing fspath on unknown objects.
"""

def __init__(self, path):
self.path = path
Expand Down
4 changes: 3 additions & 1 deletion pandas/tests/io/test_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
]
)
def html_encoding_file(request, datapath):
"""Parametrized fixture for HTML encoding test filenames."""
"""
Parametrized fixture for HTML encoding test filenames.
"""
return datapath("io", "data", "html_encoding", request.param)


Expand Down
9 changes: 5 additions & 4 deletions pandas/tests/io/test_stata.py
Original file line number Diff line number Diff line change
Expand Up @@ -1769,10 +1769,11 @@ def test_strl_latin1(self):
def test_encoding_latin1_118(self):
# GH 25960
msg = """
One or more strings in the dta file could not be decoded using utf-8, and
so the fallback encoding of latin-1 is being used. This can happen when a file
has been incorrectly encoded by Stata or some other software. You should verify
the string values returned are correct."""
One or more strings in the dta file could not be decoded using utf-8, and
so the fallback encoding of latin-1 is being used. This can happen when a file
has been incorrectly encoded by Stata or some other software. You should verify
the string values returned are correct.
"""
with tm.assert_produces_warning(UnicodeWarning) as w:
encoded = read_stata(self.dta_encoding_118)
assert len(w) == 151
Expand Down
4 changes: 3 additions & 1 deletion pandas/tests/scalar/timedelta/test_timedelta.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
""" test the scalar Timedelta """
"""
Test the scalar Timedelta.
"""
from datetime import timedelta
import re

Expand Down
8 changes: 6 additions & 2 deletions pandas/tests/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@ def _get_foo(self):
foo = property(_get_foo, _set_foo, doc="foo property")

def bar(self, *args, **kwargs):
""" a test bar method """
"""
A test bar method.
"""
pass

class Delegate(PandasDelegate, PandasObject):
Expand Down Expand Up @@ -158,7 +160,9 @@ def test_memory_usage(self):

class Ops:
def _allow_na_ops(self, obj):
"""Whether to skip test cases including NaN"""
"""
Whether to skip test cases including NaN.
"""
if isinstance(obj, Index) and (obj.is_boolean() or not obj._can_hold_na):
# don't test boolean / int64 index
return False
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/test_expressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def run_binary(
numexpr_ops={"gt", "lt", "ge", "le", "eq", "ne"},
):
"""
tests solely that the result is the same whether or not numexpr is
Tests solely that the result is the same whether or not numexpr is
enabled. Need to test whether the function does the correct thing
elsewhere.
"""
Expand Down
Loading