-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Black bindings #6951
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
Black bindings #6951
Conversation
These are treated as warnings by extract_pyi, so they don't stop the build process.
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 is a good idea, since it canonicalizes the documentation.
One thing I do not understand is the removal of blank lines. Are you running black on the entire extraction of //|
lines in each .c
file?
Here's a typical set of changes, where blank lines between the def
s are removed. This is not what black would do if they were all in one file:
Running black manually on an extract of SleepMemory.c:
class SleepMemory:
def __init__(self) -> None:
"""Not used. Access the sole instance through `alarm.sleep_memory`."""
...
def __bool__(self) -> bool:
"""``sleep_memory`` is ``True`` if its length is greater than zero.
This is an easy way to check for its existence.
"""
...
def __len__(self) -> int:
"""Return the length. This is used by (`len`)"""
...
It ensures there are blank lines between the defs.
From @jepler in discord:
|
c2b2096
to
bc9a65d
Compare
I run each 'section' through black, so black has no section-to-section memory to draw on. After Dan's earlier comment I revised the script so that it includes a blank "//|" at the end of each block of "//|". This reduces the churn somewhat, in raw lines of code. Here are the differences to the generated stubs from this branch:
|
bc9a65d
to
0cc47ab
Compare
I revised this further, based on discord discussions:
|
Since black_bindings.py will pass each contiguous "//|"-block to black independently, they must each be a fully formed Python item.
0cc47ab
to
3a0d237
Compare
.. updated again to ditch the trailing blank 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.
Nitpicking done ;) - thanks for this cleanup!
As an alternative to #6950 arrange to run black on each "//|" stubs block within bindings and shared-bindings, so that the formatting is made consistent at every commit.
Reasons not to do this right now: It churns a LOT and I was not attentive enough to review everything.