Skip to content

DOC: Fix flake8 issues in doc/source/whatsnew/v0.14.*.rst #24240

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

Closed
saurav2608 opened this issue Dec 11, 2018 · 2 comments · Fixed by #24253
Closed

DOC: Fix flake8 issues in doc/source/whatsnew/v0.14.*.rst #24240

saurav2608 opened this issue Dec 11, 2018 · 2 comments · Fixed by #24253

Comments

@saurav2608
Copy link

saurav2608 commented Dec 11, 2018

xref: #24177

We didn't start validating the format of PEP8 and other code standards in the documentation examples until recently. We still have some files with errors, that we need to skip, and that we should fix, so we can start validating them.

Two steps are required to replicate the issue

  1. Edit setup.cfg in the pandas home, and in the flake8-rst section, remove from the exclude list the file doc/source/whatsnew/v0.14.0.rst & doc/source/whatsnew/v0.14.1.rst

  2. Remove the import block ( from pandas import *) from the lines (8-11) of the file v0.14.*.rst.

After that, running the next command will report the errors in the file (note that syntax error usually prevent to validate other errors, and the list of errors to fix can become much longer when the syntax error is fixed (please make sure that you are using flake8-rst version 0.7.0 or higher):

$ flake8-rst doc/source/whatsnew/v0.14.*
doc/source/whatsnew/v0.14.0.rst:62:39: E231 missing whitespace after ','
doc/source/whatsnew/v0.14.0.rst:62:42: E231 missing whitespace after ','
doc/source/whatsnew/v0.14.0.rst:64:16: E231 missing whitespace after ','
doc/source/whatsnew/v0.14.0.rst:65:16: E231 missing whitespace after ','
doc/source/whatsnew/v0.14.0.rst:72:17: E231 missing whitespace after ','
doc/source/whatsnew/v0.14.0.rst:72:19: E231 missing whitespace after ','
doc/source/whatsnew/v0.14.0.rst:73:36: E999 SyntaxError: invalid syntax
doc/source/whatsnew/v0.14.0.rst:73:45: E226 missing whitespace around arithmetic operator
doc/source/whatsnew/v0.14.0.rst:73:48: E226 missing whitespace around arithmetic operator
...
doc/source/whatsnew/v0.14.1.rst:103:16: F821 undefined name 'Timestamp'
doc/source/whatsnew/v0.14.1.rst:106:16: F821 undefined name 'Timestamp'
doc/source/whatsnew/v0.14.1.rst:126:12: F821 undefined name 'date_range'

Once all the errors are addressed, please open a pull request with the fixes in the file, and removing the file from setup.cfg. If you need to do something that feels wrong to fix an error, please ask in a comment to this issue. Please avoid other unrelated changes, which can be addressed in a separate pull request.
cc: @datapythonista

@Seuss27
Copy link
Contributor

Seuss27 commented Dec 12, 2018

I am trying to have a go at this and I am a little confused by the SyntaxError on line 73. It loks like it is just a text response in the code
dfl.iloc[[4, 5, 6]]
IndexError: positional indexers are out-of-bounds

I am not entirely sure what to do with this as it isn't actually code that is throwing the error as far as I can tell. To be clear, the line with the SyntaxError according to flake8-rst is the IndexError: line... Any advice?

@datapythonista
Copy link
Member

The problem in this case is that in a .. code-block:: python, the code should be like:

>>> print('hello world')
hello world

I don't remember in the case of exceptions if something else more than the line of the error is needed, but you should find it online

Seuss27 added a commit to Seuss27/pandas that referenced this issue Dec 13, 2018
…snew/v0.14.*

Implemented changes based on feedback.
@Seuss27 Seuss27 mentioned this issue Dec 13, 2018
1 task
Seuss27 added a commit to Seuss27/pandas that referenced this issue Dec 14, 2018
…snew/v0.14.*

Update the error text in the documentation as directed and fixed
formatting.
@jreback jreback added this to the 0.24.0 milestone Dec 14, 2018
Seuss27 added a commit to Seuss27/pandas that referenced this issue Dec 18, 2018


Fixed an indentation error that revealed more flake8 issues.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants