Skip to content
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

MAINT Enable and run black on examples #20502

Merged
merged 2 commits into from
Oct 7, 2021

Conversation

thomasjpfan
Copy link
Member

@thomasjpfan thomasjpfan commented Jul 10, 2021

This PR is to see what the examples look like by running black. I went through a random selection of the examples and I think I am okay with the result. Some function calls are a little more vertical, but I think that is okay?

I have seen @glemaitre do this for his examples PR and I am a little more convinced that running black on examples is readable.

Comment on lines +215 to +230
plt.scatter(
species.pts_train["dd long"],
species.pts_train["dd lat"],
s=2 ** 2,
c="black",
marker="^",
label="train",
)
plt.scatter(
species.pts_test["dd long"],
species.pts_test["dd lat"],
s=2 ** 2,
c="black",
marker="x",
label="test",
)
Copy link
Member Author

Choose a reason for hiding this comment

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

This is an example of code that became more "vertical".

@glemaitre
Copy link
Member

Just a side note: I am using pre-commit and configure as mentioned in our documentation and it will format the example as well.

@ogrisel
Copy link
Member

ogrisel commented Jul 12, 2021

I like the consistency of using black everywhere as long as it allows to keep import statements in non-top code cells on notebook-style examples. Indeed I prefer importing modules the first time they are needed in such tutorial style examples. Fortunately this is fine with black.

@ogrisel
Copy link
Member

ogrisel commented Jul 12, 2021

Before considering merging this, we should wait for the 88 vs 79 vote.

@thomasjpfan
Copy link
Member Author

Now that the vote is done, I rebased and updated this PR with another black run.

Copy link
Member

@glemaitre glemaitre left a comment

Choose a reason for hiding this comment

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

LGTM from my side.

Copy link
Member

@jjerphan jjerphan 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 @thomasjpfan.

I personally "vertical code" relevant because it makes the code both easier to read (parameter lists are presented as list) and to maintain as changes on a line have a finer/atomic semantic precision/granularity.

@ogrisel ogrisel merged commit 70a185a into scikit-learn:main Oct 7, 2021
@ogrisel
Copy link
Member

ogrisel commented Oct 7, 2021

Merged!

jjerphan pushed a commit to jjerphan/scikit-learn that referenced this pull request Oct 8, 2021
@glemaitre glemaitre mentioned this pull request Oct 23, 2021
10 tasks
glemaitre pushed a commit to glemaitre/scikit-learn that referenced this pull request Oct 23, 2021
samronsin pushed a commit to samronsin/scikit-learn that referenced this pull request Nov 30, 2021
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.

None yet

4 participants