Hello community,

here is the log from the commit of package python-autopep8 for openSUSE:Factory 
checked in at 2020-04-25 20:34:10
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-autopep8 (Old)
 and      /work/SRC/openSUSE:Factory/.python-autopep8.new.2738 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-autopep8"

Sat Apr 25 20:34:10 2020 rev:18 rq:797253 version:1.5.2

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-autopep8/python-autopep8.changes  
2020-01-22 22:46:53.092594178 +0100
+++ 
/work/SRC/openSUSE:Factory/.python-autopep8.new.2738/python-autopep8.changes    
    2020-04-25 20:36:41.763057851 +0200
@@ -1,0 +2,28 @@
+Fri Apr 24 15:15:40 UTC 2020 - Arun Persaud <a...@gmx.de>
+
+- update to version 1.5.2:
+  * add test for verbose log
+  * remove unnecessary format's argument
+  * add unit test
+  * fix incorrect E702 fixes with --select=E702 option
+  * refactoring
+  * enable exclude option when specify directly file args
+  * add unit test: exclude option when specify directly file args
+  * support parallel jobs for --diff option (#480)
+  * add test for diff option parallel jobs
+  * add python 3.8 to files
+  * add unit test: --ignore=E503,E504 case
+  * fix degrade to case of --select=W --ignore=W503
+  * add test for W503,504 more complex case
+
+- changes from version 1.5.1:
+  * remove skip mark in test
+  * refactoring
+  * add unit test for w503 and w504 confliction case
+  * change: both W503 and W504 are specified, priority is given to
+    W503 (for #518)
+  * fix E402 with __all__ (for #529)
+  * Fix a bug causing both W503 and W504 to be ignored
+  * return diff exit code when reading from stdin too
+
+-------------------------------------------------------------------

Old:
----
  autopep8-1.5.tar.gz

New:
----
  autopep8-1.5.2.tar.gz

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

Other differences:
------------------
++++++ python-autopep8.spec ++++++
--- /var/tmp/diff_new_pack.cSBer5/_old  2020-04-25 20:36:42.319058998 +0200
+++ /var/tmp/diff_new_pack.cSBer5/_new  2020-04-25 20:36:42.323059006 +0200
@@ -18,7 +18,7 @@
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-autopep8
-Version:        1.5
+Version:        1.5.2
 Release:        0
 Summary:        Automatic generated to pep8 checked code
 License:        MIT

++++++ autopep8-1.5.tar.gz -> autopep8-1.5.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/autopep8-1.5/PKG-INFO new/autopep8-1.5.2/PKG-INFO
--- old/autopep8-1.5/PKG-INFO   2020-01-20 15:08:06.000000000 +0100
+++ new/autopep8-1.5.2/PKG-INFO 2020-04-20 13:59:18.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: autopep8
-Version: 1.5
+Version: 1.5.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
@@ -442,5 +442,6 @@
 Classifier: Programming Language :: Python :: 3.5
 Classifier: Programming Language :: Python :: 3.6
 Classifier: Programming Language :: Python :: 3.7
+Classifier: Programming Language :: Python :: 3.8
 Classifier: Topic :: Software Development :: Libraries :: Python Modules
 Classifier: Topic :: Software Development :: Quality Assurance
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/autopep8-1.5/autopep8.egg-info/PKG-INFO 
new/autopep8-1.5.2/autopep8.egg-info/PKG-INFO
--- old/autopep8-1.5/autopep8.egg-info/PKG-INFO 2020-01-20 15:08:06.000000000 
+0100
+++ new/autopep8-1.5.2/autopep8.egg-info/PKG-INFO       2020-04-20 
13:59:18.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: autopep8
-Version: 1.5
+Version: 1.5.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
@@ -442,5 +442,6 @@
 Classifier: Programming Language :: Python :: 3.5
 Classifier: Programming Language :: Python :: 3.6
 Classifier: Programming Language :: Python :: 3.7
+Classifier: Programming Language :: Python :: 3.8
 Classifier: Topic :: Software Development :: Libraries :: Python Modules
 Classifier: Topic :: Software Development :: Quality Assurance
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/autopep8-1.5/autopep8.py 
new/autopep8-1.5.2/autopep8.py
--- old/autopep8-1.5/autopep8.py        2020-01-20 15:07:31.000000000 +0100
+++ new/autopep8-1.5.2/autopep8.py      2020-04-20 13:58:30.000000000 +0200
@@ -67,6 +67,7 @@
     from ConfigParser import Error
 
 import pycodestyle
+from pycodestyle import STARTSWITH_INDENT_STATEMENT_REGEX
 
 
 try:
@@ -75,7 +76,7 @@
     unicode = str
 
 
-__version__ = '1.5'
+__version__ = '1.5.2'
 
 
 CR = '\r'
@@ -1028,7 +1029,13 @@
         # https://docs.python.org/reference/compound_stmts.html
         for line in logical_lines:
             if (result['id'] == 'E702' and ':' in line
-                    and STARTSWITH_DEF_REGEX.match(line)):
+                    and STARTSWITH_INDENT_STATEMENT_REGEX.match(line)):
+                if self.options.verbose:
+                    print(
+                        '---> avoid fixing {error} with '
+                        'other compound statements'.format(error=result['id']),
+                        file=sys.stderr
+                    )
                 return []
 
         line_index = result['line'] - 1
@@ -1496,7 +1503,7 @@
                 return cnt + offset + 1
             return cnt
         elif pycodestyle.DUNDER_REGEX.match(line):
-            continue
+            return cnt
         elif any(line.startswith(kw) for kw in allowed_try_keywords):
             continue
         elif is_string_literal(line):
@@ -3500,7 +3507,7 @@
 
     fixed_source = original_source
 
-    if options.in_place or output:
+    if options.in_place or options.diff or output:
         encoding = detect_encoding(filename)
 
     if output:
@@ -3515,6 +3522,8 @@
         if output:
             output.write(diff)
             output.flush()
+        elif options.jobs > 1:
+            diff = diff.encode(encoding)
         return diff
     elif options.in_place:
         original = "".join(original_source).splitlines()
@@ -3691,6 +3700,44 @@
     return parser
 
 
+def _expand_codes(codes, ignore_codes):
+    """expand to individual E/W codes"""
+    ret = set()
+
+    is_conflict = False
+    if all(
+            any(
+                conflicting_code.startswith(code)
+                for code in codes
+            )
+            for conflicting_code in CONFLICTING_CODES
+    ):
+        is_conflict = True
+
+    is_ignore_w503 = "W503" in ignore_codes
+    is_ignore_w504 = "W504" in ignore_codes
+
+    for code in codes:
+        if code == "W":
+            if is_ignore_w503 and is_ignore_w504:
+                ret.update({"W1", "W2", "W3", "W505", "W6"})
+            elif is_ignore_w503:
+                ret.update({"W1", "W2", "W3", "W504", "W505", "W6"})
+            else:
+                ret.update({"W1", "W2", "W3", "W503", "W505", "W6"})
+        elif code in ("W5", "W50"):
+            if is_ignore_w503 and is_ignore_w504:
+                ret.update({"W505"})
+            elif is_ignore_w503:
+                ret.update({"W504", "W505"})
+            else:
+                ret.update({"W503", "W505"})
+        elif not (code in ("W503", "W504") and is_conflict):
+            ret.add(code)
+
+    return ret
+
+
 def parse_args(arguments, apply_config=False):
     """Parse command-line options."""
     parser = create_parser()
@@ -3738,12 +3785,15 @@
         parser.error('--max-line-length must be greater than 0')
 
     if args.select:
-        args.select = _split_comma_separated(args.select)
+        args.select = _expand_codes(
+            _split_comma_separated(args.select),
+            (_split_comma_separated(args.ignore) if args.ignore else [])
+        )
 
     if args.ignore:
         args.ignore = _split_comma_separated(args.ignore)
-        if not all(
-                any(
+        if all(
+                not any(
                     conflicting_code.startswith(ignore_code)
                     for ignore_code in args.ignore
                 )
@@ -3768,7 +3818,7 @@
         import multiprocessing
         args.jobs = multiprocessing.cpu_count()
 
-    if args.jobs > 1 and not args.in_place:
+    if args.jobs > 1 and not (args.in_place or args.diff):
         parser.error('parallel jobs requires --in-place')
 
     if args.line_range:
@@ -4165,7 +4215,13 @@
                                   if match_file(os.path.join(root, d),
                                                 exclude)]
         else:
-            yield name
+            is_exclude_match = False
+            for pattern in exclude:
+                if fnmatch.fnmatch(name, pattern):
+                    is_exclude_match = True
+                    break
+            if not is_exclude_match:
+                yield name
 
 
 def _fix_file(parameters):
@@ -4190,6 +4246,10 @@
         import multiprocessing
         pool = multiprocessing.Pool(options.jobs)
         ret = pool.map(_fix_file, [(name, options) for name in filenames])
+        if options.diff:
+            for r in ret:
+                sys.stdout.write(r.decode())
+                sys.stdout.flush()
         results.extend([x for x in ret if x is not None])
     else:
         for name in filenames:
@@ -4281,11 +4341,16 @@
             assert not args.in_place
 
             encoding = sys.stdin.encoding or get_encoding()
+            read_stdin = sys.stdin.read()
+            fixed_stdin = fix_code(read_stdin, args, encoding=encoding)
 
             # LineEndingWrapper is unnecessary here due to the symmetry between
             # standard in and standard out.
-            wrap_output(sys.stdout, encoding=encoding).write(
-                fix_code(sys.stdin.read(), args, encoding=encoding))
+            wrap_output(sys.stdout, encoding=encoding).write(fixed_stdin)
+
+            if hash(read_stdin) != hash(fixed_stdin):
+                if args.exit_code:
+                    return EXIT_CODE_EXISTS_DIFF
         else:
             if args.in_place or args.diff:
                 args.files = list(set(args.files))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/autopep8-1.5/setup.py new/autopep8-1.5.2/setup.py
--- old/autopep8-1.5/setup.py   2019-12-01 16:04:03.000000000 +0100
+++ new/autopep8-1.5.2/setup.py 2020-04-09 03:23:43.000000000 +0200
@@ -47,6 +47,7 @@
             'Programming Language :: Python :: 3.5',
             'Programming Language :: Python :: 3.6',
             'Programming Language :: Python :: 3.7',
+            'Programming Language :: Python :: 3.8',
             'Topic :: Software Development :: Libraries :: Python Modules',
             'Topic :: Software Development :: Quality Assurance',
         ],
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/autopep8-1.5/test/test_autopep8.py 
new/autopep8-1.5.2/test/test_autopep8.py
--- old/autopep8-1.5/test/test_autopep8.py      2020-01-04 15:47:49.000000000 
+0100
+++ new/autopep8-1.5.2/test/test_autopep8.py    2020-04-20 13:58:18.000000000 
+0200
@@ -2528,6 +2528,48 @@
         with autopep8_context(line) as result:
             self.assertEqual(fixed, result)
 
+    def test_e402_with_dunder(self):
+        line = """\
+__all__ = ["a", "b"]
+def f():
+    pass
+import os
+"""
+        fixed = """\
+import os
+__all__ = ["a", "b"]
+
+
+def f():
+    pass
+"""
+        with autopep8_context(line) as result:
+            self.assertEqual(fixed, result)
+
+    def test_e402_with_dunder_lines(self):
+        line = """\
+__all__ = [
+    "a",
+    "b",
+]
+def f():
+    pass
+import os
+"""
+        fixed = """\
+import os
+__all__ = [
+    "a",
+    "b",
+]
+
+
+def f():
+    pass
+"""
+        with autopep8_context(line) as result:
+            self.assertEqual(fixed, result)
+
     def test_e501_basic(self):
         line = """\
 
@@ -3975,6 +4017,15 @@
         with autopep8_context(line) as result:
             self.assertEqual(fixed, result)
 
+    def test_e702_with_e701_and_only_select_e702_option(self):
+        line = """\
+for i in range(3):
+    if i == 1: print i; continue
+    print i
+"""
+        with autopep8_context(line, options=["--select=E702"]) as result:
+            self.assertEqual(line, result)
+
     def test_e703_with_inline_comment(self):
         line = 'a = 5;    # inline comment\n'
         fixed = 'a = 5    # inline comment\n'
@@ -4402,6 +4453,32 @@
         with autopep8_context(line, options=['--select=W503']) as result:
             self.assertEqual(fixed, result)
 
+    def test_w503_with_ignore_w504(self):
+        line = '(width == 0\n + height == 0)\n'
+        fixed = '(width == 0 +\n height == 0)\n'
+        with autopep8_context(line, options=['--ignore=E,W504']) as result:
+            self.assertEqual(fixed, result)
+
+    def test_w504_with_ignore_w503(self):
+        line = '(width == 0 +\n height == 0)\n'
+        fixed = '(width == 0\n + height == 0)\n'
+        with autopep8_context(line, options=['--ignore=E,W503']) as result:
+            self.assertEqual(fixed, result)
+
+    def test_w503_w504_none_ignored(self):
+        line = '(width == 0 +\n height == 0\n+ depth == 0)\n'
+        fixed = '(width == 0 +\n height == 0\n+ depth == 0)\n'
+        with autopep8_context(line, options=['--ignore=E']) as result:
+            self.assertEqual(fixed, result)
+
+    def test_w503_w504_both_ignored(self):
+        line = '(width == 0 +\n height == 0\n+ depth == 0)\n'
+        fixed = '(width == 0 +\n height == 0\n+ depth == 0)\n'
+        with autopep8_context(
+            line, options=['--ignore=E,W503, W504'],
+        ) as result:
+            self.assertEqual(fixed, result)
+
     def test_w503_skip_default(self):
         line = '(width == 0\n + height == 0)\n'
         with autopep8_context(line) as result:
@@ -4529,6 +4606,70 @@
         with autopep8_context(line, options=['--select=W503', '--ignore=E']) 
as result:
             self.assertEqual(fixed, result)
 
+    def test_ignore_only_w503_with_select_w(self):
+        line = """\
+a = (
+    11 + 22 +
+    33 +
+    44
+    + 55
+)
+"""
+        fixed = """\
+a = (
+    11 + 22
+    + 33
+    + 44
+    + 55
+)
+"""
+        with autopep8_context(line, options=['--select=W', '--ignore=W503']) 
as result:
+            self.assertEqual(fixed, result)
+        with autopep8_context(line, options=['--select=W5', '--ignore=W503']) 
as result:
+            self.assertEqual(fixed, result)
+        with autopep8_context(line, options=['--select=W50', '--ignore=W503']) 
as result:
+            self.assertEqual(fixed, result)
+
+    def test_ignore_only_w504_with_select_w(self):
+        line = """\
+a = (
+    11 + 22 +
+    33 +
+    44
+    + 55
+)
+"""
+        fixed = """\
+a = (
+    11 + 22 +
+    33 +
+    44 +
+    55
+)
+"""
+        with autopep8_context(line, options=['--select=W', '--ignore=W504']) 
as result:
+            self.assertEqual(fixed, result)
+        with autopep8_context(line, options=['--select=W5', '--ignore=W504']) 
as result:
+            self.assertEqual(fixed, result)
+        with autopep8_context(line, options=['--select=W50', '--ignore=W504']) 
as result:
+            self.assertEqual(fixed, result)
+
+    def test_ignore_w503_and_w504_with_select_w(self):
+        line = """\
+a = (
+    11 + 22 +
+    33 +
+    44
+    + 55
+)
+"""
+        with autopep8_context(line, options=['--select=W', 
'--ignore=W503,W504']) as result:
+            self.assertEqual(line, result)
+        with autopep8_context(line, options=['--select=W5', 
'--ignore=W503,W504']) as result:
+            self.assertEqual(line, result)
+        with autopep8_context(line, options=['--select=W50', 
'--ignore=W503,W504']) as result:
+            self.assertEqual(line, result)
+
     def test_w504(self):
         line = '(width == 0 +\n height == 0)\n'
         fixed = '(width == 0\n + height == 0)\n'
@@ -4572,7 +4713,6 @@
         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'
         fixed = '(width == 0\n # this is comment\n + height == 0)\n'
@@ -4597,6 +4737,29 @@
         with autopep8_context(line, options=['--ignore=E265']) as result:
             self.assertEqual(fixed, result)
 
+    def test_w503_and_w504_conflict(self):
+        line = """\
+if True:
+    if True:
+        assert_equal(self.nodes[0].getbalance(
+        ), bal + Decimal('50.00000000') + Decimal('2.19000000'))  # block 
reward + tx
+"""
+        fixed = """\
+if True:
+    if True:
+        assert_equal(
+            self.nodes[0].getbalance(),
+            bal +
+            Decimal('50.00000000') +
+            Decimal('2.19000000'))  # block reward + tx
+"""
+        with autopep8_context(line, options=['-aa', '--select=E,W']) as result:
+            self.assertEqual(fixed, result)
+        with autopep8_context(line, options=['-aa', '--select=E,W5']) as 
result:
+            self.assertEqual(fixed, result)
+        with autopep8_context(line, options=['-aa', '--select=E,W50']) as 
result:
+            self.assertEqual(fixed, result)
+
     def test_w601(self):
         line = 'a = {0: 1}\na.has_key(0)\n'
         fixed = 'a = {0: 1}\n0 in a\n'
@@ -5121,6 +5284,19 @@
             verbose_error = p.communicate()[1].decode('utf-8')
         self.assertIn('------------', verbose_error)
 
+    def test_verbose_with_select_e702(self):
+        line = """\
+for i in range(3):
+    if i == 1: print i; continue
+    print i
+"""
+        with temporary_file_context(line) as filename:
+            p = Popen(list(AUTOPEP8_CMD_TUPLE) +
+                      [filename, '-vvv', '--select=E702'],
+                      stdout=PIPE, stderr=PIPE)
+            verbose_error = p.communicate()[1].decode('utf-8')
+        self.assertIn(" with other compound statements", verbose_error)
+
     def test_in_place(self):
         line = "'abc'  \n"
         fixed = "'abc'\n"
@@ -5187,6 +5363,31 @@
                 with open(filename_b) as f:
                     self.assertEqual(fixed, f.read())
 
+    def test_parallel_jobs_with_diff_option(self):
+        line = "'abc'  \n"
+        fixed = "'abc'\n"
+
+        with temporary_file_context(line) as filename_a:
+            with temporary_file_context(line) as filename_b:
+                files = list(set([filename_a, filename_b]))
+                p = Popen(list(AUTOPEP8_CMD_TUPLE) + files +
+                          ['--jobs=3', '--diff'], stdout=PIPE)
+                p.wait()
+                output = p.stdout.read().decode()
+
+                actual_diffs = []
+                for filename in files:
+                    actual_diffs.append("""\
+--- original/{filename}
++++ fixed/{filename}
+@@ -1 +1 @@
+-'abc'  
++'abc'
+""".format(filename=filename))
+                self.assertEqual(0, p.returncode)
+                for actual_diff in actual_diffs:
+                    self.assertIn(actual_diff, output)
+
     def test_parallel_jobs_with_automatic_cpu_count(self):
         line = "'abc'  \n"
         fixed = "'abc'\n"
@@ -5306,6 +5507,28 @@
         finally:
             shutil.rmtree(temp_directory)
 
+    def test_exclude_with_directly_file_args(self):
+        temp_directory = mkdtemp(dir='.')
+        try:
+            filepath_a = os.path.join(temp_directory, 'a.py')
+            with open(filepath_a, 'w') as output:
+                output.write("'abc'  \n")
+
+            os.mkdir(os.path.join(temp_directory, 'd'))
+            filepath_b = os.path.join(temp_directory, 'd', 'b.py')
+            with open(os.path.join(filepath_b), 'w') as output:
+                output.write('123  \n')
+
+            p = Popen(list(AUTOPEP8_CMD_TUPLE) +
+                      ['--exclude=*/a.py', '--diff', filepath_a, filepath_b],
+                      stdout=PIPE)
+            result = p.communicate()[0].decode('utf-8')
+
+            self.assertNotIn('abc', result)
+            self.assertIn('123', result)
+        finally:
+            shutil.rmtree(temp_directory)
+
     def test_invalid_option_combinations(self):
         line = "'abc'  \n"
         with temporary_file_context(line) as filename:
@@ -5378,6 +5601,17 @@
             fixed,
             process.communicate(line.encode('utf-8'))[0].decode('utf-8'))
 
+    def test_exit_code_should_be_set_when_standard_in(self):
+        line = 'print( 1 )\n'
+        process = Popen(list(AUTOPEP8_CMD_TUPLE) +
+                        ['--exit-code', '-'],
+                        stdout=PIPE,
+                        stdin=PIPE)
+        process.communicate(line.encode('utf-8'))[0].decode('utf-8')
+        self.assertEqual(
+            process.returncode,
+            autopep8.EXIT_CODE_EXISTS_DIFF)
+
 
 class ConfigurationTests(unittest.TestCase):
 


Reply via email to