Skip to content

Check copies blackify#10775

Merged
LysandreJik merged 6 commits intomasterfrom
check_copies_blackify
Mar 17, 2021
Merged

Check copies blackify#10775
LysandreJik merged 6 commits intomasterfrom
check_copies_blackify

Conversation

@sgugger
Copy link
Collaborator

@sgugger sgugger commented Mar 17, 2021

What does this PR do?

This PR update the check_copies utils to apply black when checking if a copy has diverged from the original when replacement happen. An example of the problem is given with the diff in modeling_mobilebert.py here, where the check copies could not be applied to whole class because of styling divergences.

It also fixes a bug where the check was not applied on functions after the end of the definition (it wasn't checking the function but was stopping at the first unindent when the closing parenthesis was). As a consequence, three files are changed because they diverged from the original function:

  • modeling_m2m_100.py
  • modeling_roberta.py
  • modeling_speech_to_text.py

I'm not sure if the check should be removed on those or not (cc @patil-suraj )

@sgugger sgugger requested a review from LysandreJik March 17, 2021 16:59
Copy link
Member

@LysandreJik LysandreJik left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for taking care of it!

@LysandreJik LysandreJik merged commit 40b049c into master Mar 17, 2021
@LysandreJik LysandreJik deleted the check_copies_blackify branch March 17, 2021 22:11
Iwontbecreative pushed a commit to Iwontbecreative/transformers that referenced this pull request Jul 15, 2021
* Apply black before checking copies

* Fix for class methods

* Deal with lonely brackets

* Remove debug and add forward changes

* Separate copies and fix test

* Add black as a test dependency
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.

2 participants