commit python-autopep8 for openSUSE:Factory
Hello community, here is the log from the commit of package python-autopep8 for openSUSE:Factory checked in at 2018-04-02 22:49:28 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-autopep8 (Old) and /work/SRC/openSUSE:Factory/.python-autopep8.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "python-autopep8" Mon Apr 2 22:49:28 2018 rev:11 rq:592968 version:1.3.5 Changes: -------- --- /work/SRC/openSUSE:Factory/python-autopep8/python-autopep8.changes 2018-02-05 10:53:45.982187419 +0100 +++ /work/SRC/openSUSE:Factory/.python-autopep8.new/python-autopep8.changes 2018-04-02 22:49:28.817292852 +0200 @@ -1,0 +2,24 @@ +Sun Apr 1 22:33:48 UTC 2018 - arun@gmx.de + +- update to version 1.3.5: + * add pypi version badge + * refactoring (strict pylint) + * fix e713 and e714 chain cases + * add test for e713 and e714 chain cases + * avoid e265 + * add test for #389 + * fix e265 when starts non-alphanumeric symbols (#389) + * Drop support for EOL Python 3.3 + * Remove redundant Python 2.6 code + * Rewrite unnecessary list comprehension as dict comprehension + * Rewrite unnecessary dict call as literal + * Rewrite unnecessary list literal as set literal + * Rewrite unnecessary generator as set comprehension + * Rewrite unnecessary generator as set comprehension + * Use automatic formatters (py2.7+) + * Remove redundant Python 2.6 code + * change: not affeted FF(FromFeed) in Reindenter + * add unit test for #322 + * read flake8 config + +------------------------------------------------------------------- Old: ---- autopep8-1.3.4.tar.gz New: ---- autopep8-1.3.5.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-autopep8.spec ++++++ --- /var/tmp/diff_new_pack.p9fwze/_old 2018-04-02 22:49:29.517267402 +0200 +++ /var/tmp/diff_new_pack.p9fwze/_new 2018-04-02 22:49:29.521267257 +0200 @@ -18,7 +18,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-autopep8 -Version: 1.3.4 +Version: 1.3.5 Release: 0 Summary: Automatic generated to pep8 checked code License: MIT ++++++ autopep8-1.3.4.tar.gz -> autopep8-1.3.5.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autopep8-1.3.4/PKG-INFO new/autopep8-1.3.5/PKG-INFO --- old/autopep8-1.3.4/PKG-INFO 2018-01-24 14:46:35.000000000 +0100 +++ new/autopep8-1.3.5/PKG-INFO 2018-03-30 09:32:39.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: autopep8 -Version: 1.3.4 +Version: 1.3.5 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 @@ -11,6 +11,10 @@ autopep8 ======== + .. image:: https://img.shields.io/pypi/v/autopep8.svg + :target: https://pypi.python.org/pypi/autopep8 + :alt: PyPI Version + .. image:: https://travis-ci.org/hhatto/autopep8.svg?branch=master :target: https://travis-ci.org/hhatto/autopep8 :alt: Build status @@ -237,8 +241,8 @@ autopep8 also fixes some issues not found by pycodestyle_. - Correct deprecated or non-idiomatic Python code (via ``lib2to3``). Use this - for making Python 2.6 and 2.7 code more compatible with Python 3. (This is - triggered if ``W690`` is enabled.) + for making Python 2.7 code more compatible with Python 3. (This is triggered + if ``W690`` is enabled.) - Normalize files with mixed line endings. - Put a blank line between a class docstring and its first method declaration. (Enabled with ``E301``.) @@ -325,7 +329,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, 3.5 and 3.6. We also test against PyPy.) + CPython versions 2.7, 3.4, 3.5 and 3.6. We also test against PyPy.) .. _`tox`: https://pypi.python.org/pypi/tox @@ -373,12 +377,10 @@ Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 2 -Classifier: Programming Language :: Python :: 2.6 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.2 -Classifier: Programming Language :: Python :: 3.3 Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 +Classifier: Programming Language :: Python :: 3.6 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.3.4/README.rst new/autopep8-1.3.5/README.rst --- old/autopep8-1.3.4/README.rst 2018-01-22 03:30:33.000000000 +0100 +++ new/autopep8-1.3.5/README.rst 2018-03-30 07:24:40.000000000 +0200 @@ -2,6 +2,10 @@ autopep8 ======== +.. image:: https://img.shields.io/pypi/v/autopep8.svg + :target: https://pypi.python.org/pypi/autopep8 + :alt: PyPI Version + .. image:: https://travis-ci.org/hhatto/autopep8.svg?branch=master :target: https://travis-ci.org/hhatto/autopep8 :alt: Build status @@ -228,8 +232,8 @@ autopep8 also fixes some issues not found by pycodestyle_. - Correct deprecated or non-idiomatic Python code (via ``lib2to3``). Use this - for making Python 2.6 and 2.7 code more compatible with Python 3. (This is - triggered if ``W690`` is enabled.) + for making Python 2.7 code more compatible with Python 3. (This is triggered + if ``W690`` is enabled.) - Normalize files with mixed line endings. - Put a blank line between a class docstring and its first method declaration. (Enabled with ``E301``.) @@ -316,7 +320,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, 3.5 and 3.6. We also test against PyPy.) +CPython versions 2.7, 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.4/autopep8.egg-info/PKG-INFO new/autopep8-1.3.5/autopep8.egg-info/PKG-INFO --- old/autopep8-1.3.4/autopep8.egg-info/PKG-INFO 2018-01-24 14:46:34.000000000 +0100 +++ new/autopep8-1.3.5/autopep8.egg-info/PKG-INFO 2018-03-30 09:32:39.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: autopep8 -Version: 1.3.4 +Version: 1.3.5 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 @@ -11,6 +11,10 @@ autopep8 ======== + .. image:: https://img.shields.io/pypi/v/autopep8.svg + :target: https://pypi.python.org/pypi/autopep8 + :alt: PyPI Version + .. image:: https://travis-ci.org/hhatto/autopep8.svg?branch=master :target: https://travis-ci.org/hhatto/autopep8 :alt: Build status @@ -237,8 +241,8 @@ autopep8 also fixes some issues not found by pycodestyle_. - Correct deprecated or non-idiomatic Python code (via ``lib2to3``). Use this - for making Python 2.6 and 2.7 code more compatible with Python 3. (This is - triggered if ``W690`` is enabled.) + for making Python 2.7 code more compatible with Python 3. (This is triggered + if ``W690`` is enabled.) - Normalize files with mixed line endings. - Put a blank line between a class docstring and its first method declaration. (Enabled with ``E301``.) @@ -325,7 +329,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, 3.5 and 3.6. We also test against PyPy.) + CPython versions 2.7, 3.4, 3.5 and 3.6. We also test against PyPy.) .. _`tox`: https://pypi.python.org/pypi/tox @@ -373,12 +377,10 @@ Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 2 -Classifier: Programming Language :: Python :: 2.6 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.2 -Classifier: Programming Language :: Python :: 3.3 Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 +Classifier: Programming Language :: Python :: 3.6 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.3.4/autopep8.py new/autopep8-1.3.5/autopep8.py --- old/autopep8-1.3.4/autopep8.py 2018-01-24 14:45:43.000000000 +0100 +++ new/autopep8-1.3.5/autopep8.py 2018-03-30 07:20:51.000000000 +0200 @@ -40,6 +40,7 @@ from __future__ import print_function from __future__ import unicode_literals +import argparse import codecs import collections import copy @@ -66,7 +67,7 @@ unicode = str -__version__ = '1.3.4' +__version__ = '1.3.5' CR = '\r' @@ -76,8 +77,8 @@ PYTHON_SHEBANG_REGEX = re.compile(r'^#!.*\bpython[23]?\b\s*$') LAMBDA_REGEX = re.compile(r'([\w.]+)\s=\slambda\s*([\(\)\w,\s.]*):') -COMPARE_NEGATIVE_REGEX = re.compile(r'\b(not)\s+([^][)(}{]+)\s+(in|is)\s') -COMPARE_NEGATIVE_REGEX_THROUGH = re.compile(r'\b(not\s+in)\s') +COMPARE_NEGATIVE_REGEX = re.compile(r'\b(not)\s+([^][)(}{]+?)\s+(in|is)\s') +COMPARE_NEGATIVE_REGEX_THROUGH = re.compile(r'\b(not\s+in|is\s+not)\s') BARE_EXCEPT_REGEX = re.compile(r'except\s*:') STARTSWITH_DEF_REGEX = re.compile(r'^(async\s+def|def)\s.*\):') @@ -170,7 +171,7 @@ """Check for missing blank lines after class declaration.""" if previous_logical.startswith('def '): if blank_lines and pycodestyle.DOCSTRING_REGEX.match(logical_line): - yield (0, 'E303 too many blank lines ({0})'.format(blank_lines)) + yield (0, 'E303 too many blank lines ({})'.format(blank_lines)) elif pycodestyle.DOCSTRING_REGEX.match(previous_logical): # Missing blank line between class docstring and method declaration. if ( @@ -261,21 +262,21 @@ if close_bracket and indent[depth]: # Closing bracket for visual indent. if start[1] != indent[depth]: - yield (start, 'E124 {0}'.format(indent[depth])) + yield (start, 'E124 {}'.format(indent[depth])) elif close_bracket and not hang: # closing bracket matches indentation of opening bracket's line if hang_closing: - yield (start, 'E133 {0}'.format(indent[depth])) + yield (start, 'E133 {}'.format(indent[depth])) elif indent[depth] and start[1] < indent[depth]: # Visual indent is broken. - yield (start, 'E128 {0}'.format(indent[depth])) + yield (start, 'E128 {}'.format(indent[depth])) elif (hanging_indent or (indent_next and rel_indent[row] == 2 * DEFAULT_INDENT_SIZE)): # Hanging indent is verified. if close_bracket and not hang_closing: - yield (start, 'E123 {0}'.format(indent_level + - rel_indent[open_row])) + yield (start, 'E123 {}'.format(indent_level + + rel_indent[open_row])) hangs[depth] = hang elif visual_indent is True: # Visual indent is verified. @@ -299,7 +300,7 @@ hangs[depth] = hang error = ('E121', one_indented) - yield (start, '{0} {1}'.format(*error)) + yield (start, '{} {}'.format(*error)) # Look for visual indenting. if ( @@ -371,9 +372,9 @@ pos = (start[0], indent[0] + 4) desired_indent = indent_level + 2 * DEFAULT_INDENT_SIZE if visual_indent: - yield (pos, 'E129 {0}'.format(desired_indent)) + yield (pos, 'E129 {}'.format(desired_indent)) else: - yield (pos, 'E125 {0}'.format(desired_indent)) + yield (pos, 'E125 {}'.format(desired_indent)) del pycodestyle._checks['logical_line'][pycodestyle.continued_indentation] @@ -531,14 +532,14 @@ else: if self.options.verbose >= 3: print( - "---> '{0}' is not defined.".format(fixed_methodname), + "---> '{}' is not defined.".format(fixed_methodname), file=sys.stderr) info = result['info'].strip() - print('---> {0}:{1}:{2}:{3}'.format(self.filename, - result['line'], - result['column'], - info), + print('---> {}:{}:{}:{}'.format(self.filename, + result['line'], + result['column'], + info), file=sys.stderr) def fix(self): @@ -982,7 +983,7 @@ self.source) match = STARTSWITH_DEF_REGEX.match(target) if match: - self.source[line_index] = '{0}\n{1}{2}'.format( + self.source[line_index] = '{}\n{}{}'.format( match.group(0), _get_indentation(target) + self.indent_word, target[match.end(0):].lstrip()) @@ -1063,7 +1064,7 @@ if match_notin: notin_pos_start = match_notin.start(1) notin_pos_end = match_notin.end() - target = '{0}{1} {2}'.format( + target = '{}{} {}'.format( target[:notin_pos_start], 'in', target[notin_pos_end:]) # fix 'not in' @@ -1078,22 +1079,40 @@ # revert 'in' -> 'not in' pos_start = notin_pos_start + offset pos_end = notin_pos_end + offset - 4 # len('not ') - new_target = '{0}{1} {2}'.format( + new_target = '{}{} {}'.format( new_target[:pos_start], 'not in', new_target[pos_end:]) self.source[line_index] = new_target def fix_e714(self, result): """Fix object identity should be 'is not' case.""" - (line_index, _, target) = get_index_offset_contents(result, - self.source) + (line_index, offset, target) = get_index_offset_contents(result, + self.source) + + # to convert once 'is not' -> 'is' + before_target = target[:offset] + target = target[offset:] + match_isnot = COMPARE_NEGATIVE_REGEX_THROUGH.search(target) + isnot_pos_start, isnot_pos_end = 0, 0 + if match_isnot: + isnot_pos_start = match_isnot.start(1) + isnot_pos_end = match_isnot.end() + target = '{}{} {}'.format( + target[:isnot_pos_start], 'in', target[isnot_pos_end:]) match = COMPARE_NEGATIVE_REGEX.search(target) if match: - if match.group(3) == 'is': + if match.group(3).startswith('is'): pos_start = match.start(1) - self.source[line_index] = '{0}{1} {2} {3} {4}'.format( + new_target = '{5}{0}{1} {2} {3} {4}'.format( target[:pos_start], match.group(2), match.group(3), - match.group(1), target[match.end():]) + match.group(1), target[match.end():], before_target) + if match_isnot: + # revert 'is' -> 'is not' + pos_start = isnot_pos_start + offset + pos_end = isnot_pos_end + offset - 4 # len('not ') + new_target = '{}{} {}'.format( + new_target[:pos_start], 'is not', new_target[pos_end:]) + self.source[line_index] = new_target def fix_e722(self, result): """fix bare except""" @@ -1101,7 +1120,7 @@ self.source) match = BARE_EXCEPT_REGEX.search(target) if match: - self.source[line_index] = '{0}{1}{2}'.format( + self.source[line_index] = '{}{}{}'.format( target[:result['column'] - 1], "except BaseException:", target[match.end():]) @@ -1112,7 +1131,7 @@ match = LAMBDA_REGEX.search(target) if match: end = match.end() - self.source[line_index] = '{0}def {1}({2}): return {3}'.format( + self.source[line_index] = '{}def {}({}): return {}'.format( target[:match.start(0)], match.group(1), match.group(2), target[end:].lstrip()) @@ -1146,7 +1165,7 @@ if not _is_binary_operator(ts[0][0], one_string_token): return # find comment - comment_index = None + comment_index = 0 for i in range(5): # NOTE: try to parse code in 5 times if (line_index - i) < 0: @@ -1167,28 +1186,25 @@ tts = ts[newline_index[-3]:] else: tts = ts - old = None + old = [] for t in tts: - if tokenize.COMMENT == t[0]: - if old is None: - comment_index = 0 - else: - comment_index = old[3][1] + if tokenize.COMMENT == t[0] and old: + comment_index = old[3][1] break old = t break i = target.index(one_string_token) - self.source[line_index] = '{0}{1}'.format( + self.source[line_index] = '{}{}'.format( target[:i], target[i + len(one_string_token):]) nl = find_newline(self.source[line_index - 1:line_index]) before_line = self.source[line_index - 1] bl = before_line.index(nl) if comment_index: - self.source[line_index - 1] = '{0} {1} {2}'.format( + self.source[line_index - 1] = '{} {} {}'.format( before_line[:comment_index], one_string_token, before_line[comment_index + 1:]) else: - self.source[line_index - 1] = '{0} {1}{2}'.format( + self.source[line_index - 1] = '{} {}{}'.format( before_line[:bl], one_string_token, before_line[bl:]) @@ -1406,7 +1422,9 @@ if c != '#')) if ( # Leave multiple spaces like '# ' alone. - (line[:pos].count('#') > 1 or line[1].isalnum()) and + (line[:pos].count('#') > 1 or line[1].isalnum() or + not line[1].isspace()) and + line[1] not in ':!' and # Leave stylistic outlined blocks alone. not line.rstrip().endswith('#') ): @@ -1448,8 +1466,8 @@ for code, fix in CODE_TO_2TO3.items(): if code_match(code, select=select, ignore=ignore): if verbose: - print('---> Applying {0} fix for {1}'.format(where, - code.upper()), + print('---> Applying {} fix for {}'.format(where, + code.upper()), file=sys.stderr) fixes |= set(fix) return fixes @@ -2680,7 +2698,8 @@ def _remove_leading_and_normalize(line): - return line.lstrip().rstrip(CR + LF) + '\n' + # ignore FF in first lstrip() + return line.lstrip(' \t\v').rstrip(CR + LF) + '\n' class Reindenter(object): @@ -3143,8 +3162,8 @@ 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]) + codes = {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, @@ -3226,7 +3245,7 @@ def _get_parameters(function): # pylint: disable=deprecated-method - if sys.version_info >= (3, 3): + if sys.version_info.major >= 3: # We need to match "getargspec()", which includes "self" as the first # value for methods. # https://bugs.python.org/issue17481#msg209469 @@ -3259,8 +3278,8 @@ continue if code_match(code, select=options.select, ignore=options.ignore): if options.verbose: - print('---> Applying {0} fix for {1}'.format(where, - code.upper()), + print('---> Applying {} fix for {}'.format(where, + code.upper()), file=sys.stderr) source = function(source, aggressive=options.aggressive) @@ -3294,20 +3313,16 @@ def _get_package_version(): - packages = ["pycodestyle: {0}".format(pycodestyle.__version__)] + packages = ["pycodestyle: {}".format(pycodestyle.__version__)] return ", ".join(packages) def create_parser(): """Return command-line parser.""" - # Do import locally to be friendly to those who use autopep8 as a library - # and are supporting Python 2.6. - import argparse - parser = argparse.ArgumentParser(description=docstring_summary(__doc__), prog='autopep8') parser.add_argument('--version', action='version', - version='%(prog)s {0} ({1})'.format( + version='%(prog)s {} ({})'.format( __version__, _get_package_version())) parser.add_argument('-v', '--verbose', action='count', default=0, @@ -3321,7 +3336,7 @@ default=DEFAULT_CONFIG, help='path to a global pep8 config file; if this file ' 'does not exist then this is ignored ' - '(default: {0})'.format(DEFAULT_CONFIG)) + '(default: {})'.format(DEFAULT_CONFIG)) parser.add_argument('--ignore-local-config', action='store_true', help="don't look for and apply local config files; " 'if not passed, defaults are updated with any ' @@ -3349,7 +3364,7 @@ 'used by --ignore and --select') parser.add_argument('--ignore', metavar='errors', default='', help='do not fix these errors/warnings ' - '(default: {0})'.format(DEFAULT_IGNORE)) + '(default: {})'.format(DEFAULT_IGNORE)) parser.add_argument('--select', metavar='errors', default='', help='fix only these errors/warnings (e.g. E4,W)') parser.add_argument('--max-line-length', metavar='n', default=79, type=int, @@ -3420,14 +3435,14 @@ elif not args.select: if args.aggressive: # Enable everything by default if aggressive. - args.select = set(['E', 'W']) + args.select = {'E', 'W'} else: args.ignore = _split_comma_separated(DEFAULT_IGNORE) if args.exclude: args.exclude = _split_comma_separated(args.exclude) else: - args.exclude = set([]) + args.exclude = {} if args.jobs < 1: # Do not import multiprocessing globally in case it is not supported @@ -3471,11 +3486,11 @@ break (parent, tail) = os.path.split(parent) - defaults = dict() - option_list = dict([(o.dest, o.type or type(o.default)) - for o in parser._actions]) + defaults = {} + option_list = {o.dest: o.type or type(o.default) + for o in parser._actions} - for section in ['pep8', 'pycodestyle']: + for section in ['pep8', 'pycodestyle', 'flake8']: if not config.has_section(section): continue for (k, _) in config.items(section): @@ -3504,7 +3519,7 @@ def _split_comma_separated(string): """Return a set of strings.""" - return set(text.strip() for text in string.split(',') if text.strip()) + return {text.strip() for text in string.split(',') if text.strip()} def decode_filename(filename): @@ -3801,7 +3816,7 @@ def _fix_file(parameters): """Helper function for optionally running fix_file() in parallel.""" if parameters[1].verbose: - print('[file:{0}]'.format(parameters[0]), file=sys.stderr) + print('[file:{}]'.format(parameters[0]), file=sys.stderr) try: fix_file(*parameters) except IOError as error: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autopep8-1.3.4/setup.py new/autopep8-1.3.5/setup.py --- old/autopep8-1.3.4/setup.py 2017-10-11 10:09:28.000000000 +0200 +++ new/autopep8-1.3.5/setup.py 2018-03-30 06:25:19.000000000 +0200 @@ -5,14 +5,12 @@ import ast import io -import sys from setuptools import setup INSTALL_REQUIRES = ( - ['pycodestyle >= 2.3'] + - (['argparse'] if sys.version_info < (2, 7) else []) + ['pycodestyle >= 2.3'] ) @@ -43,13 +41,11 @@ 'Operating System :: OS Independent', 'Programming Language :: Python', 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.2', - 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', 'Topic :: Software Development :: Libraries :: Python Modules', 'Topic :: Software Development :: Quality Assurance', ], diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autopep8-1.3.4/test/example_with_reduce.py new/autopep8-1.3.5/test/example_with_reduce.py --- old/autopep8-1.3.4/test/example_with_reduce.py 2017-10-11 10:09:28.000000000 +0200 +++ new/autopep8-1.3.5/test/example_with_reduce.py 2018-03-30 06:25:19.000000000 +0200 @@ -66,7 +66,7 @@ from os.path import isdir, split # Avoid try/except due to potential problems with delayed import mechanisms. -if sys.version_info >= (3, 3) and sys.implementation.name == "cpython": +if sys.version_info.major >= 3 and sys.implementation.name == "cpython": import importlib._bootstrap as importlib_bootstrap else: importlib_bootstrap = None @@ -256,12 +256,7 @@ XXX Currently this is the same as ``distutils.util.get_platform()``, but it needs some hacks for Linux and Mac OS X. """ - try: - # Python 2.7 or >=3.2 - from sysconfig import get_platform - except ImportError: - from distutils.util import get_platform - + from sysconfig import get_platform plat = get_platform() if sys.platform == "darwin" and not plat.startswith('macosx-'): try: @@ -1297,7 +1292,7 @@ def has_metadata(self, name): return self.egg_info and self._has(self._fn(self.egg_info,name)) - if sys.version_info <= (3,): + if sys.version_info.major == 2: def get_metadata(self, name): if not self.egg_info: return "" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/autopep8-1.3.4/test/test_autopep8.py new/autopep8-1.3.5/test/test_autopep8.py --- old/autopep8-1.3.4/test/test_autopep8.py 2018-01-22 07:29:04.000000000 +0100 +++ new/autopep8-1.3.5/test/test_autopep8.py 2018-03-30 07:17:19.000000000 +0200 @@ -16,11 +16,6 @@ import re import sys -if sys.version_info < (2, 7): - import unittest2 as unittest -else: - import unittest - import contextlib import io import shutil @@ -28,6 +23,7 @@ from tempfile import mkstemp import tempfile import tokenize +import unittest import warnings try: @@ -219,6 +215,10 @@ '# abc "# noqa"', autopep8.fix_e265('# abc "# noqa"')) + self.assertEqual( + '# *abc', + autopep8.fix_e265('#*abc')) + def test_format_block_comments_should_leave_outline_alone(self): line = """\ ################################################################### @@ -564,6 +564,16 @@ self.assertEqual(' #\nif True:\n pass\n', reindenter.run()) + def test_reindenter_not_affect_with_formfeed(self): + lines = """print('hello') + +print('python') +""" + reindenter = autopep8.Reindenter(lines) + + self.assertEqual(lines, + reindenter.run()) + def test_fix_e225_avoid_failure(self): fix_pep8 = autopep8.FixPEP8(filename='', options=autopep8.parse_args(['']), @@ -1037,7 +1047,7 @@ # report properly, the below command will take a long time. p = Popen(list(AUTOPEP8_CMD_TUPLE) + ['-vvv', '--select=E101', '--diff', - '--global-config={0}'.format(os.devnull), + '--global-config={}'.format(os.devnull), os.path.join(ROOT_DIR, 'test', 'e101_example.py')], stdout=PIPE, stderr=PIPE) output = [x.decode('utf-8') for x in p.communicate()][0] @@ -3477,12 +3487,13 @@ def test_e501_aggressive_long_comment_and_long_line(self): line = """\ def foo(): - #. This is not a novel to be tossed aside lightly. It should be throw with great force. + # This is not a novel to be tossed aside lightly. It should be throw with great force. self.xxxxxxxxx(_('yyyyyyyyyyyyy yyyyyyyyyyyy yyyyyyyy yyyyyyyy y'), 'zzzzzzzzzzzzzzzzzzz', bork='urgent') """ fixed = """\ def foo(): - #. This is not a novel to be tossed aside lightly. It should be throw with great force. + # This is not a novel to be tossed aside lightly. It should be throw with + # great force. self.xxxxxxxxx( _('yyyyyyyyyyyyy yyyyyyyyyyyy yyyyyyyy yyyyyyyy y'), 'zzzzzzzzzzzzzzzzzzz', @@ -3879,6 +3890,13 @@ options=['-aa', '--select=E713']) as result: self.assertEqual(fixed, result) + def test_e713_with_in(self): + line = 'if not "." in y and "," in y:\n pass\n' + fixed = 'if "." not in y and "," in y:\n pass\n' + with autopep8_context(line, + options=['-aa', '--select=E713']) as result: + self.assertEqual(fixed, result) + def test_e713_with_tuple(self): line = """ if not role in ("domaincontroller_master", @@ -3921,6 +3939,13 @@ options=['-aa', '--select=E713']) as result: self.assertEqual(fixed, result) + def test_e713_chain4(self): + line = 'if not "." in y and not "," in y:\n pass\n' + fixed = 'if "." not in y and "," not in y:\n pass\n' + with autopep8_context(line, + options=['-aa', '--select=E713']) as result: + self.assertEqual(fixed, result) + def test_e714(self): line = 'if not x is y:\n pass\n' fixed = 'if x is not y:\n pass\n' @@ -3928,6 +3953,20 @@ options=['-aa', '--select=E714']) as result: self.assertEqual(fixed, result) + def test_e714_with_is(self): + line = 'if not x is y or x is z:\n pass\n' + fixed = 'if x is not y or x is z:\n pass\n' + with autopep8_context(line, + options=['-aa', '--select=E714']) as result: + self.assertEqual(fixed, result) + + def test_e714_chain(self): + line = 'if not x is y or not x is z:\n pass\n' + fixed = 'if x is not y or x is not z:\n pass\n' + with autopep8_context(line, + options=['-aa', '--select=E714']) as result: + self.assertEqual(fixed, result) + def test_e713_and_e714(self): line = """ if not x is y: @@ -4253,8 +4292,6 @@ with autopep8_context(line, options=['--aggressive']) as result: self.assertEqual(fixed, result) - @unittest.skipIf(sys.version_info < (2, 6, 4), - 'older versions of 2.6 may be buggy') def test_w601_with_non_ascii(self): line = """\ # -*- coding: utf-8 -*- @@ -4820,7 +4857,7 @@ def test_local_config(self): args = autopep8.parse_args( [os.path.join(FAKE_CONFIGURATION, 'foo.py'), - '--global-config={0}'.format(os.devnull)], + '--global-config={}'.format(os.devnull)], apply_config=True) self.assertEqual(args.indent_size, 2) @@ -4850,7 +4887,7 @@ def test_local_pycodestyle_config_line_length(self): args = autopep8.parse_args( [os.path.join(FAKE_PYCODESTYLE_CONFIGURATION, 'foo.py'), - '--global-config={0}'.format(os.devnull)], + '--global-config={}'.format(os.devnull)], apply_config=True) self.assertEqual(args.max_line_length, 40) @@ -4864,7 +4901,7 @@ def test_config_false_without_local(self): args = autopep8.parse_args(['/nowhere/foo.py', - '--global-config={0}'.format(os.devnull)], + '--global-config={}'.format(os.devnull)], apply_config=True) self.assertEqual(args.indent_size, 4) @@ -4872,7 +4909,7 @@ with temporary_file_context('[pep8]\nindent-size=3\n') as filename: args = autopep8.parse_args( [os.path.join(FAKE_CONFIGURATION, 'foo.py'), - '--global-config={0}'.format(filename)], + '--global-config={}'.format(filename)], apply_config=True) self.assertEqual(args.indent_size, 2) @@ -4880,7 +4917,7 @@ with temporary_file_context('[pep8]\nindent-size=3\n') as filename: args = autopep8.parse_args( [os.path.join(FAKE_CONFIGURATION, 'foo.py'), - '--global-config={0}'.format(filename), + '--global-config={}'.format(filename), '--ignore-local-config'], apply_config=True) self.assertEqual(args.indent_size, 3) @@ -4888,7 +4925,7 @@ def test_global_config_without_locals(self): with temporary_file_context('[pep8]\nindent-size=3\n') as filename: args = autopep8.parse_args( - ['/nowhere/foo.py', '--global-config={0}'.format(filename)], + ['/nowhere/foo.py', '--global-config={}'.format(filename)], apply_config=True) self.assertEqual(args.indent_size, 3) @@ -4896,7 +4933,7 @@ with temporary_file_context('[pep8]\naggressive=1\n') as filename: args = autopep8.parse_args( [os.path.join(FAKE_CONFIGURATION, 'foo.py'), - '--global-config={0}'.format(filename)], + '--global-config={}'.format(filename)], apply_config=True) self.assertEqual(args.aggressive, 1) @@ -4909,7 +4946,7 @@ with temporary_file_context(configstr) as filename: args = autopep8.parse_args( [os.path.join(FAKE_CONFIGURATION, 'foo.py'), - '--global-config={0}'.format(filename)], + '--global-config={}'.format(filename)], apply_config=True) self.assertEqual(args.aggressive, 1) @@ -5669,8 +5706,6 @@ with autopep8_context(line, options=['--experimental']) as result: self.assertEqual(fixed, result) - @unittest.skipIf(sys.version_info < (2, 7), - 'Python 2.6 does not support dictionary comprehensions') def test_e501_experimental_with_complex_reformat(self): line = """\ bork(111, 111, 111, 111, 222, 222, 222, { 'foo': 222, 'qux': 222 }, ((['hello', 'world'], ['yo', 'stella', "how's", 'it'], ['going']), {str(i): i for i in range(10)}, {'bork':((x, x**x) for x in range(10))}), 222, 222, 222, 222, 333, 333, 333, 333) @@ -6165,7 +6200,7 @@ with autopep8_context(line, options=['--experimental']) as result: self.assertEqual(fixed, result) - @unittest.skipIf(sys.version_info >= (3, ), 'syntax error in Python3') + @unittest.skipIf(sys.version_info.major >= 3, 'syntax error in Python3') def test_e501_print_isnot_function(self): line = """\ @@ -6182,6 +6217,7 @@ with autopep8_context(line, options=['--experimental']) as result: self.assertEqual(fixed, result) + @contextlib.contextmanager def autopep8_context(line, options=None): if not options:
participants (1)
-
root@hilbert.suse.de