GitHub user ashashwat opened a pull request:
https://github.com/apache/spark/pull/20497
[MINOR][DOC] Use raw triple double quotes around docstrings where there are
occurrences of backslashes.
From [PEP 257](https://www.python.org/dev/peps/pep-0257/):
> For consistency, always use """triple double quotes""" around docstrings.
Use r"""raw triple double quotes""" if you use any backslashes in your
docstrings. For Unicode docstrings, use u"""Unicode triple-quoted strings""".
For example, this is what help (kafka_wordcount) shows:
```
DESCRIPTION
Counts words in UTF8 encoded, '
' delimited text received from the network every second.
Usage: kafka_wordcount.py <zk> <topic>
To run this on your local machine, you need to setup Kafka and create
a producer first, see
http://kafka.apache.org/documentation.html#quickstart
and then run the example
`$ bin/spark-submit --jars
external/kafka-assembly/target/scala-*/spark-streaming-kafka-assembly-*.jar
examples/src/main/python/streaming/kafka_wordcount.py localhost:2181
test`
```
This is what it shows, after the fix:
```
DESCRIPTION
Counts words in UTF8 encoded, '\n' delimited text received from the
network every second.
Usage: kafka_wordcount.py <zk> <topic>
To run this on your local machine, you need to setup Kafka and create a
producer first, see
http://kafka.apache.org/documentation.html#quickstart
and then run the example
`$ bin/spark-submit --jars \
external/kafka-assembly/target/scala-*/spark-streaming-kafka-assembly-*.jar \
examples/src/main/python/streaming/kafka_wordcount.py \
localhost:2181 test`
```
The thing worth noticing is no linebreak here in the help.
## What changes were proposed in this pull request?
Change triple double quotes to raw triple double quotes when there are
occurrences of backslashes in docstrings.
## How was this patch tested?
Manually as this is a doc fix.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/ashashwat/spark docstring-fixes
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/20497.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #20497
----
commit 78b1de3fab8d2bd8256fbbde7b45c230432946a8
Author: Shashwat Anand <me@...>
Date: 2018-02-03T10:27:25Z
Use raw triple double quotes around doctrings to escape backslashes.
From PEP 257:
For consistency, always use """triple double quotes""" around docstrings.
Use r"""raw triple double quotes""" if you use any backslashes in your
docstrings. For Unicode docstrings, use u"""Unicode triple-quoted strings""".
For example this is what help (kafka_wordcount) shows:
NAME
kafka_wordcount
FILE
/Users/shashwatanand/Repositories/spark/examples/src/main/python/streaming/kafka_wordcount.py
DESCRIPTION
Counts words in UTF8 encoded, '
' delimited text received from the network every second.
Usage: kafka_wordcount.py <zk> <topic>
To run this on your local machine, you need to setup Kafka and create
a producer first, see
http://kafka.apache.org/documentation.html#quickstart
and then run the example
`$ bin/spark-submit --jars
external/kafka-assembly/target/scala-*/spark-streaming-kafka-assembly-*.jar
examples/src/main/python/streaming/kafka_wordcount.py localhost:2181
test`
This is what it shows, after the fix:
NAME
kafka_wordcount
FILE
/Users/shashwatanand/Repositories/Codes/spark/examples/src/main/python/streaming/kafka_wordcount.py
DESCRIPTION
Counts words in UTF8 encoded, '\n' delimited text received from the
network every second.
Usage: kafka_wordcount.py <zk> <topic>
To run this on your local machine, you need to setup Kafka and create a
producer first, see
http://kafka.apache.org/documentation.html#quickstart
and then run the example
`$ bin/spark-submit --jars \
external/kafka-assembly/target/scala-*/spark-streaming-kafka-assembly-*.jar \
examples/src/main/python/streaming/kafka_wordcount.py \
localhost:2181 test`
Notice no linebreak here in the help.
----
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]