summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy Crosley <timothy.crosley@gmail.com>2019-05-12 16:14:32 -0700
committerTimothy Crosley <timothy.crosley@gmail.com>2019-05-12 16:14:32 -0700
commitdb1f1d6275b3c12c9fcc5a6276c5da1dfc4aca87 (patch)
tree27af16e24d263af22738a36fa839fad603070b54
parent2327a2d846884505702e782fa4a52713d1312d3d (diff)
downloadisort-db1f1d6275b3c12c9fcc5a6276c5da1dfc4aca87.tar.gz
Implement native support for pyi files
-rw-r--r--isort/isort.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/isort/isort.py b/isort/isort.py
index aa4af591..a91abed3 100644
--- a/isort/isort.py
+++ b/isort/isort.py
@@ -677,8 +677,10 @@ class SortImports(object):
if self.config['lines_after_imports'] != -1:
self.out_lines[imports_tail:0] = ["" for line in range(self.config['lines_after_imports'])]
- elif next_construct.startswith("def ") or next_construct.startswith("class ") or \
- next_construct.startswith("@") or next_construct.startswith("async def"):
+ elif self.extension != "pyi" and (next_construct.startswith("def ") or
+ next_construct.startswith("class ") or
+ next_construct.startswith("@") or
+ next_construct.startswith("async def")):
self.out_lines[imports_tail:0] = ["", ""]
else:
self.out_lines[imports_tail:0] = [""]