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: fix slashes in read_csv line_terminator/sep kwargs descriptions #13761

Merged
merged 1 commit into from
Jul 25, 2016

Conversation

shawnheide
Copy link
Contributor

Added additional '' characters in order to produce the correct format in the documentation.

@sinhrks sinhrks added the Docs label Jul 23, 2016
@sinhrks sinhrks added this to the 0.19.0 milestone Jul 23, 2016
@jorisvandenbossche
Copy link
Member

@shawnheide Could you try if using raw strings works as well? Because that way it would maybe be possible to have it look good in both the plain text docstring as the online html one.

@jreback jreback changed the title DOC: Fix 13738 DOC: read_csv line_terminator/sep and slashes Jul 23, 2016
@shawnheide
Copy link
Contributor Author

@jorisvandenbossche I hadn't thought about the docstrings before, still learning I guess. It looks like the build failed under 2.7 for some reason as well. I tried with raw docstrings and the Sphinx still converted them.

My last attempt was to use the raw docstrings and enclose the special characters ("/s+", etc.) in double back ticks, which keeps Sphinx from interpreting them. This works for the docs, but then the docstrings show the back ticks (see attached images). I searched the codebase for other examples of special characters in both the docstrings and documentation but couldn't find any. Anyone have any other ideas?

Docs:
screen shot 2016-07-24 at 11 34 25 am

Docstring:
screen shot 2016-07-24 at 11 35 47 am

@jorisvandenbossche
Copy link
Member

jorisvandenbossche commented Jul 24, 2016

And when using raw string, but without the backticks, sphinx does still interprete the backslash?
I thought it wouldn't, but if that is the case, I think this is the best solution possible (it looks good in html, and better in the docstring compared to the double backslashes

The travis failure is because we have a linter for one of the 2.7 builds. If you look at the log of the failing build, down below, there is the output of the linter:

pandas/io/parsers.py:282:80: E501 line too long (80 > 79 characters)

@shawnheide
Copy link
Contributor Author

Yes, with raw string it still interprets backslash characters, so the docs look the same as they currently do now. I found the warning box on this page helpful in understanding what's going on with Sphinx.

Thanks for explaining the build failure. I looked at the details, but must have missed seeing that explanation. I'll make sure my next commit keeps the code at less than 80 characters long.

Just to clarify, you're saying to use the version I posted images for with the raw docstrings and the backticks correct?

@jorisvandenbossche
Copy link
Member

Just to clarify, you're saying to use the version I posted images for with the raw docstrings and the backticks correct?

Yes, those look good!

Yes, with raw string it still interprets backslash characters, so the docs look the same as they currently do now. I found the warning box on this page helpful in understanding what's going on with Sphinx.

My interpretation is that the raw string ensures that sphinx sees the backslash, but that sphinx also uses the backslash itself to escape characters it uses (eg * for bold), so in this way to show a backslash in sphinx, you still need two of them in the raw string (or four in the python string), or put it in a literal code block, like you proposed now.

@codecov-io
Copy link

codecov-io commented Jul 24, 2016

Current coverage is 85.31% (diff: 100%)

Merging #13761 into master will decrease coverage by <.01%

@@             master     #13761   diff @@
==========================================
  Files           141        141          
  Lines         50679      50679          
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
- Hits          43240      43239     -1   
- Misses         7439       7440     +1   
  Partials          0          0          

Powered by Codecov. Last update 474fd05...bc320dd

…, and to_csv in ordert to produce correct docs and docstrings
@jorisvandenbossche jorisvandenbossche changed the title DOC: read_csv line_terminator/sep and slashes DOC: fix slashes in read_csv line_terminator/sep kwargs descriptions Jul 25, 2016
@jorisvandenbossche jorisvandenbossche merged commit 4dd734c into pandas-dev:master Jul 25, 2016
@jorisvandenbossche
Copy link
Member

jorisvandenbossche commented Jul 25, 2016

@shawnheide Thanks a lot!
Really nice to have some doc contributions!

@shawnheide shawnheide deleted the fix_13738 branch July 25, 2016 21:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Too many backslashes stripped in documentation generation
4 participants