From 7145fa325c10914187d38fb157b6e2c3391f3ee0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C5=81ukasz=20Langa?= Date: Wed, 26 Sep 2018 12:18:45 -0700 Subject: [PATCH] Remove whitespace at the beginning of the file Fixes #399 --- README.md | 2 ++ black.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) 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) -- 2.39.5