Uh oh!
There was an error while loading. Please reload this page.
[RFC][Formatting] Add scripts for applying Black to the Python code. - #6437
Conversation
jroesch
commented
Sep 10, 2020
junrushao
commented
Sep 10, 2020
It is a bit hard to review 1000 files...maybe just take a look at the pyproject.toml file and assume other parts are correct? |
comaniac
left a comment
There was a problem hiding this comment.
Tried to review the first 3 commits because I cannot even open the changes after the formatting commit...
I'd suggest separating two 2 PRs. The first one focuses on the scripts and CI flow (but disable the checking to pass the CI). The second one then formats all Python codes. In this way, as long as the second PR passes the CI we should be be good.
Uh oh!
There was an error while loading. Please reload this page.
| exit 0 | ||
| fi | ||
| echo "Running git-black against" $1 |
There was a problem hiding this comment.
| echo"Running git-black against"$1 | |
| echo"Running git-black on Python files against"$1 |
Uh oh!
There was an error while loading. Please reload this page.
areusch
left a comment
There was a problem hiding this comment.
+1 to splitting the review into a scripts part and a format part.
Uh oh!
There was an error while loading. Please reload this page.
jroesch
commented
Sep 10, 2020
jroesch
commented
Sep 10, 2020
@junrushao1994@comaniac@areusch I just added the scripts and cleaned some things up, take another pass if you can |
comaniac
left a comment
There was a problem hiding this comment.
LGTM. Just some nits. Thanks!
Uh oh!
There was an error while loading. Please reload this page.
jroesch
commented
Sep 11, 2020
@tqchen recommended that we first format the entire code base using these settings then try to land the CI parts, going to open a second PR with the fully formatted repo. |
jroesch
commented
Sep 11, 2020
Uh oh!
There was an error while loading. Please reload this page.
| | tests\/ | ||
| | vta\/ | ||
| | web\/ | ||
| )/|tests/lint/add_asf_header.py|tests/lint/check_file_type.py|python/tvm/topi/testing/pool3d_python.py|python/topi/python/test_topi_pooling.py |
There was a problem hiding this comment.
can you break these line by line and sort?
There was a problem hiding this comment.
These two files actually trigger an internal error with black and I was going to open up a follow up issue to fix these.
| # under the License. | ||
| '''Utility for Hexagon backend''' | ||
| # pylint: disable=invalid-name |
| The dictionary of compile-time info. | ||
| """ | ||
| return {k: v for k, v in GetLibInfo().items()} # pylint: disable=unnecessary-comprehension | ||
| } |
There was a problem hiding this comment.
there are a lot of these extra closing braces or insertions that look like function_call( with no close ) added. merge mistake? seems like nothing can possibly pass til they're deleted...
| from .util import _internal_assert | ||
| # pylint: disable=redefined-builtin | ||
| # pylint: disable=redefined-builtin,invalid-name |
There was a problem hiding this comment.
same question here--do we need to update pylint?
| max_output_range, | ||
| out_dtype): | ||
| """Get the MKLDNN requantized scale.""" | ||
| quantized_out_range = ( |
There was a problem hiding this comment.
These are a bunch of random edits that made the results of black happier.
| fi | ||
| echo "Running black in checking mode" | ||
| black --diff --check |
There was a problem hiding this comment.
I think you either want --diff and assert on an empty output or --check, I don't know what both do?
There was a problem hiding this comment.
I think diff and check at same time give that behavior if I understand correctly, check makes it return a -1 status code which should fail this entire script.
Uh oh!
There was an error while loading. Please reload this page.
jroesch
commented
Sep 11, 2020
I think I addressed all the comments, and bumped the CI. |
junrushao
commented
Sep 12, 2020
There is some flakiness in the CI. Please retrigger and let's merge it in |
As per the recent RFC https://discuss.tvm.apache.org/t/rfc-introduce-automatic-formatting-of-python-code/7843/10.