Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

auto pep8 format with black #73

Merged
merged 2 commits into from
Apr 24, 2024
Merged

Conversation

shimwell
Copy link
Collaborator

@shimwell shimwell commented Apr 23, 2024

I ran the black formatter on the code and looks like we have a few places where the formatting could be changed to comply with pep8.

the main changes are white space and indentation

This was done with the default settings for black

pip install black
black .

Copy link
Member

Choose a reason for hiding this comment

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

what happens when we are not agree with the PEP8 standard?
imagen

How can I preserve the matrix structure, since I think it is more readable than the PEP8 format

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks both. I've added the fmt: off to protect this matrix function.

Copy link
Member

Choose a reason for hiding this comment

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

Same question.
From me my format is more reablable than PEP8 standard.
imagen

Copy link
Member

Choose a reason for hiding this comment

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

You can protect the code snippets where you want to preserve structure by using the comment # fmt: off

# fmt: off
np.array(
    [
        [1, 0, 0, 0],
        [0, -1, 0, 0],
        [0, 0, 1, 0],
        [0, 0, 0, -1],
    ]
)
# fmt: on

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think the main point of black is not really if we like the layout or not. It is to have a single layout that we all use. As our own preferences are sometimes subjective and there can be endless disagreement between layouts preference. Black is uncompromising and not very flexible to remove the time spent by developers who all have a different preference on a layout. Sometimes the formatting changes are hints that the code could be done in a different way from the start. I personally don't like the way black formats things but I love it that I never have to think about formatting again

@AlvaroCubi AlvaroCubi merged commit 4918114 into GEOUNED-org:dev Apr 24, 2024
6 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants