Remove whitespace at the beginning of the file

Fixes #399
This commit is contained in:
Łukasz Langa 2018-09-26 12:18:45 -07:00
parent 649c3c7a05
commit 7145fa325c
No known key found for this signature in database
GPG Key ID: B26995E310250568
2 changed files with 3 additions and 1 deletions

View File

@ -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)

View File

@ -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)