Uh oh!
There was an error while loading. Please reload this page.
[SPARK-32320][PYSPARK] Remove mutable default arguments - #29122
Conversation
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Fokko
commented
Oct 20, 2020
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
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
HyukjinKwon
commented
Oct 21, 2020
ok to test |
HyukjinKwon
commented
Oct 21, 2020
cc @huaxingao and @zhengruifeng FYI |
SparkQA
commented
Oct 21, 2020
Kubernetes integration test starting |
SparkQA
commented
Oct 21, 2020
Kubernetes integration test status failure |
SparkQA
commented
Oct 21, 2020
Test build #130061 has finished for PR 29122 at commit
|
SparkQA
commented
Oct 21, 2020
Kubernetes integration test starting |
SparkQA
commented
Oct 21, 2020
Kubernetes integration test status success |
SparkQA
commented
Oct 21, 2020
Kubernetes integration test starting |
SparkQA
commented
Nov 23, 2020
Test build #131539 has finished for PR 29122 at commit
|
SparkQA
commented
Nov 23, 2020
Kubernetes integration test status success |
| def to_json(col, options={}): | ||
| def to_json(col, options=None): |
There was a problem hiding this comment.
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.
Good catch, I've added them
There was a problem hiding this comment.
Not sure why implicit optional is still allowed 🤔
SparkQA
commented
Nov 24, 2020
Test build #131606 has finished for PR 29122 at commit
|
SparkQA
commented
Nov 24, 2020
Test build #131658 has finished for PR 29122 at commit
|
shaneknapp
commented
Nov 24, 2020
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 <mszymkiewicz@gmail.com> Signed-off-by: HyukjinKwon <gurwls223@apache.org>
SparkQA
commented
Nov 25, 2020
Test build #131701 has finished for PR 29122 at commit
|
SparkQA
commented
Nov 25, 2020
Test build #131765 has finished for PR 29122 at commit
|
zhengruifeng
left a comment
There was a problem hiding this comment.
@Fokko please update the description of this PR.
Fokko
commented
Dec 4, 2020
@zhengruifeng done! :) |
SparkQA
commented
Dec 4, 2020
Kubernetes integration test starting |
SparkQA
commented
Dec 4, 2020
Test build #132225 has finished for PR 29122 at commit
|
SparkQA
commented
Dec 4, 2020
Kubernetes integration test status failure |
HyukjinKwon
commented
Dec 6, 2020
Just for the record and FWIW I don't mind merging this PR. I will leave it to other committers here. |
zhengruifeng
commented
Dec 7, 2020
retest this please |
SparkQA
commented
Dec 7, 2020
Test build #132313 has finished for PR 29122 at commit
|
zhengruifeng
commented
Dec 7, 2020
retest this please |
SparkQA
commented
Dec 7, 2020
Test build #132338 has finished for PR 29122 at commit
|
HyukjinKwon
commented
Dec 7, 2020
@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. |
zhengruifeng
commented
Dec 8, 2020
@HyukjinKwon Thanks for your explanation! |
zhengruifeng
commented
Dec 8, 2020
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.