Hello community,

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

Package is "python-autopep8"

Mon Feb  5 10:52:56 2018 rev:10 rq:572411 version:1.3.4

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-autopep8/python-autopep8.changes  
2017-10-17 01:52:08.507491930 +0200
+++ /work/SRC/openSUSE:Factory/.python-autopep8.new/python-autopep8.changes     
2018-02-05 10:53:45.982187419 +0100
@@ -1,0 +2,19 @@
+Sun Feb  4 00:38:02 UTC 2018 - a...@gmx.de
+
+- specfile:
+  * update copyright year
+
+- update to version 1.3.4:
+  * support in some more cases in E712
+  * add test for e712 with dict value
+  * drop support Python2.6
+  * strict pylint
+  * add to E133 fixed method and available hang-closing option
+  * fix unit test
+  * add E226 in default ignore code
+  * change: use compile() with dont_inherit=True
+  * add test, invalid config key for autopep8
+  * print enable config section and key-value in verbose mode
+  * add test for w602 valid and invalid 2to3 fixed case, skip now
+
+-------------------------------------------------------------------

Old:
----
  autopep8-1.3.3.tar.gz

New:
----
  autopep8-1.3.4.tar.gz

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

Other differences:
------------------
++++++ python-autopep8.spec ++++++
--- /var/tmp/diff_new_pack.Vw8CrV/_old  2018-02-05 10:53:46.814148511 +0100
+++ /var/tmp/diff_new_pack.Vw8CrV/_new  2018-02-05 10:53:46.814148511 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package python-autopep8
 #
-# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -18,7 +18,7 @@
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-autopep8
-Version:        1.3.3
+Version:        1.3.4
 Release:        0
 Summary:        Automatic generated to pep8 checked code
 License:        MIT

++++++ autopep8-1.3.3.tar.gz -> autopep8-1.3.4.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/autopep8-1.3.3/PKG-INFO new/autopep8-1.3.4/PKG-INFO
--- old/autopep8-1.3.3/PKG-INFO 2017-10-11 10:18:31.000000000 +0200
+++ new/autopep8-1.3.4/PKG-INFO 2018-01-24 14:46:35.000000000 +0100
@@ -1,11 +1,12 @@
 Metadata-Version: 1.1
 Name: autopep8
-Version: 1.3.3
+Version: 1.3.4
 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
 Author-email: hhatto...@gmail.com
 License: Expat License
+Description-Content-Type: UNKNOWN
 Description: ========
         autopep8
         ========
@@ -324,7 +325,7 @@
         Test cases are in ``test/test_autopep8.py``. They can be run directly 
via
         ``python test/test_autopep8.py`` or via tox_. The latter is useful for
         testing against multiple Python interpreters. (We currently test 
against
-        CPython versions 2.6, 2.7, 3.3, 3.4, and 3.5. We also test against 
PyPy.)
+        CPython versions 2.6, 2.7, 3.3, 3.4, 3.5 and 3.6. We also test against 
PyPy.)
         
         .. _`tox`: https://pypi.python.org/pypi/tox
         
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/autopep8-1.3.3/README.rst 
new/autopep8-1.3.4/README.rst
--- old/autopep8-1.3.3/README.rst       2017-10-11 10:09:28.000000000 +0200
+++ new/autopep8-1.3.4/README.rst       2018-01-22 03:30:33.000000000 +0100
@@ -316,7 +316,7 @@
 Test cases are in ``test/test_autopep8.py``. They can be run directly via
 ``python test/test_autopep8.py`` or via tox_. The latter is useful for
 testing against multiple Python interpreters. (We currently test against
-CPython versions 2.6, 2.7, 3.3, 3.4, and 3.5. We also test against PyPy.)
+CPython versions 2.6, 2.7, 3.3, 3.4, 3.5 and 3.6. We also test against PyPy.)
 
 .. _`tox`: https://pypi.python.org/pypi/tox
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/autopep8-1.3.3/autopep8.egg-info/PKG-INFO 
new/autopep8-1.3.4/autopep8.egg-info/PKG-INFO
--- old/autopep8-1.3.3/autopep8.egg-info/PKG-INFO       2017-10-11 
10:18:31.000000000 +0200
+++ new/autopep8-1.3.4/autopep8.egg-info/PKG-INFO       2018-01-24 
14:46:34.000000000 +0100
@@ -1,11 +1,12 @@
 Metadata-Version: 1.1
 Name: autopep8
-Version: 1.3.3
+Version: 1.3.4
 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
 Author-email: hhatto...@gmail.com
 License: Expat License
+Description-Content-Type: UNKNOWN
 Description: ========
         autopep8
         ========
@@ -324,7 +325,7 @@
         Test cases are in ``test/test_autopep8.py``. They can be run directly 
via
         ``python test/test_autopep8.py`` or via tox_. The latter is useful for
         testing against multiple Python interpreters. (We currently test 
against
-        CPython versions 2.6, 2.7, 3.3, 3.4, and 3.5. We also test against 
PyPy.)
+        CPython versions 2.6, 2.7, 3.3, 3.4, 3.5 and 3.6. We also test against 
PyPy.)
         
         .. _`tox`: https://pypi.python.org/pypi/tox
         
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/autopep8-1.3.3/autopep8.egg-info/requires.txt 
new/autopep8-1.3.4/autopep8.egg-info/requires.txt
--- old/autopep8-1.3.3/autopep8.egg-info/requires.txt   2017-10-11 
10:18:31.000000000 +0200
+++ new/autopep8-1.3.4/autopep8.egg-info/requires.txt   2018-01-24 
14:46:34.000000000 +0100
@@ -1 +1 @@
-pycodestyle >= 2.3
+pycodestyle>=2.3
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/autopep8-1.3.3/autopep8.py 
new/autopep8-1.3.4/autopep8.py
--- old/autopep8-1.3.3/autopep8.py      2017-10-11 10:11:23.000000000 +0200
+++ new/autopep8-1.3.4/autopep8.py      2018-01-24 14:45:43.000000000 +0100
@@ -66,7 +66,7 @@
     unicode = str
 
 
-__version__ = '1.3.3'
+__version__ = '1.3.4'
 
 
 CR = '\r'
@@ -93,9 +93,10 @@
 ])
 
 
-DEFAULT_IGNORE = 'E24,W503'
+DEFAULT_IGNORE = 'E226,E24,W503'    # TODO: use pycodestyle.DEFAULT_IGNORE
 DEFAULT_INDENT_SIZE = 4
 
+SELECTED_GLOBAL_FIXED_METHOD_CODES = ['W602', ]
 
 # W602 is handled separately due to the need to avoid "with_traceback".
 CODE_TO_2TO3 = {
@@ -185,8 +186,8 @@
 pycodestyle.register_check(extended_blank_lines)
 
 
-def continued_indentation(logical_line, tokens, indent_level, indent_char,
-                          noqa):
+def continued_indentation(logical_line, tokens, indent_level, hang_closing,
+                          indent_char, noqa):
     """Override pycodestyle's function to provide indentation information."""
     first_row = tokens[0][2][0]
     nrows = 1 + tokens[-1][2][0] - first_row
@@ -262,7 +263,9 @@
                 if start[1] != indent[depth]:
                     yield (start, 'E124 {0}'.format(indent[depth]))
             elif close_bracket and not hang:
-                pass
+                # closing bracket matches indentation of opening bracket's line
+                if hang_closing:
+                    yield (start, 'E133 {0}'.format(indent[depth]))
             elif indent[depth] and start[1] < indent[depth]:
                 # Visual indent is broken.
                 yield (start, 'E128 {0}'.format(indent[depth]))
@@ -270,7 +273,7 @@
                   (indent_next and
                    rel_indent[row] == 2 * DEFAULT_INDENT_SIZE)):
                 # Hanging indent is verified.
-                if close_bracket:
+                if close_bracket and not hang_closing:
                     yield (start, 'E123 {0}'.format(indent_level +
                                                     rel_indent[open_row]))
                 hangs[depth] = hang
@@ -447,6 +450,7 @@
         self.fix_e127 = self._fix_reindent
         self.fix_e128 = self._fix_reindent
         self.fix_e129 = self._fix_reindent
+        self.fix_e133 = self.fix_e131
         self.fix_e202 = self.fix_e201
         self.fix_e203 = self.fix_e201
         self.fix_e211 = self.fix_e201
@@ -543,6 +547,7 @@
             'ignore': self.options.ignore,
             'select': self.options.select,
             'max_line_length': self.options.max_line_length,
+            'hang_closing': self.options.hang_closing,
         }
         results = _execute_pep8(pep8_options, self.source)
 
@@ -677,7 +682,7 @@
             error_code = result.get('id', 0)
             try:
                 ts = generate_tokens(fixed)
-            except tokenize.TokenError:
+            except (SyntaxError, tokenize.TokenError):
                 return
             if not check_syntax(fixed.lstrip()):
                 return
@@ -894,8 +899,7 @@
                     line=target,
                     max_line_length=self.options.max_line_length,
                     last_comment=not next_line.lstrip().startswith('#'))
-            else:
-                return []
+            return []
 
         fixed = get_fixed_long_line(
             target=target,
@@ -1014,11 +1018,11 @@
                                                                  self.source)
 
         # Handle very easy "not" special cases.
-        if re.match(r'^\s*if [\w.]+ == False:$', target):
-            self.source[line_index] = re.sub(r'if ([\w.]+) == False:',
+        if re.match(r'^\s*if [\w."\'\[\]]+ == False:$', target):
+            self.source[line_index] = re.sub(r'if ([\w."\'\[\]]+) == False:',
                                              r'if not \1:', target, count=1)
-        elif re.match(r'^\s*if [\w.]+ != True:$', target):
-            self.source[line_index] = re.sub(r'if ([\w.]+) != True:',
+        elif re.match(r'^\s*if [\w."\'\[\]]+ != True:$', target):
+            self.source[line_index] = re.sub(r'if ([\w."\'\[\]]+) != True:',
                                              r'if not \1:', target, count=1)
         else:
             right_offset = offset + 2
@@ -1137,7 +1141,7 @@
         one_string_token = target.split()[0]
         try:
             ts = generate_tokens(one_string_token)
-        except tokenize.TokenError:
+        except (SyntaxError, tokenize.TokenError):
             return
         if not _is_binary_operator(ts[0][0], one_string_token):
             return
@@ -1151,13 +1155,13 @@
             to_index = line_index + 1
             try:
                 ts = generate_tokens("".join(self.source[from_index:to_index]))
-            except Exception:
+            except (SyntaxError, tokenize.TokenError):
                 continue
             newline_count = 0
             newline_index = []
-            for i, t in enumerate(ts):
+            for index, t in enumerate(ts):
                 if t[0] in (tokenize.NEWLINE, tokenize.NL):
-                    newline_index.append(i)
+                    newline_index.append(index)
                     newline_count += 1
             if newline_count > 2:
                 tts = ts[newline_index[-3]:]
@@ -1474,8 +1478,7 @@
     if not aggressive:
         return source
 
-    return refactor(source, ['raise'],
-                    ignore='with_traceback')
+    return refactor(source, ['raise'], ignore='with_traceback')
 
 
 def find_newline(source):
@@ -1649,7 +1652,10 @@
             first = source[:end_offset]
 
             second_indent = indentation
-            if first.rstrip().endswith('('):
+            if (first.rstrip().endswith('(') and
+               source[end_offset:].lstrip().startswith(')')):
+                pass
+            elif first.rstrip().endswith('('):
                 second_indent += indent_word
             elif '(' in first:
                 second_indent += ' ' * (1 + first.find('('))
@@ -2880,7 +2886,7 @@
 def check_syntax(code):
     """Return True if syntax is okay."""
     try:
-        return compile(code, '<string>', 'exec')
+        return compile(code, '<string>', 'exec', dont_inherit=True)
     except (SyntaxError, TypeError, UnicodeDecodeError):
         return False
 
@@ -3128,10 +3134,22 @@
         # Disable "apply_local_fixes()" for now due to issue #175.
         fixed_source = tmp_source
     else:
+        pep8_options = {
+            'ignore': options.ignore,
+            'select': options.select,
+            'max_line_length': options.max_line_length,
+            'hang_closing': options.hang_closing,
+        }
+        sio = io.StringIO(tmp_source)
+        contents = sio.readlines()
+        results = _execute_pep8(pep8_options, contents)
+        codes = set([result['id'] for result in results
+                     if result['id'] in SELECTED_GLOBAL_FIXED_METHOD_CODES])
         # Apply global fixes only once (for efficiency).
         fixed_source = apply_global_fixes(tmp_source,
                                           options,
-                                          filename=filename)
+                                          filename=filename,
+                                          codes=codes)
 
     passes = 0
     long_line_ignore_cache = set()
@@ -3220,19 +3238,25 @@
         return inspect.getargspec(function)[0]
 
 
-def apply_global_fixes(source, options, where='global', filename=''):
+def apply_global_fixes(source, options, where='global', filename='',
+                       codes=None):
     """Run global fixes on source code.
 
     These are fixes that only need be done once (unlike those in
     FixPEP8, which are dependent on pycodestyle).
 
     """
+    if codes is None:
+        codes = []
     if any(code_match(code, select=options.select, ignore=options.ignore)
            for code in ['E101', 'E111']):
         source = reindent(source,
                           indent_size=options.indent_size)
 
     for (code, function) in global_fixes():
+        if code.upper() in SELECTED_GLOBAL_FIXED_METHOD_CODES \
+                and code.upper() not in codes:
+            continue
         if code_match(code, select=options.select, ignore=options.ignore):
             if options.verbose:
                 print('--->  Applying {0} fix for {1}'.format(where,
@@ -3338,6 +3362,8 @@
                              'line numbers are indexed at 1')
     parser.add_argument('--indent-size', default=DEFAULT_INDENT_SIZE,
                         type=int, help=argparse.SUPPRESS)
+    parser.add_argument('--hang-closing', action='store_true',
+                        help='hang-closing option passed to pycodestyle')
     parser.add_argument('files', nargs='*',
                         help="files to format or '-' for standard in")
 
@@ -3454,6 +3480,8 @@
                 continue
             for (k, _) in config.items(section):
                 norm_opt = k.lstrip('-').replace('-', '_')
+                if not option_list.get(norm_opt):
+                    continue
                 opt_type = option_list[norm_opt]
                 if opt_type is int:
                     value = config.getint(section, k)
@@ -3461,6 +3489,9 @@
                     value = config.getboolean(section, k)
                 else:
                     value = config.get(section, k)
+                if args.verbose:
+                    print("enable config: section={}, key={}, value={}".format(
+                        section, k, value))
                 defaults[norm_opt] = value
 
         parser.set_defaults(**defaults)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/autopep8-1.3.3/setup.cfg new/autopep8-1.3.4/setup.cfg
--- old/autopep8-1.3.3/setup.cfg        2017-10-11 10:18:31.000000000 +0200
+++ new/autopep8-1.3.4/setup.cfg        2018-01-24 14:46:35.000000000 +0100
@@ -4,5 +4,4 @@
 [egg_info]
 tag_build = 
 tag_date = 0
-tag_svn_revision = 0
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/autopep8-1.3.3/test/test_autopep8.py 
new/autopep8-1.3.4/test/test_autopep8.py
--- old/autopep8-1.3.3/test/test_autopep8.py    2017-10-11 10:09:28.000000000 
+0200
+++ new/autopep8-1.3.4/test/test_autopep8.py    2018-01-22 07:29:04.000000000 
+0100
@@ -1698,6 +1698,32 @@
         with autopep8_context(line, options=['--select=E12']) as result:
             self.assertEqual(fixed, result)
 
+    def test_e133(self):
+        line = """\
+if True:
+    e = [
+        1, 2
+    ]
+"""
+        fixed = """\
+if True:
+    e = [
+        1, 2
+        ]
+"""
+        with autopep8_context(line, options=['--hang-closing']) as result:
+            self.assertEqual(fixed, result)
+
+    def test_e133_not_effected(self):
+        line = """\
+if True:
+    e = [
+        1, 2
+        ]
+"""
+        with autopep8_context(line, options=['--hang-closing']) as result:
+            self.assertEqual(line, result)
+
     def test_w191(self):
         line = """\
 while True:
@@ -3821,6 +3847,13 @@
                               options=['-aa', '--select=E712']) as result:
             self.assertEqual(fixed, result)
 
+    def test_e712_with_dict_value(self):
+        line = 'if d["key"] != True:\n    pass\n'
+        fixed = 'if not d["key"]:\n    pass\n'
+        with autopep8_context(line,
+                              options=['-aa', '--select=E712']) as result:
+            self.assertEqual(fixed, result)
+
     def test_e712_only_if_aggressive_level_2(self):
         line = 'foo == True\n'
         with autopep8_context(line, options=['-a']) as result:
@@ -4383,6 +4416,29 @@
         with autopep8_context(line, options=['--aggressive']) as result:
             self.assertEqual(line, result)
 
+    def test_w602_invalid_2to3_fixed_case(self):
+        line = """\
+raise (ValueError
+       if True else TypeError)
+"""
+        with autopep8_context(line, options=['--aggressive']) as result:
+            self.assertEqual(line, result)
+
+    @unittest.skip('TODO')
+    def test_w602_invalid_2to3_fixed_case_with_valid_syntax(self):
+        line = """\
+raise (ValueError
+       if True else TypeError)
+raise ValueError, "error"
+"""
+        fixed = """\
+raise (ValueError
+       if True else TypeError)
+raise ValueError("error")
+"""
+        with autopep8_context(line, options=['--aggressive']) as result:
+            self.assertEqual(fixed, result)
+
     def test_w603(self):
         line = 'if 2 <> 2:\n    print False'
         fixed = 'if 2 != 2:\n    print False\n'
@@ -4844,6 +4900,19 @@
                 apply_config=True)
             self.assertEqual(args.aggressive, 1)
 
+    def test_config_local_inclue_invalid_key(self):
+        configstr = """\
+[pep8]
+count=True
+aggressive=1
+"""
+        with temporary_file_context(configstr) as filename:
+            args = autopep8.parse_args(
+                [os.path.join(FAKE_CONFIGURATION, 'foo.py'),
+                 '--global-config={0}'.format(filename)],
+                apply_config=True)
+            self.assertEqual(args.aggressive, 1)
+
 
 class ExperimentalSystemTests(unittest.TestCase):
 
@@ -5460,9 +5529,9 @@
         fixed = '''\
 def f():
     email_text += """<html>This is a really long docstring that goes over the 
column limit and is multi-line.<br><br>
-<b>Czar: </b>""" + despot["Nicholas"] + """<br>
-<b>Minion: </b>""" + serf["Dmitri"] + """<br>
-<b>Residence: </b>""" + palace["Winter"] + """<br>
+<b>Czar: </b>"""+despot["Nicholas"]+"""<br>
+<b>Minion: </b>"""+serf["Dmitri"]+"""<br>
+<b>Residence: </b>"""+palace["Winter"]+"""<br>
 </body>
 </html>"""
 '''
@@ -5483,9 +5552,9 @@
 def f():
     email_text += (
         """<html>This is a really long docstring that goes over the column 
limit and is multi-line.<br><br>
-<b>Czar: </b>""" + despot["Nicholas"] + """<br>
-<b>Minion: </b>""" + serf["Dmitri"] + """<br>
-<b>Residence: </b>""" + palace["Winter"] + """<br>
+<b>Czar: </b>"""+despot["Nicholas"]+"""<br>
+<b>Minion: </b>"""+serf["Dmitri"]+"""<br>
+<b>Residence: </b>"""+palace["Winter"]+"""<br>
 </body>
 </html>""")
 '''
@@ -5588,13 +5657,13 @@
         line = """\
 def f(self):
     self._xxxxxxxx(aaaaaa, bbbbbbbbb, cccccccccccccccccc,
-                   [('mmmmmmmmmm', self.yyyyyyyyyy.zzzzzzz/_DDDDD)], eee, 'ff')
+                   [('mmmmmmmmmm', self.yyyyyyyyyy.zzzzzzzz/_DDDDDD)], eee, 
'ff')
 """
         fixed = """\
 def f(self):
     self._xxxxxxxx(
         aaaaaa, bbbbbbbbb, cccccccccccccccccc,
-        [('mmmmmmmmmm', self.yyyyyyyyyy.zzzzzzz / _DDDDD)],
+        [('mmmmmmmmmm', self.yyyyyyyyyy.zzzzzzzz / _DDDDDD)],
         eee, 'ff')
 """
         with autopep8_context(line, options=['--experimental']) as result:
@@ -5706,7 +5775,7 @@
         fixed = """\
 def f():
   self.aaaaaaaaa(bbbbbb, ccccccccc, dddddddddddddddd,
-                 ((x, y / eeeeeee) for x, y in self.outputs.total.iteritems()),
+                 ((x, y/eeeeeee) for x, y in self.outputs.total.iteritems()),
                  fff, 'GG')
 """
         with autopep8_context(line, options=['--experimental',
@@ -6096,6 +6165,22 @@
         with autopep8_context(line, options=['--experimental']) as result:
             self.assertEqual(fixed, result)
 
+    @unittest.skipIf(sys.version_info >= (3, ), 'syntax error in Python3')
+    def test_e501_print_isnot_function(self):
+        line = """\
+
+def d():
+    print "%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d" % (111, 111, 111, 111, 222, 
222, 222, 222, 222, 222, 222, 222, 222, 333, 333, 333, 333)
+"""
+        fixed = """\
+
+def d():
+    print "%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d" % (
+        111, 111, 111, 111, 222, 222, 222, 222, 222, 222, 222, 222, 222, 333,
+        333, 333, 333)
+"""
+        with autopep8_context(line, options=['--experimental']) as result:
+            self.assertEqual(fixed, result)
 
 @contextlib.contextmanager
 def autopep8_context(line, options=None):


Reply via email to