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
Add black formatter #3531
Add black formatter #3531
Conversation
looks like it's all Python changes. what review do you want? |
Adding formatter is a project-level change. I want to be sure that you are aware of it. |
name="SPY_CATEGORY", | ||
graphic="spy.png", | ||
colour=(168, 0, 255, 255)) | ||
Category(name="LEARNING_CATEGORY", graphic="learning.png", colour=(54, 202, 229)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this was more readable before the reformat
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line fits in one line (120) so it is inlined.
This is the disadvantage of such tools. They are better only for 90% of cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went to docs to answer other questions and found that this could be fixed.
I will fix it tomorrow.
@@ -5,7 +5,8 @@ | |||
type=float, | |||
default=1.0, | |||
min=0.1, | |||
max=10.0) | |||
max=10.0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm surprised this (,
with nothing after before the )
) isn't a format error in Python...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing comma is ok for function calls and list literals. For tuples with a single element, it is mandatory.
(1) == 1 # True
(1, ) == (1, ) # True
I find this feature very useful, since it reduce diff when adding new argument/element.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it reduce diff when adding new argument/element.
You mean just when the params are on separate lines?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On separate lines with coma:
- a
+ a,
+ b
+ b,
@@ -141,18 +147,17 @@ def update_stdafx_h(stdafx_h_filename, header_only_vcxproj_files, vcxproj_files) | |||
|
|||
lines.append(include_directive) | |||
|
|||
with open(stdafx_h_filename, 'w') as f: | |||
with open(stdafx_h_filename, "w") as f: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is "
preferred over '
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to use the same style evrythere.
https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html#strings
9593315
to
bd82014
Compare
@geoffthemedio, I think I have addressed all your comments. I plan to merge it at a weekend. |
Add black formatter and reformat some files.
I use black for my personal projects, on my previous job, and when working with students. I am really happy with it.
Not the best style, but zero effort for support and config it.
This is the first part, I just added all required configs and reformated all python files outside the default diectory.