Skip to content
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

DOC: Fixes to the docs style #24182

Merged
merged 1 commit into from
Dec 9, 2018
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 2 additions & 1 deletion doc/source/advanced.rst
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,8 @@ they need to be sorted. As with any index, you can use :meth:`~DataFrame.sort_in

.. ipython:: python

import random; random.shuffle(tuples)
import random
random.shuffle(tuples)
s = pd.Series(np.random.randn(8), index=pd.MultiIndex.from_tuples(tuples))
s
s.sort_index()
Expand Down
2 changes: 1 addition & 1 deletion doc/source/categorical.rst
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,7 @@ Setting values by assigning categorical data will also check that the `categorie
df
try:
df.loc["j":"k", "cats"] = pd.Categorical(["b", "b"],
categories=["a", "b", "c"])
categories=["a", "b", "c"])
except ValueError as e:
print("ValueError:", str(e))

Expand Down
8 changes: 5 additions & 3 deletions doc/source/extending.rst
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ your ``MyExtensionArray`` class, as follows:

.. code-block:: python

from pandas.core.arrays import ExtensionArray, ExtensionScalarOpsMixin

class MyExtensionArray(ExtensionArray, ExtensionScalarOpsMixin):
pass

Expand Down Expand Up @@ -269,7 +271,7 @@ Below example shows how to define ``SubclassedSeries`` and ``SubclassedDataFrame

.. code-block:: python

class SubclassedSeries(Series):
class SubclassedSeries(pd.Series):

@property
def _constructor(self):
Expand All @@ -280,7 +282,7 @@ Below example shows how to define ``SubclassedSeries`` and ``SubclassedDataFrame
return SubclassedDataFrame


class SubclassedDataFrame(DataFrame):
class SubclassedDataFrame(pd.DataFrame):

@property
def _constructor(self):
Expand Down Expand Up @@ -342,7 +344,7 @@ Below is an example to define two original properties, "internal_cache" as a tem

.. code-block:: python

class SubclassedDataFrame2(DataFrame):
class SubclassedDataFrame2(pd.DataFrame):

# temporary properties
_internal_names = pd.DataFrame._internal_names + ['internal_cache']
Expand Down
1 change: 1 addition & 0 deletions doc/source/merging.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
.. ipython:: python
:suppress:

from matplotlib import pyplot as plt
import pandas.util._doctools as doctools
p = doctools.TablePlotter()

Expand Down
17 changes: 9 additions & 8 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,18 @@ exclude =

[flake8-rst]
bootstrap =
import pandas as pd
import numpy as np
import pandas as pd
np # avoiding error when importing again numpy or pandas
pd # (in some cases we want to do it to show users)
ignore = E402, # module level import not at top of file
W503, # line break before binary operator
# Classes/functions in different blocks can generate those errors
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@datapythonista why are you adding these? we want to error these, yes?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not in the documentation. flake8-rst merges all the blocks in a single file to validate it. Meaning that if I have a block of code that shows a class definition, if we validate for those errors, we will get an error, as the class definition will be immediately after the last statement of the previous block.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok thanks. maybe add what you just wrote in a future PR as a reader would have no idea how this works.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to explain in the comment before skipping the errors, but obviously not clear enough. Will add more context/info in a future PR.

E302, # expected 2 blank lines, found 0
E305, # expected 2 blank lines after class or function definition, found 0
# We use semicolon at the end to avoid displaying plot objects
E703, # statement ends with a semicolon

exclude =
doc/source/whatsnew/v0.7.0.rst
doc/source/whatsnew/v0.7.3.rst
Expand Down Expand Up @@ -69,23 +77,16 @@ exclude =
doc/source/whatsnew/v0.23.2.rst
doc/source/whatsnew/v0.24.0.rst
doc/source/10min.rst
doc/source/advanced.rst
doc/source/basics.rst
doc/source/categorical.rst
doc/source/contributing_docstring.rst
doc/source/contributing.rst
doc/source/dsintro.rst
doc/source/enhancingperf.rst
doc/source/extending.rst
doc/source/groupby.rst
doc/source/indexing.rst
doc/source/merging.rst
doc/source/missing_data.rst
doc/source/options.rst
doc/source/release.rst
doc/source/comparison_with_sas.rst
doc/source/comparison_with_sql.rst
doc/source/comparison_with_stata.rst
doc/source/reshaping.rst
doc/source/visualization.rst

Expand Down