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

Use black formatter by default #1452

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

lucatrv
Copy link

@lucatrv lucatrv commented Aug 30, 2019

@jcb91
Copy link
Member

jcb91 commented Sep 7, 2019

Although I like this idea, it looks like the black API has changed recently, so this doesn't always work. On my current installation (black 19.3b0), this throws

TypeError: format_str() takes 1 positional argument but 2 were given

while the method signature appears to expect a filemode dataclass object (see
https://github.com/psf/black/blob/19.3b0/black.py#L664). It looks like your version would have worked with the previous API from 18.9b0 (see https://github.com/psf/black/blob/18.9b0/black.py#L621-L623). I guess this is what we get for black still being "beta". A small try/except could probably cover both versions?

Thanks for the PR, btw 👍

@lucatrv
Copy link
Author

lucatrv commented Sep 7, 2019

That's strange, it's working on me with black 19.3b0. I'm on Windows 7, with Miniconda on "conda-forge" channel.

@jcb91
Copy link
Member

jcb91 commented Sep 8, 2019

Hmm, curiouser & curiouser. I'm on macOs, using 19.3b0 from PyPi. I'll try to give it a shot on windows at some point. Alternatively, perhaps it would be worth adding python tests for these snippets...

@shunkakinoki
Copy link

Really great idea!

@lucatrv
Copy link
Author

lucatrv commented Feb 1, 2020

Now it works with the new Black API.

@inarighas
Copy link

Thanks for this PR. Is it ready to be merged ?

@lucatrv
Copy link
Author

lucatrv commented Sep 27, 2023

I think it has been for a while already...

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.

4 participants