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

Apply black to the ml package. #196

Merged
merged 4 commits into from
Sep 27, 2023
Merged

Conversation

yakutovicha
Copy link
Collaborator

No description provided.

@NikoOinonen
Copy link
Collaborator

How should we do this? Should we add our own commits to fix the things we have issues with, or mark them here on Github and @yakutovicha applies the fixes?

@yakutovicha
Copy link
Collaborator Author

yakutovicha commented Aug 30, 2023

How should we do this?

you can just mark the places you don't like and I will disable formatting for them

@NikoOinonen
Copy link
Collaborator

Many of the changes seem to be due to too long lines. For some of these I would not disable the formatting, but rewrite the line in another way. I guess we can use the code suggestion feature in the comments for those.

@yakutovicha
Copy link
Collaborator Author

I guess we can use the code suggestion feature in the comments for those.

Do you mean the disabled flake8?

@yakutovicha
Copy link
Collaborator Author

yakutovicha commented Aug 30, 2023

Of course, the alternative is to increase the line width to 120 characters. This we can also do. But eventually, we will still hit the "long lines problem".

@NikoOinonen
Copy link
Collaborator

Of course, the alternative is to increase the line width to 120 characters. This we can also do. But eventually, we will still hit the "long lines problem".

Actually, I thought it would be 120. I would put it at least that high. Most screens can hold 150+ chars in half a screen these days (of course it becomes hard to read at some point anyways).

Do you mean the disabled flake8?

No, I meant just in the Github review comment you can suggest a code commit.

@yakutovicha
Copy link
Collaborator Author

Actually, I thought it would be 120. I would put it at least that high.

Done, 120 is now the default. See 2c06483 for the effect.

No, I meant just in the Github review comment you can suggest a code commit.

Sure, that is fine with me too.

@ProkopHapala
Copy link
Collaborator

would put it at least that high. Most screens can hold 150+ chars in half a screen these days (of course it becomes hard to read at some point anyway

Automatic breaking of long lines is some feature I would perhaps switch of completely.

If you don't want to switch it of I would increase the limit very much (180 e.g. ?). I agree screen today are large enough. And I also prefer horizontal scrolling rather than having broken lines which perturb the code flow (it visually disturbs a lot when you are trying to see big-picture i.e. overall structure of the code)

@ProkopHapala
Copy link
Collaborator

Can we disabled line length checking in order to better see what other changes to the code it does?

when I was trying to review it there were so much line-length related changes I was unable to see almost anything else.

Copy link
Collaborator

@NikoOinonen NikoOinonen left a comment

Choose a reason for hiding this comment

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

Just a few things stand out to me. Maybe Prokop has more to say about the aligned equals signs in his Corrector code.

@NikoOinonen
Copy link
Collaborator

If you don't want to switch it of I would increase the limit very much (180 e.g. ?). I agree screen today are large enough. And I also prefer horizontal scrolling rather than having broken lines which perturb the code flow (it visually disturbs a lot when you are trying to see big-picture i.e. overall structure of the code)

I guess it's a preference thing. I don't really like horizontal scrolling that much, and very long lines can make the cursor jump a lot when navigating by keyboard. I mostly threw the 150 figure because that's about as much text as fits on screen when I code, usually in half screen or a vertically mounted screen. Mostly I wanted to say that the default 80 is way too low for modern equipment.

@yakutovicha
Copy link
Collaborator Author

Can we find a compromise about the line length? I am fine to make it 150 or whatever. But I agree with Nico that horizontal scrolling is not the best.

Maybe, if the line is that long, it probably calls for an actual code rewriting.

@ProkopHapala would 150 characters be acceptable for you?

@ProkopHapala
Copy link
Collaborator

Can we find a compromise about the line length? I am fine to make it 150 or whatever. But I agree with Nico that horizontal scrolling is not the best.

I understand you don't like horizontal scrolling, but usually you don't really need to see all arguments to the function when you read the code.

Also how long lines you have in your editor? Don't say you don't fit 180 characters on your screen.

@ProkopHapala would 150 characters be acceptable for you?

why not 180?

Maybe, if the line is that long, it probably calls for an actual code rewriting.

That is exactly why I'm hesitating to use black. I don't want to end up rewriting (re-desiging) the code just to satisfy automatic formater.

@yakutovicha
Copy link
Collaborator Author

Also how long lines you have in your editor?

Here are my screenshots. If I have one file open, then it is 263 characters:

image

When I put two files side by side (which I often do), then it is 119:

image

If I slightly decrease the font, it becomes 146:

image

Don't say you don't fit 180 characters on your screen.

I am not sure why would I say that.

why not 180?

See the numbers above. But if 180 is what you absolutely need, I am fine with 180.

@NikoOinonen
Copy link
Collaborator

180 is maybe bit on the high side, but it's fine with me.

@yakutovicha
Copy link
Collaborator Author

@ProkopHapala, we are waiting for your decision. We are OK with both: 150 or 180. Please let us know the number so I can continue with the work.

@ProkopHapala
Copy link
Collaborator

@ProkopHapala, we are waiting for your decision. We are OK with both: 150 or 180. Please let us know the number so I can continue with the work.

Aha, OK, sorry. So 180

@yakutovicha
Copy link
Collaborator Author

@ProkopHapala, we are waiting for your decision. We are OK with both: 150 or 180. Please let us know the number so I can continue with the work.

Aha, OK, sorry. So 180

done ✅

@yakutovicha
Copy link
Collaborator Author

@NikoOinonen I applied the requested changes, please re-review.

Copy link
Collaborator

@NikoOinonen NikoOinonen left a comment

Choose a reason for hiding this comment

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

Looks fine to me now.

@yakutovicha yakutovicha merged commit 4e04d47 into main Sep 27, 2023
@yakutovicha yakutovicha deleted the chore/apply-black-to-ml-module branch September 27, 2023 12:19
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.

3 participants