-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-32320][PYSPARK] Remove mutable default arguments #29122
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
|
Fixed the voilations: Furthermore:
|
This is bad practice, and might lead to unexpected behaviour: https://florimond.dev/blog/articles/2018/08/python-mutable-defaults-are-the-source-of-all-evil/ Add bugbear to check it in the CI
|
ok to test |
|
cc @huaxingao and @zhengruifeng FYI |
|
Kubernetes integration test starting |
|
Kubernetes integration test status failure |
|
Test build #130061 has finished for PR 29122 at commit
|
|
Kubernetes integration test starting |
|
Kubernetes integration test status success |
|
Kubernetes integration test starting |
|
Kubernetes integration test starting |
|
Test build #131539 has finished for PR 29122 at commit
|
|
Kubernetes integration test status success |
|
|
||
|
|
||
| def to_json(col, options={}): | ||
| def to_json(col, options=None): |
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.
Seems like we still have to modify a few annotations, right?
Probably something like functions.pyi.patch.txt
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.
Good catch, I've added them
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.
Not sure why implicit optional is still allowed 🤔
|
Test build #131606 has finished for PR 29122 at commit
|
|
Test build #131658 has finished for PR 29122 at commit
|
|
test this please |
### What changes were proposed in this pull request? This pull request: - Adds following flags to the main mypy configuration: - [`strict_optional`](https://mypy.readthedocs.io/en/stable/config_file.html#confval-strict_optional) - [`no_implicit_optional`](https://mypy.readthedocs.io/en/stable/config_file.html#confval-no_implicit_optional) - [`disallow_untyped_defs`](https://mypy.readthedocs.io/en/stable/config_file.html#confval-disallow_untyped_calls) These flags are enabled only for public API and disabled for tests and internal modules. Additionally, these PR fixes missing annotations. ### Why are the changes needed? Primary reason to propose this changes is to use standard configuration as used by typeshed project. This will allow us to be more strict, especially when interacting with JVM code. See for example #29122 (review) Additionally, it will allow us to detect cases where annotations have unintentionally omitted. ### Does this PR introduce _any_ user-facing change? Annotations only. ### How was this patch tested? `dev/lint-python`. Closes #30382 from zero323/SPARK-33457. Authored-by: zero323 <[email protected]> Signed-off-by: HyukjinKwon <[email protected]>
|
Test build #131701 has finished for PR 29122 at commit
|
|
Test build #131765 has finished for PR 29122 at commit
|
zhengruifeng
left a comment
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.
@Fokko please update the description of this PR.
|
@zhengruifeng done! :) |
|
Kubernetes integration test starting |
|
Test build #132225 has finished for PR 29122 at commit
|
|
Kubernetes integration test status failure |
|
Just for the record and FWIW I don't mind merging this PR. I will leave it to other committers here. |
|
retest this please |
|
Test build #132313 has finished for PR 29122 at commit
|
|
retest this please |
|
Test build #132338 has finished for PR 29122 at commit
|
|
@zhengruifeng the tests are broken globally for an unknown reason. It's being investigated at #30645 and it's hardly related to the current change. I think it's fine to merge if the test results bother you. |
|
@HyukjinKwon Thanks for your explanation! |
|
Merged to master, thanks all! |
This is bad practice, and might lead to unexpected behaviour:
https://florimond.dev/blog/articles/2018/08/python-mutable-defaults-are-the-source-of-all-evil/
What changes were proposed in this pull request?
Removing the mutable default arguments.
Why are the changes needed?
Removing the mutable default arguments, and changing the signature to
Optional[...].Does this PR introduce any user-facing change?
No 👍
How was this patch tested?
Using the Flake8 bugbear code analysis plugin.