-
Notifications
You must be signed in to change notification settings - Fork 518
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
Replace len()
Zero Checks with Pythonic Empty Sequence Checks
#4298
base: master
Are you sure you want to change the base?
Conversation
@cblmemo PTAL, thanks! |
Please refer to the style guide: https://google.github.io/styleguide/pyguide.html#214-truefalse-evaluations |
@Michaelvll Precisely. As mentioned, this modification was just made based on the Google Python Style Guide. Please refer to: https://google.github.io/styleguide/pyguide.html#2144-decision. |
@Michaelvll By the way, when you have a moment, could you take a look at #4250 ? Thanks a lot! |
Ahh, thanks for fixing these! I misread the message. Looks pretty good at the first glance. cc'ing @cblmemo to take a closer look. : ) |
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.
Thanks for refactoring this @andylizf ! Mostly looks good to me. Left some discussions.
Also, pls run smoke test to make sure it does not break anything ;) (reminder: Pls run the smoke tests on GCP. to do so, you can temporarily disable aws on your laptop.
Replace len() comparisons with 0/1 with pythonic empty sequence checks, following Google Python Style Guide's recommendation:
Also fixed some typing annotations along the way.
Tested (run the relevant ones):
bash format.sh
pytest tests/test_smoke.py
pytest tests/test_smoke.py::test_fill_in_the_name
conda deactivate; bash -i tests/backward_compatibility_tests.sh