pep8ify
pep8ify copied to clipboard
blank_lines inserts all newlines before final inline comments
I’m not entirely sure if this is a bug, but I don’t think this yields compliant code?
Versions
pep8ify/0.0.13 on Python/2.7.11
$ pep8ify -f blank_lines test.py
Input
class Foo:
def __init__(self):
bar = 13
def baz(self):
pass
class Bar:
def __init__(self):
bar = 13 # comment
def baz(self):
pass # comment
class Baz:
pass
Expected
--- test.py (original)
+++ test.py (refactored)
@@ -1,12 +1,18 @@
class Foo:
def __init__(self):
bar = 13
+
def baz(self):
pass
+
+
class Bar:
def __init__(self):
bar = 13 # comment
+
def baz(self):
pass # comment
+
+
class Baz:
pass
Actual
% pep8ify -f blank_lines pep8.py
RefactoringTool: Refactored pep8.py
--- test.py (original)
+++ test.py (refactored)
@@ -1,12 +1,18 @@
class Foo:
def __init__(self):
bar = 13
+
def baz(self):
pass
+
+
class Bar:
def __init__(self):
- bar = 13 # comment
+ bar = 13
+ # comment
def baz(self):
- pass # comment
+ pass
+
+ # comment
class Baz:
pass
RefactoringTool: Files that need to be modified:
RefactoringTool: pep8.py
Yup, definitely a bug. Thanks for reporting.
I don't have much time to spend on this project these days, but happy to accept a PR if someone else wants to dig in.