-
Notifications
You must be signed in to change notification settings - Fork 29k
[MINOR][DOCS] Fix minor typos in python example code #14805
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
Conversation
|
OK, can you perhaps quickly search for other instances of the same in Python code? it's worth a skim if you're up for it. |
|
Jenkins test this please |
|
Test build #64414 has finished for PR 14805 at commit
|
|
I looked through all the python code examples, fixed typos and formatting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I think it's good to standardize strings on double quotes, unless I'm missing some important difference. There are some other good clear fixes here. The whitespace changes are probably not worth it but I'd leave them in. What about this though, is it really more standard not to precede the continuation with a space?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@srowen, there is no clear definition of it.
https://docs.python.org/2/reference/lexical_analysis.html#explicit-line-joining
https://www.python.org/dev/peps/pep-0008/#maximum-line-length
I use:
# with space
if 1900 < year < 2100 and 1 <= month <= 12:
return 1
if 1900 < year < 2100 \
and 1 <= month <= 12:
return 1
# without space
s = 'Hello world'.lower().split()
s = 'Hello world'.lower()\
.split()This makes the code more readable. Or return to the code spaces?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using simple or double quote have impact on Python, it's up to the developer's will.
Adding a space before the '' makes sense, even though I prefere the following syntax for RDD filters:
socketDF = (spark
.readStream()
.format("socket")
.option("host", "localhost")
.option("port", 9999)
.load())
|
@stibbons since you're around, do you have any comments on these Python style changes? |
|
Look good to me. I think it good to have the space arround kwargs assignation removed to distinguish beween and which is a good habit to take (and PEP8) |
|
For information, autopep8 will do all the space changes automatically on python files, and we can ask sphinx to automatically pep8 (check) autopep8 (fix some pep issues) all python codes |
|
I returned the spaces (in all python examples) |
|
OK, it's looking good to me. I wouldn't mind a set of eyes more familiar with Python to look at it. In particular just want to make sure we're headed towards more standardization in all cases. |
|
Jenkins retest this please |
|
Test build #64564 has finished for PR 14805 at commit
|
|
Merged to master |
What changes were proposed in this pull request?
Fix minor typos python example code in streaming programming guide
How was this patch tested?
N/A