Skip to content

DOC: Remove multiple blank lines in ipython directives #41400

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 1 commit into from
May 10, 2021

Conversation

rhshadrach
Copy link
Member

@rhshadrach rhshadrach commented May 9, 2021

  • Ensure all linting tests pass, see here for how to run them

Related to #26788

This PR gets rid of all warnings of the form "UserWarning: Code input with no code at..." when building the docs. When there are multiple blank lines, e.g.

foo = 5


def bar():
    pass

one of the blank lines is reported as having no code. That said, I'm not sure if this is the right approach, as the double blank likes are PEP8 compliant. Perhaps this should be reported upstream instead and the multiple blank lines left in the docs.

cc @jorisvandenbossche @TomAugspurger

@rhshadrach rhshadrach added Docs CI Continuous Integration labels May 9, 2021
@attack68
Copy link
Contributor

attack68 commented May 9, 2021

I would argue that since *.rst documents are not code some flexibility is allowed. Especially since the examples are rather code snippets, often without context, their structure might also be unknown-context based, e.g. function separation in a class is 1-line and in a module 2-lines. Since PEPs purpose is primarily to aid readability, and readability doesn't seem to suffer here I'd favour the changes. Possibly the readability even improves and it gets rid of the warnings! 👍

@jorisvandenbossche
Copy link
Member

Originally, there was a problem with the IPython directive and using single blank lines (ipython/ipython#11362). I think that's the reason we removed any blank line around functions, and with some auto formatting that changed to 2 blank lines.

In any case, as long as it now works properly (no error in the resulting HTML), I am perfectly fine with a single blank line (I agree that for examples this is totally fine)

@jreback jreback added this to the 1.3 milestone May 10, 2021
@jreback
Copy link
Contributor

jreback commented May 10, 2021

I would argue that since *.rst documents are not code some flexibility is allowed. Especially since the examples are rather code snippets, often without context, their structure might also be unknown-context based, e.g. function separation in a class is 1-line and in a module 2-lines. Since PEPs purpose is primarily to aid readability, and readability doesn't seem to suffer here I'd favour the changes. Possibly the readability even improves and it gets rid of the warnings! 👍

sure in an ideal world. but we need to be as mechanically checked as possible. e.g. different devs can have different opinons on this (and they maybe dated, esp mine, haha).

so we ideally have a single canonical checked way of doing things.

in this case I dont' think we actually check this but maybe would be nice to.

@jreback jreback merged commit 9ab182a into pandas-dev:master May 10, 2021
@jreback
Copy link
Contributor

jreback commented May 10, 2021

thanks @rhshadrach

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI Continuous Integration Docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants