-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Question: Should I not be using Mode (FileMode)? #2256
Comments
If you're referring to the classes inside Black's source, the answer is: you should probably not be using them for formatting of any sort because their implementation (or existence) may change at any time. A public Python api is being planned in #779. It would most likely introduce a single function for formatting code as strings. |
That's a shame, but I get it. I'm generating code dynamically and have been using black to format each class as I go (I can see from 779 that I have company). I'll consider my options. Thanks for the swift reply. |
You're most welcome! Yeah let's hope that the API is introduced soon 😃 until then, I'd not expect the implementation to change drastically, but you might want to be careful as always, that's all. |
However, the public API is quite likely to look like |
It's been suggested to me that Mode (FileMode) is not for 'real world' use for formatting code fragments in memory prior to writing to a file. Besides FileMode being legacy and probably should be replaced with just Mode, is there any reason not to use it in a system where I want to format in memory?
The text was updated successfully, but these errors were encountered: