Hello community,

here is the log from the commit of package python-autopep8 for openSUSE:Factory 
checked in at 2018-10-31 13:16:27
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-autopep8 (Old)
 and      /work/SRC/openSUSE:Factory/.python-autopep8.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-autopep8"

Wed Oct 31 13:16:27 2018 rev:14 rq:645474 version:1.4.2

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-autopep8/python-autopep8.changes  
2018-10-18 15:37:50.746194414 +0200
+++ /work/SRC/openSUSE:Factory/.python-autopep8.new/python-autopep8.changes     
2018-10-31 13:20:56.183085652 +0100
@@ -1,0 +2,9 @@
+Tue Oct 30 01:57:56 UTC 2018 - Arun Persaud <[email protected]>
+
+- update to version 1.4.2:
+  * strict autopep8
+  * add test for w503 fixed method with empty line
+  * fix IndexError in w503 fixed method
+  * fix w504 with any other tokenize.OP
+
+-------------------------------------------------------------------

Old:
----
  autopep8-1.4.1.tar.gz

New:
----
  autopep8-1.4.2.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-autopep8.spec ++++++
--- /var/tmp/diff_new_pack.JmdBYz/_old  2018-10-31 13:20:57.527084394 +0100
+++ /var/tmp/diff_new_pack.JmdBYz/_new  2018-10-31 13:20:57.543084379 +0100
@@ -18,7 +18,7 @@
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-autopep8
-Version:        1.4.1
+Version:        1.4.2
 Release:        0
 Summary:        Automatic generated to pep8 checked code
 License:        MIT

++++++ autopep8-1.4.1.tar.gz -> autopep8-1.4.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/autopep8-1.4.1/PKG-INFO new/autopep8-1.4.2/PKG-INFO
--- old/autopep8-1.4.1/PKG-INFO 2018-10-17 16:00:25.000000000 +0200
+++ new/autopep8-1.4.2/PKG-INFO 2018-10-23 17:09:34.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: autopep8
-Version: 1.4.1
+Version: 1.4.2
 Summary: A tool that automatically formats Python code to conform to the PEP 8 
style guide
 Home-page: https://github.com/hhatto/autopep8
 Author: Hideo Hattori
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/autopep8-1.4.1/autopep8.egg-info/PKG-INFO 
new/autopep8-1.4.2/autopep8.egg-info/PKG-INFO
--- old/autopep8-1.4.1/autopep8.egg-info/PKG-INFO       2018-10-17 
16:00:25.000000000 +0200
+++ new/autopep8-1.4.2/autopep8.egg-info/PKG-INFO       2018-10-23 
17:09:34.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: autopep8
-Version: 1.4.1
+Version: 1.4.2
 Summary: A tool that automatically formats Python code to conform to the PEP 8 
style guide
 Home-page: https://github.com/hhatto/autopep8
 Author: Hideo Hattori
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/autopep8-1.4.1/autopep8.py 
new/autopep8-1.4.2/autopep8.py
--- old/autopep8-1.4.1/autopep8.py      2018-10-17 15:58:22.000000000 +0200
+++ new/autopep8-1.4.2/autopep8.py      2018-10-23 17:09:21.000000000 +0200
@@ -67,7 +67,7 @@
     unicode = str
 
 
-__version__ = '1.4.1'
+__version__ = '1.4.2'
 
 
 CR = '\r'
@@ -1217,16 +1217,24 @@
             return
         # find comment
         comment_index = 0
+        found_not_comment_only_line = False
         comment_only_linenum = 0
         for i in range(5):
             # NOTE: try to parse code in 5 times
             if (line_index - i) < 0:
                 break
             from_index = line_index - i - 1
+            if from_index < 0 or len(self.source) <= from_index:
+                break
             to_index = line_index + 1
-            if self.source[from_index].lstrip()[0] == '#':
+            strip_line = self.source[from_index].lstrip()
+            if (
+                not found_not_comment_only_line and
+                strip_line and strip_line[0] == '#'
+            ):
                 comment_only_linenum += 1
                 continue
+            found_not_comment_only_line = True
             try:
                 ts = generate_tokens("".join(self.source[from_index:to_index]))
             except (SyntaxError, tokenize.TokenError):
@@ -1278,7 +1286,10 @@
             newline_count = 0
             newline_index = []
             for index, t in enumerate(ts):
-                if t[0] == tokenize.OP:
+                if t[0] == tokenize.OP and t[1] not in ".,(){}":
+                    if t[2][0] == 1 and t[3][0] == 1:
+                        operator_position = (t[2][1], t[3][1])
+                elif t[0] == tokenize.NAME and t[1] in ("and", "or"):
                     if t[2][0] == 1 and t[3][0] == 1:
                         operator_position = (t[2][1], t[3][1])
                 elif t[0] in (tokenize.NEWLINE, tokenize.NL):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/autopep8-1.4.1/test/test_autopep8.py 
new/autopep8-1.4.2/test/test_autopep8.py
--- old/autopep8-1.4.1/test/test_autopep8.py    2018-10-15 15:05:07.000000000 
+0200
+++ new/autopep8-1.4.2/test/test_autopep8.py    2018-10-23 17:09:21.000000000 
+0200
@@ -4352,6 +4352,26 @@
         with autopep8_context(line, options=['--select=W503', '--ignore=E']) 
as result:
             self.assertEqual(fixed, result)
 
+    def test_w503_with_empty_line(self):
+        line = """\
+
+# this is comment
+a = 2
+b = (1 +
+     2 +
+     3) / 2.0
+"""
+        fixed = """\
+
+# this is comment
+a = 2
+b = (1 +
+     2 +
+     3) / 2.0
+"""
+        with autopep8_context(line, options=['--ignore=E721']) as result:
+            self.assertEqual(fixed, result)
+
     def test_w503_with_line_comments(self):
         line = '(width == 0\n # this is comment\n # comment2\n + height == 
0)\n'
         fixed = '(width == 0 +\n # this is comment\n # comment2\n height == 
0)\n'
@@ -4364,6 +4384,25 @@
         with autopep8_context(line, options=['--select=W504', '--ignore=E']) 
as result:
             self.assertEqual(fixed, result)
 
+    def test_w504_with_e265_ignore_option(self):
+        line = '(width == 0 +\n height == 0)\n'
+        with autopep8_context(line, options=['--ignore=E265']) as result:
+            self.assertEqual(line, result)
+
+    def test_w504_with_e265_ignore_option_regression(self):
+        line = """\
+if True:
+    if True:
+        if (
+                link.is_wheel and
+                isinstance(link.comes_from, HTMLPage) and
+                link.comes_from.url.startswith(index_url)
+        ):
+            _store_wheel_in_cache(file_path, index_url)
+"""
+        with autopep8_context(line, options=['--ignore=E265']) as result:
+            self.assertEqual(line, result)
+
     @unittest.skip('TODO')
     def test_w504_with_line_comment(self):
         line = '(width == 0 +\n # this is comment\n height == 0)\n'


Reply via email to