Skip to content

Conversation

@jroesch
Copy link
Member

@jroesch jroesch commented Sep 10, 2020

@jroesch
Copy link
Member Author

jroesch commented Sep 10, 2020

@junrushao
Copy link
Member

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?

Copy link
Contributor

@comaniac comaniac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

exit 0
fi

echo "Running git-black against" $1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
echo "Running git-black against" $1
echo "Running git-black on Python files against" $1

Copy link
Contributor

@areusch areusch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 to splitting the review into a scripts part and a format part.

@jroesch
Copy link
Member Author

jroesch commented Sep 10, 2020

@areusch @tqchen @comaniac I can rollback the formatting, the first 3 or 4 commits were focused on formatting then I went through the process to see if it would actually work.

@jroesch jroesch changed the title [RFC][Formatting] Apply black to entire Python code base. [RFC][Formatting] Add scripts for applying Black to the Python code. Sep 10, 2020
@jroesch
Copy link
Member Author

jroesch commented Sep 10, 2020

@junrushao1994 @comaniac @areusch I just added the scripts and cleaned some things up, take another pass if you can

Copy link
Contributor

@comaniac comaniac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Just some nits. Thanks!

@jroesch
Copy link
Member Author

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
Copy link
Member Author

jroesch commented Sep 11, 2020

This is blocked on #6448 and #6451, once we land those two it should be possible to add the checking to the CI, format once more and land this.

pyproject.toml Outdated
| 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you break these line by line and sort?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how come we need this?

The dictionary of compile-time info.
"""
return {k: v for k, v in GetLibInfo().items()} # pylint: disable=unnecessary-comprehension
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same question here--do we need to update pylint?

max_output_range,
out_dtype):
"""Get the MKLDNN requantized scale."""
quantized_out_range = (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's up with this line?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are a bunch of random edits that made the results of black happier.

fi

echo "Running black in checking mode"
black --diff --check
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you either want --diff and assert on an empty output or --check, I don't know what both do?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@jroesch
Copy link
Member Author

jroesch commented Sep 11, 2020

I think I addressed all the comments, and bumped the CI.

@junrushao
Copy link
Member

There is some flakiness in the CI. Please retrigger and let's merge it in

@tqchen tqchen merged commit cdd3206 into apache:master Sep 13, 2020
@jroesch jroesch deleted the blackd branch February 4, 2021 04:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants