From 1c6ef197a426232a4ed2f368c3e7f15a592200b5 Mon Sep 17 00:00:00 2001 From: Hideo Hattori Date: Mon, 10 Jun 2019 23:49:15 +0900 Subject: [PATCH 1/7] set development version --- autopep8.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autopep8.py b/autopep8.py index 42727cac..01b90d61 100755 --- a/autopep8.py +++ b/autopep8.py @@ -68,7 +68,7 @@ class documentation for more information. unicode = str -__version__ = '1.4.4' +__version__ = '1.5a1' CR = '\r' From 4f8a7c72d75abca72dc23b683e9145146a6878e7 Mon Sep 17 00:00:00 2001 From: Hideo Hattori Date: Mon, 10 Jun 2019 23:50:11 +0900 Subject: [PATCH 2/7] add E117 fixed method --- autopep8.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/autopep8.py b/autopep8.py index 01b90d61..25a426d2 100755 --- a/autopep8.py +++ b/autopep8.py @@ -645,6 +645,16 @@ def fix_e116(self, result): self.source[line_index] = indent[1:] + stripped + def fix_e117(self, result): + """Fix over-indented.""" + line_index = result['line'] - 1 + target = self.source[line_index] + + indent = _get_indentation(target) + stripped = target.lstrip() + + self.source[line_index] = indent[1:] + stripped + def fix_e125(self, result): """Fix indentation undistinguish from the next logical line.""" num_indent_spaces = int(result['info'].split()[1]) From a1fd78c11852863bbe5965a380dce03f8ab52ebb Mon Sep 17 00:00:00 2001 From: Hideo Hattori Date: Mon, 10 Jun 2019 23:50:23 +0900 Subject: [PATCH 3/7] add unit test for e117 fixed method --- test/test_autopep8.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/test_autopep8.py b/test/test_autopep8.py index d3203ba5..b325eb77 100755 --- a/test/test_autopep8.py +++ b/test/test_autopep8.py @@ -1225,6 +1225,22 @@ def test_e116(self): fixed = """\ a = 1 # b = 2 +""" + with autopep8_context(line) as result: + self.assertEqual(fixed, result) + + def test_e117(self): + line = """\ +for a in [1, 2, 3]: + print('hello world') + for b in [1, 2, 3]: + print(a, b) +""" + fixed = """\ +for a in [1, 2, 3]: + print('hello world') + for b in [1, 2, 3]: + print(a, b) """ with autopep8_context(line) as result: self.assertEqual(fixed, result) From 62e70365454b5e9cf7ec467834fac8d40e018c9a Mon Sep 17 00:00:00 2001 From: Hideo Hattori Date: Tue, 11 Jun 2019 23:42:39 +0900 Subject: [PATCH 4/7] disable e117 fixed method with indent is tab --- autopep8.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/autopep8.py b/autopep8.py index 25a426d2..24e7ed28 100755 --- a/autopep8.py +++ b/autopep8.py @@ -651,6 +651,9 @@ def fix_e117(self, result): target = self.source[line_index] indent = _get_indentation(target) + if indent == '\t': + return [] + stripped = target.lstrip() self.source[line_index] = indent[1:] + stripped From 04214ad3773281fe169543fb12055e89e6bd54c6 Mon Sep 17 00:00:00 2001 From: Hideo Hattori Date: Tue, 11 Jun 2019 23:53:22 +0900 Subject: [PATCH 5/7] fix hanging comment --- test/test_autopep8.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test_autopep8.py b/test/test_autopep8.py index b325eb77..732c6c6b 100755 --- a/test/test_autopep8.py +++ b/test/test_autopep8.py @@ -1015,8 +1015,8 @@ def test_e101_should_ignore_multiline_strings_complex(self): def test_e101_with_comments(self): line = """\ while True: # My inline comment - # with a hanging - # comment. + # with a hanging + # comment. # Hello if True: \t# My comment From 74c408bb1f6f8733a1bfcfd53fa28fb9d7ae798b Mon Sep 17 00:00:00 2001 From: Hideo Hattori Date: Wed, 12 Jun 2019 00:02:36 +0900 Subject: [PATCH 6/7] fix hanging comment in test --- test/test_autopep8.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/test_autopep8.py b/test/test_autopep8.py index 732c6c6b..cd82b7bb 100755 --- a/test/test_autopep8.py +++ b/test/test_autopep8.py @@ -1015,8 +1015,8 @@ def test_e101_should_ignore_multiline_strings_complex(self): def test_e101_with_comments(self): line = """\ while True: # My inline comment - # with a hanging - # comment. + # with a hanging + # comment. # Hello if True: \t# My comment @@ -1025,8 +1025,8 @@ def test_e101_with_comments(self): """ fixed = """\ while True: # My inline comment - # with a hanging - # comment. + # with a hanging + # comment. # Hello if True: # My comment From ee298962e0a9473df757d8d87ba52da78b5d5f02 Mon Sep 17 00:00:00 2001 From: Hideo Hattori Date: Mon, 12 Aug 2019 00:44:38 +0900 Subject: [PATCH 7/7] drop py34 --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 4281f734..e3abd5e1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,6 @@ language: python python: - "2.7" - - "3.4" - "3.5" - "3.6" - "pypy"