Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-autopep8 for openSUSE:Factory checked in at 2021-11-10 21:46:10 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-autopep8 (Old) and /work/SRC/openSUSE:Factory/.python-autopep8.new.1890 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-autopep8" Wed Nov 10 21:46:10 2021 rev:24 rq:929833 version:1.6.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-autopep8/python-autopep8.changes 2021-06-01 10:40:55.553166911 +0200 +++ /work/SRC/openSUSE:Factory/.python-autopep8.new.1890/python-autopep8.changes 2021-11-10 21:46:23.103809802 +0100 @@ -1,0 +2,9 @@ +Thu Nov 4 13:27:47 UTC 2021 - Ferdinand Thiessen <r...@fthiessen.de> + +- Update to 1.6.0 + * Fix: Ignore Settings for W292 Do Not Work + * Fix: Multiple #autopep8: off/on directives in one file do not work + * Fix: --hang-closing option does not work for non-indented lines + * Requires pycodestyle >= 2.8 + +------------------------------------------------------------------- Old: ---- autopep8-1.5.7.tar.gz New: ---- autopep8-1.6.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-autopep8.spec ++++++ --- /var/tmp/diff_new_pack.KhAnQj/_old 2021-11-10 21:46:23.831810119 +0100 +++ /var/tmp/diff_new_pack.KhAnQj/_new 2021-11-10 21:46:23.847810127 +0100 @@ -18,18 +18,18 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-autopep8 -Version: 1.5.7 +Version: 1.6.0 Release: 0 Summary: Automatic generated to pep8 checked code License: MIT Group: Development/Languages/Python URL: https://github.com/hhatto/autopep8 Source: https://files.pythonhosted.org/packages/source/a/autopep8/autopep8-%{version}.tar.gz -BuildRequires: %{python_module pycodestyle >= 2.7} +BuildRequires: %{python_module pycodestyle >= 2.8} BuildRequires: %{python_module setuptools} BuildRequires: %{python_module toml} BuildRequires: python-rpm-macros -Requires: python-pycodestyle >= 2.7 +Requires: python-pycodestyle >= 2.8 Requires: python-setuptools Requires: python-toml Requires(post): update-alternatives ++++++ autopep8-1.5.7.tar.gz -> autopep8-1.6.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autopep8-1.5.7/PKG-INFO new/autopep8-1.6.0/PKG-INFO --- old/autopep8-1.5.7/PKG-INFO 2021-04-30 08:04:38.000000000 +0200 +++ new/autopep8-1.6.0/PKG-INFO 2021-10-24 08:47:29.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: autopep8 -Version: 1.5.7 +Version: 1.6.0 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 @@ -449,5 +449,6 @@ Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 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.7/autopep8.egg-info/PKG-INFO new/autopep8-1.6.0/autopep8.egg-info/PKG-INFO --- old/autopep8-1.5.7/autopep8.egg-info/PKG-INFO 2021-04-30 08:04:38.000000000 +0200 +++ new/autopep8-1.6.0/autopep8.egg-info/PKG-INFO 2021-10-24 08:47:29.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: autopep8 -Version: 1.5.7 +Version: 1.6.0 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 @@ -449,5 +449,6 @@ Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 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.7/autopep8.egg-info/requires.txt new/autopep8-1.6.0/autopep8.egg-info/requires.txt --- old/autopep8-1.5.7/autopep8.egg-info/requires.txt 2021-04-30 08:04:38.000000000 +0200 +++ new/autopep8-1.6.0/autopep8.egg-info/requires.txt 2021-10-24 08:47:29.000000000 +0200 @@ -1,2 +1,2 @@ -pycodestyle>=2.7.0 +pycodestyle>=2.8.0 toml diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autopep8-1.5.7/autopep8.py new/autopep8-1.6.0/autopep8.py --- old/autopep8-1.5.7/autopep8.py 2021-04-30 08:04:15.000000000 +0200 +++ new/autopep8-1.6.0/autopep8.py 2021-10-24 08:29:35.000000000 +0200 @@ -100,7 +100,7 @@ unicode = str -__version__ = '1.5.7' +__version__ = '1.6.0' CR = '\r' @@ -531,6 +531,7 @@ options and (options.aggressive >= 2 or options.experimental) else self.fix_long_line_physically) self.fix_e703 = self.fix_e702 + self.fix_w292 = self.fix_w291 self.fix_w293 = self.fix_w291 def _fix_source(self, results): @@ -720,6 +721,11 @@ spaces_to_add = num_indent_spaces - len(_get_indentation(target)) + indent_length = len(_get_indentation(target)) + spaces_to_add = num_indent_spaces - indent_length + if num_indent_spaces == 0 and indent_length == 0: + spaces_to_add = 4 + if spaces_to_add >= 0: self.source[line_index] = (' ' * spaces_to_add + self.source[line_index]) @@ -1737,9 +1743,15 @@ Skip if ignore string is produced in the refactored code. """ + not_found_end_of_file_newline = source and source.rstrip("\r\n") == source + if not_found_end_of_file_newline: + input_source = source + "\n" + else: + input_source = source + from lib2to3 import pgen2 try: - new_text = refactor_with_2to3(source, + new_text = refactor_with_2to3(input_source, fixer_names=fixer_names, filename=filename) except (pgen2.parse.ParseError, @@ -1752,6 +1764,9 @@ if ignore in new_text and ignore not in source: return source + if not_found_end_of_file_newline: + return new_text.rstrip("\r\n") + return new_text @@ -2990,9 +3005,11 @@ return checker.report.full_error_results() -def _remove_leading_and_normalize(line): +def _remove_leading_and_normalize(line, with_rstrip=True): # ignore FF in first lstrip() - return line.lstrip(' \t\v').rstrip(CR + LF) + '\n' + if with_rstrip: + return line.lstrip(' \t\v').rstrip(CR + LF) + '\n' + return line.lstrip(' \t\v') class Reindenter(object): @@ -3019,8 +3036,11 @@ self.lines.append(line) else: # Only expand leading tabs. - self.lines.append(_get_indentation(line).expandtabs() + - _remove_leading_and_normalize(line)) + with_rstrip = line_number != len(source_lines) + self.lines.append( + _get_indentation(line).expandtabs() + + _remove_leading_and_normalize(line, with_rstrip) + ) self.lines.insert(0, None) self.index = 1 # index into self.lines of next line @@ -3257,10 +3277,10 @@ disabled_start = None for line, commanded_enabled in sorted(enable_commands.items()): - if currently_enabled is True and commanded_enabled is False: + if commanded_enabled is False and currently_enabled is True: disabled_start = line currently_enabled = False - elif currently_enabled is False and commanded_enabled is True: + elif commanded_enabled is True and currently_enabled is False: disabled_ranges.append((disabled_start, line)) currently_enabled = True @@ -3270,6 +3290,17 @@ return disabled_ranges +def filter_disabled_results(result, disabled_ranges): + """Filter out reports based on tuple of disabled ranges. + + """ + line = result['line'] + for disabled_range in disabled_ranges: + if disabled_range[0] <= line <= disabled_range[1]: + return False + return True + + def filter_results(source, results, aggressive): """Filter out spurious reports from pycodestyle. @@ -3285,11 +3316,13 @@ # Filter out the disabled ranges disabled_ranges = get_disabled_ranges(source) - if len(disabled_ranges) > 0: - results = [result for result in results - if any(result['line'] not in range(*disabled_range) - for disabled_range in disabled_ranges) - ] + if disabled_ranges: + results = [ + result for result in results if filter_disabled_results( + result, + disabled_ranges, + ) + ] has_e901 = any(result['id'].lower() == 'e901' for result in results) @@ -3448,9 +3481,11 @@ """Return fixed line endings. All lines will be modified to use the most common line ending. - """ - return [line.rstrip('\n\r') + newline for line in lines] + line = [line.rstrip('\n\r') + newline for line in lines] + if line and lines[-1] == lines[-1].rstrip('\n\r'): + line[-1] = line[-1].rstrip('\n\r') + return line def mutual_startswith(a, b): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autopep8-1.5.7/setup.py new/autopep8-1.6.0/setup.py --- old/autopep8-1.5.7/setup.py 2021-03-22 09:27:11.000000000 +0100 +++ new/autopep8-1.6.0/setup.py 2021-10-24 08:24:34.000000000 +0200 @@ -10,7 +10,7 @@ INSTALL_REQUIRES = ( - ['pycodestyle >= 2.7.0', 'toml'] + ['pycodestyle >= 2.8.0', 'toml'] ) @@ -47,6 +47,7 @@ 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', '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.7/test/test_autopep8.py new/autopep8-1.6.0/test/test_autopep8.py --- old/autopep8-1.5.7/test/test_autopep8.py 2021-03-31 16:50:32.000000000 +0200 +++ new/autopep8-1.6.0/test/test_autopep8.py 2021-10-24 08:24:34.000000000 +0200 @@ -1765,6 +1765,20 @@ with autopep8_context(line, options=['--hang-closing']) as result: self.assertEqual(fixed, result) + def test_e133_no_indentation_line(self): + line = """\ +e = [ + 1, 2 +] +""" + fixed = """\ +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: @@ -3829,6 +3843,20 @@ with autopep8_context(line) as result: self.assertEqual(fixed, result) + @unittest.skipIf( + (sys.version_info.major >= 3 and sys.version_info.minor < 8) + or sys.version_info.major < 3, + "syntax error in Python3.7 and lower version", + ) + def test_e501_with_pep572_assignment_expressions(self): + line = """\ +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = 1 +if bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb := aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: + print(bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb) +""" + with autopep8_context(line, options=['-aa']) as result: + self.assertEqual(line, result) + def test_e502(self): line = "print('abc'\\\n 'def')\n" fixed = "print('abc'\n 'def')\n" @@ -4419,6 +4447,12 @@ '--select=W292']) as result: self.assertEqual(fixed, result) + def test_w292_ignore(self): + line = "1\n2" + with autopep8_context(line, options=['--aggressive', + '--ignore=W292']) as result: + self.assertEqual(line, result) + def test_w293(self): line = '1\n \n2\n' fixed = '1\n\n2\n' @@ -5201,6 +5235,32 @@ with autopep8_context(test_code) as result: self.assertEqual(expected_output, result) + def test_autopep8_disable_multi(self): + test_code = """\ +fix=1 +# autopep8: off +skip=1 +# autopep8: on +fix=2 +# autopep8: off +skip=2 +# autopep8: on +fix=3 +""" + expected_output = """\ +fix = 1 +# autopep8: off +skip=1 +# autopep8: on +fix = 2 +# autopep8: off +skip=2 +# autopep8: on +fix = 3 +""" + with autopep8_context(test_code) as result: + self.assertEqual(expected_output, result) + def test_fmt_disable(self): test_code = """\ # fmt: off @@ -5275,6 +5335,92 @@ with autopep8_context(test_code) as result: self.assertEqual(expected_output, result) + def test_fmt_multi_disable_and_reenable(self): + test_code = """\ +fix=1 +# fmt: off +skip=1 +# fmt: on +fix=2 +# fmt: off +skip=2 +# fmt: on +fix=3 +""" + expected_output = """\ +fix = 1 +# fmt: off +skip=1 +# fmt: on +fix = 2 +# fmt: off +skip=2 +# fmt: on +fix = 3 +""" + with autopep8_context(test_code) as result: + self.assertEqual(expected_output, result) + + def test_fmt_multi_disable_complex(self): + test_code = """\ +fix=1 +# fmt: off +skip=1 +# fmt: off +fix=2 +# fmt: off +skip=2 +# fmt: on +fix=3 +""" + expected_output = """\ +fix = 1 +# fmt: off +skip=1 +# fmt: off +fix=2 +# fmt: off +skip=2 +# fmt: on +fix = 3 +""" + with autopep8_context(test_code) as result: + self.assertEqual(expected_output, result) + + def test_fmt_multi_disable_complex_multi(self): + test_code = """\ +fix=1 +# fmt: off +skip=1 +# fmt: off +fix=2 +# fmt: on +fix=22 +# fmt: on +fix=222 +# fmt: off +skip=2 +# fmt: on +fix=3 +""" + expected_output = """\ +fix = 1 +# fmt: off +skip=1 +# fmt: off +fix=2 +# fmt: on +fix = 22 +# fmt: on +fix = 222 +# fmt: off +skip=2 +# fmt: on +fix = 3 +""" + with autopep8_context(test_code) as result: + self.assertEqual(expected_output, result) + def test_general_disable(self): test_code = """\ # fmt: off @@ -5503,7 +5649,6 @@ def test_exit_code_with_io_error(self): line = "import sys\ndef a():\n print(1)\n" with readonly_temporary_file_context(line) as filename: - print(filename) p = Popen(list(AUTOPEP8_CMD_TUPLE) + ['--in-place', filename], stdout=PIPE, stderr=PIPE) p.communicate() @@ -5662,6 +5807,7 @@ ['--jobs=3', '--diff'], stdout=PIPE) p.wait() output = p.stdout.read().decode() + p.stdout.close() actual_diffs = [] for filename in files: @@ -6045,7 +6191,8 @@ target_filename = os.path.join(dirname, "foo.py") with open(target_filename, "w") as fp: fp.write(line) - p = Popen(list(AUTOPEP8_CMD_TUPLE) + [target_filename], stdout=PIPE) + p = Popen(list(AUTOPEP8_CMD_TUPLE) + + [target_filename], stdout=PIPE) self.assertEqual(p.communicate()[0].decode("utf-8"), line) self.assertEqual(p.returncode, autopep8.EXIT_CODE_OK) @@ -6060,7 +6207,8 @@ target_filename = os.path.join(dirname, "foo.py") with open(target_filename, "w") as fp: fp.write(line) - p = Popen(list(AUTOPEP8_CMD_TUPLE) + [target_filename, "-vvv"], stdout=PIPE) + p = Popen(list(AUTOPEP8_CMD_TUPLE) + + [target_filename, "-vvv"], stdout=PIPE) output = p.communicate()[0].decode("utf-8") self.assertTrue(line in output) self.assertTrue(verbose_line in output) @@ -6075,7 +6223,8 @@ target_filename = os.path.join(dirname, "foo.py") with open(target_filename, "w") as fp: fp.write(line) - p = Popen(list(AUTOPEP8_CMD_TUPLE) + [target_filename, ], stdout=PIPE) + p = Popen(list(AUTOPEP8_CMD_TUPLE) + + [target_filename, ], stdout=PIPE) output = p.communicate()[0].decode("utf-8") self.assertTrue(line in output) self.assertEqual(p.returncode, autopep8.EXIT_CODE_OK)