Hello community, here is the log from the commit of package python3-pep8 for openSUSE:Factory checked in at 2015-02-16 21:47:07 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python3-pep8 (Old) and /work/SRC/openSUSE:Factory/.python3-pep8.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python3-pep8" Changes: -------- --- /work/SRC/openSUSE:Factory/python3-pep8/python3-pep8.changes 2015-02-10 20:22:37.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.python3-pep8.new/python3-pep8.changes 2015-02-16 21:47:18.000000000 +0100 @@ -1,0 +2,7 @@ +Mon Feb 16 02:01:09 UTC 2015 - [email protected] + +- update to version 1.6.2: + * Added check for breaking around a binary operator. (Issue #197, Pull #305) + * Restored config_file parameter in process_options(). (Issue #380) + +------------------------------------------------------------------- Old: ---- pep8-1.6.1.tar.gz New: ---- pep8-1.6.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python3-pep8.spec ++++++ --- /var/tmp/diff_new_pack.1beDKm/_old 2015-02-16 21:47:19.000000000 +0100 +++ /var/tmp/diff_new_pack.1beDKm/_new 2015-02-16 21:47:19.000000000 +0100 @@ -17,7 +17,7 @@ Name: python3-pep8 -Version: 1.6.1 +Version: 1.6.2 Release: 0 Url: http://github.com/jcrocholl/pep8 Summary: Python style guide checker ++++++ pep8-1.6.1.tar.gz -> pep8-1.6.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep8-1.6.1/CHANGES.txt new/pep8-1.6.2/CHANGES.txt --- old/pep8-1.6.1/CHANGES.txt 2015-02-08 22:31:01.000000000 +0100 +++ new/pep8-1.6.2/CHANGES.txt 2015-02-15 23:06:06.000000000 +0100 @@ -2,6 +2,18 @@ ========= +1.6.2 (2015-02-15) +------------------ + +Changes: + +* Added check for breaking around a binary operator. (Issue #197, Pull #305) + +Bugs: + +* Restored config_file parameter in process_options(). (Issue #380) + + 1.6.1 (2015-02-08) ------------------ @@ -13,6 +25,7 @@ * Exception thrown due to unassigned ``local_dir`` variable. (Issue #377) + 1.6.0 (2015-02-06) ------------------ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep8-1.6.1/PKG-INFO new/pep8-1.6.2/PKG-INFO --- old/pep8-1.6.1/PKG-INFO 2015-02-08 22:35:29.000000000 +0100 +++ new/pep8-1.6.2/PKG-INFO 2015-02-15 23:07:16.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: pep8 -Version: 1.6.1 +Version: 1.6.2 Summary: Python style guide checker Home-page: http://pep8.readthedocs.org/ Author: Johann C. Rocholl @@ -103,6 +103,18 @@ ========= + 1.6.2 (2015-02-15) + ------------------ + + Changes: + + * Added check for breaking around a binary operator. (Issue #197, Pull #305) + + Bugs: + + * Restored config_file parameter in process_options(). (Issue #380) + + 1.6.1 (2015-02-08) ------------------ @@ -114,6 +126,7 @@ * Exception thrown due to unassigned ``local_dir`` variable. (Issue #377) + 1.6.0 (2015-02-06) ------------------ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep8-1.6.1/pep8.egg-info/PKG-INFO new/pep8-1.6.2/pep8.egg-info/PKG-INFO --- old/pep8-1.6.1/pep8.egg-info/PKG-INFO 2015-02-08 22:35:29.000000000 +0100 +++ new/pep8-1.6.2/pep8.egg-info/PKG-INFO 2015-02-15 23:07:16.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: pep8 -Version: 1.6.1 +Version: 1.6.2 Summary: Python style guide checker Home-page: http://pep8.readthedocs.org/ Author: Johann C. Rocholl @@ -103,6 +103,18 @@ ========= + 1.6.2 (2015-02-15) + ------------------ + + Changes: + + * Added check for breaking around a binary operator. (Issue #197, Pull #305) + + Bugs: + + * Restored config_file parameter in process_options(). (Issue #380) + + 1.6.1 (2015-02-08) ------------------ @@ -114,6 +126,7 @@ * Exception thrown due to unassigned ``local_dir`` variable. (Issue #377) + 1.6.0 (2015-02-06) ------------------ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep8-1.6.1/pep8.py new/pep8-1.6.2/pep8.py --- old/pep8-1.6.1/pep8.py 2015-02-08 22:30:36.000000000 +0100 +++ new/pep8-1.6.2/pep8.py 2015-02-15 23:05:54.000000000 +0100 @@ -62,7 +62,7 @@ except ImportError: from ConfigParser import RawConfigParser -__version__ = '1.6.1' +__version__ = '1.6.2' DEFAULT_EXCLUDE = '.svn,CVS,.bzr,.hg,.git,__pycache__,.tox' DEFAULT_IGNORE = 'E121,E123,E126,E226,E24,E704' @@ -515,8 +515,9 @@ yield start, "%s continuation line %s" % error # look for visual indenting - if (parens[row] and token_type not in (tokenize.NL, tokenize.COMMENT) - and not indent[depth]): + if (parens[row] and + token_type not in (tokenize.NL, tokenize.COMMENT) and + not indent[depth]): indent[depth] = start[1] indent_chances[start[1]] = True if verbose >= 4: @@ -1000,6 +1001,45 @@ parens -= 1 +def break_around_binary_operator(logical_line, tokens): + r""" + Avoid breaks before binary operators. + + The preferred place to break around a binary operator is after the + operator, not before it. + + W503: (width == 0\n + height == 0) + W503: (width == 0\n and height == 0) + + Okay: (width == 0 +\n height == 0) + Okay: foo(\n -x) + Okay: foo(x\n []) + Okay: x = '''\n''' + '' + Okay: foo(x,\n -y) + Okay: foo(x, # comment\n -y) + """ + def is_binary_operator(token_type, text): + # The % character is strictly speaking a binary operator, but the + # common usage seems to be to put it next to the format parameters, + # after a line break. + return ((token_type == tokenize.OP or text in ['and', 'or']) and + text not in "()[]{},:.;@=%") + + line_break = False + unary_context = True + for token_type, text, start, end, line in tokens: + if token_type == tokenize.COMMENT: + continue + if ('\n' in text or '\r' in text) and token_type != tokenize.STRING: + line_break = True + else: + if (is_binary_operator(token_type, text) and line_break and + not unary_context): + yield start, "W503 line break before binary operator" + unary_context = text in '([{,;' + line_break = False + + def comparison_to_singleton(logical_line, noqa): r"""Comparison to singletons should use "is" or "is not". @@ -1415,8 +1455,8 @@ (start_row, start_col) = start if prev_row != start_row: # different row prev_text = self.lines[prev_row - 1][prev_col - 1] - if prev_text == ',' or (prev_text not in '{[(' - and text not in '}])'): + if prev_text == ',' or (prev_text not in '{[(' and + text not in '}])'): text = ' ' + text elif prev_col != start_col: # different column text = line[prev_col:start_col] + text @@ -1739,11 +1779,13 @@ # build options from the command line self.checker_class = kwargs.pop('checker_class', Checker) parse_argv = kwargs.pop('parse_argv', False) + config_file = kwargs.pop('config_file', False) parser = kwargs.pop('parser', None) # build options from dict options_dict = dict(*args, **kwargs) arglist = None if parse_argv else options_dict.get('paths', None) - options, self.paths = process_options(arglist, parse_argv, parser) + options, self.paths = process_options( + arglist, parse_argv, config_file, parser) if options_dict: options.__dict__.update(options_dict) if 'paths' in options_dict: @@ -1995,8 +2037,13 @@ return options -def process_options(arglist=None, parse_argv=False, parser=None): - """Process options passed either via arglist or via command line args.""" +def process_options(arglist=None, parse_argv=False, config_file=None, + parser=None): + """Process options passed either via arglist or via command line args. + + Passing in the ``config_file`` parameter allows other tools, such as flake8 + to specify their own options to be processed in pep8. + """ if not parser: parser = get_parser() if not parser.has_option('--config'): @@ -2005,7 +2052,7 @@ "tox.ini file or the setup.cfg file located in any parent folder " "of the path(s) being processed. Allowed options are: %s." % (parser.prog, ', '.join(parser.config_options)))) - group.add_option('--config', metavar='path', default=None, + group.add_option('--config', metavar='path', default=config_file, help="user config file location") # Don't read the command line if the module is used as a library. if not arglist and not parse_argv: @@ -2051,7 +2098,7 @@ except AttributeError: pass # not supported on Windows - pep8style = StyleGuide(parse_argv=True, config_file=True) + pep8style = StyleGuide(parse_argv=True) options = pep8style.options if options.doctest or options.testsuite: from testsuite.support import run_tests diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pep8-1.6.1/testsuite/E12.py new/pep8-1.6.2/testsuite/E12.py --- old/pep8-1.6.1/testsuite/E12.py 2014-12-10 07:49:03.000000000 +0100 +++ new/pep8-1.6.2/testsuite/E12.py 2015-02-14 23:52:43.000000000 +0100 @@ -323,14 +323,14 @@ rv.update(d=('a', 'b', 'c'), e=42) # -#: E127 +#: E127 W503 rv.update(d=('a' + 'b', 'c'), e=42, f=42 + 42) -#: E127 +#: E127 W503 input1 = {'a': {'calc': 1 + 2}, 'b': 1 + 42} -#: E128 +#: E128 W503 rv.update(d=('a' + 'b', 'c'), e=42, f=(42 + 42)) -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
