From: Ɓukasz Langa Date: Wed, 26 Sep 2018 19:18:45 +0000 (-0700) Subject: Remove whitespace at the beginning of the file X-Git-Url: https://git.madduck.net/etc/vim.git/commitdiff_plain/7145fa325c10914187d38fb157b6e2c3391f3ee0?ds=inline Remove whitespace at the beginning of the file Fixes #399 --- diff --git a/README.md b/README.md index bc684ec..2b97059 100644 --- a/README.md +++ b/README.md @@ -953,6 +953,8 @@ More details can be found in [CONTRIBUTING](CONTRIBUTING.md). * cache is now populated when `--check` is successful for a file which speeds up consecutive checks of properly formatted unmodified files (#448) +* whitespace at the beginning of the file is now removed (#399) + * fixed mangling [pweave](http://mpastell.com/pweave/) and [Spyder IDE](https://pythonhosted.org/spyder/) special comments (#532) diff --git a/black.py b/black.py index d4b3985..53d31e2 100644 --- a/black.py +++ b/black.py @@ -625,7 +625,7 @@ def format_str( `line_length` determines how many characters per line are allowed. """ - src_node = lib2to3_parse(src_contents) + src_node = lib2to3_parse(src_contents.lstrip()) dst_contents = "" future_imports = get_future_imports(src_node) is_pyi = bool(mode & FileMode.PYI)