With previous versions, it was possible to just use black.format_str(string) or black.format_str(string, line_length=82).
Now one needs to do:
black.format_str(string, mode=black.FileMode(line_length=82))
It's not a big deal in a module, but format_str was also useful in notebooks to display examples of Python code programmatically generated (for example by astunparse.unparse(tree)).
Therefore, it could be nice to support also black.format_str(string) and black.format_str(string, line_length=82).
The line_length argument is useful when one wants to get code adapted for a presentation (made with Jupyter for example).
With previous versions, it was possible to just use
black.format_str(string)orblack.format_str(string, line_length=82).Now one needs to do:
It's not a big deal in a module, but
format_strwas also useful in notebooks to display examples of Python code programmatically generated (for example byastunparse.unparse(tree)).Therefore, it could be nice to support also
black.format_str(string)andblack.format_str(string, line_length=82).The
line_lengthargument is useful when one wants to get code adapted for a presentation (made with Jupyter for example).