Hello community,

here is the log from the commit of package python3-pep8 for openSUSE:Factory 
checked in at 2013-10-17 14:26:19
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
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        
2013-06-25 13:33:45.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.python3-pep8.new/python3-pep8.changes   
2013-10-17 17:46:47.000000000 +0200
@@ -1,0 +2,23 @@
+Tue Oct 15 21:23:09 UTC 2013 - [email protected]
+
+- Upodate to version 1.4.6
+  * Honor ``# noqa`` for errors E711 and E712. (Issue #180)
+  * When both a ``tox.ini`` and a ``setup.cfg`` are present in the project
+    directory, merge their contents.  The ``tox.ini`` file takes
+    precedence (same as before). (Issue #182)
+  * Give priority to ``--select`` over ``--ignore``. (Issue #188)
+  * Compare full path when excluding a file. (Issue #186)
+  * Correctly report other E12 errors when E123 is ignored. (Issue #103)
+  * New option ``--hang-closing`` to switch to the alternative style of
+    closing bracket indentation for hanging indent.  Add error E133 for
+    closing bracket which is missing indentation. (Issue #103)
+  * Accept both styles of closing bracket indentation for hanging indent.
+    Do not report error E123 in the default configuration. (Issue #103)
+  * Do not crash when running AST checks and the document contains null bytes.
+    (Issue #184)
+  * Fix false positive E261/E262 when the file contains a BOM. (Issue #193)
+  * Fix E701, E702 and E703 not detected sometimes. (Issue #196)
+  * Fix E122 not detected in some cases. (Issue #201 and #208)
+  * Fix false positive E121 with multiple brackets. (Issue #203)
+
+-------------------------------------------------------------------

Old:
----
  pep8-1.4.5.tar.gz

New:
----
  pep8-1.4.6.tar.gz

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

Other differences:
------------------
++++++ python3-pep8.spec ++++++
--- /var/tmp/diff_new_pack.9wCWgj/_old  2013-10-17 17:46:47.000000000 +0200
+++ /var/tmp/diff_new_pack.9wCWgj/_new  2013-10-17 17:46:47.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           python3-pep8
-Version:        1.4.5
+Version:        1.4.6
 Release:        0
 Url:            http://github.com/jcrocholl/pep8
 Summary:        Python style guide checker

++++++ pep8-1.4.5.tar.gz -> pep8-1.4.6.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pep8-1.4.5/CHANGES.txt new/pep8-1.4.6/CHANGES.txt
--- old/pep8-1.4.5/CHANGES.txt  2013-03-06 19:51:09.000000000 +0100
+++ new/pep8-1.4.6/CHANGES.txt  2013-07-02 16:03:31.000000000 +0200
@@ -2,6 +2,40 @@
 =========
 
 
+1.4.6 (2013-07-02)
+------------------
+
+* Honor ``# noqa`` for errors E711 and E712. (Issue #180)
+
+* When both a ``tox.ini`` and a ``setup.cfg`` are present in the project
+  directory, merge their contents.  The ``tox.ini`` file takes
+  precedence (same as before). (Issue #182)
+
+* Give priority to ``--select`` over ``--ignore``. (Issue #188)
+
+* Compare full path when excluding a file. (Issue #186)
+
+* Correctly report other E12 errors when E123 is ignored. (Issue #103)
+
+* New option ``--hang-closing`` to switch to the alternative style of
+  closing bracket indentation for hanging indent.  Add error E133 for
+  closing bracket which is missing indentation. (Issue #103)
+
+* Accept both styles of closing bracket indentation for hanging indent.
+  Do not report error E123 in the default configuration. (Issue #103)
+
+* Do not crash when running AST checks and the document contains null bytes.
+  (Issue #184)
+
+* Fix false positive E261/E262 when the file contains a BOM. (Issue #193)
+
+* Fix E701, E702 and E703 not detected sometimes. (Issue #196)
+
+* Fix E122 not detected in some cases. (Issue #201 and #208)
+
+* Fix false positive E121 with multiple brackets. (Issue #203)
+
+
 1.4.5 (2013-03-06)
 ------------------
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pep8-1.4.5/PKG-INFO new/pep8-1.4.6/PKG-INFO
--- old/pep8-1.4.5/PKG-INFO     2013-03-06 19:54:12.000000000 +0100
+++ new/pep8-1.4.6/PKG-INFO     2013-07-02 16:08:16.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: pep8
-Version: 1.4.5
+Version: 1.4.6
 Summary: Python style guide checker
 Home-page: http://pep8.readthedocs.org/
 Author: Johann C. Rocholl
@@ -99,6 +99,40 @@
         =========
         
         
+        1.4.6 (2013-07-02)
+        ------------------
+        
+        * Honor ``# noqa`` for errors E711 and E712. (Issue #180)
+        
+        * When both a ``tox.ini`` and a ``setup.cfg`` are present in the 
project
+          directory, merge their contents.  The ``tox.ini`` file takes
+          precedence (same as before). (Issue #182)
+        
+        * Give priority to ``--select`` over ``--ignore``. (Issue #188)
+        
+        * Compare full path when excluding a file. (Issue #186)
+        
+        * Correctly report other E12 errors when E123 is ignored. (Issue #103)
+        
+        * New option ``--hang-closing`` to switch to the alternative style of
+          closing bracket indentation for hanging indent.  Add error E133 for
+          closing bracket which is missing indentation. (Issue #103)
+        
+        * Accept both styles of closing bracket indentation for hanging indent.
+          Do not report error E123 in the default configuration. (Issue #103)
+        
+        * Do not crash when running AST checks and the document contains null 
bytes.
+          (Issue #184)
+        
+        * Fix false positive E261/E262 when the file contains a BOM. (Issue 
#193)
+        
+        * Fix E701, E702 and E703 not detected sometimes. (Issue #196)
+        
+        * Fix E122 not detected in some cases. (Issue #201 and #208)
+        
+        * Fix false positive E121 with multiple brackets. (Issue #203)
+        
+        
         1.4.5 (2013-03-06)
         ------------------
         
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pep8-1.4.5/docs/api.rst new/pep8-1.4.6/docs/api.rst
--- old/pep8-1.4.5/docs/api.rst 2013-02-14 20:03:13.000000000 +0100
+++ new/pep8-1.4.6/docs/api.rst 2013-04-28 01:04:43.000000000 +0200
@@ -27,7 +27,7 @@
    .. automethod:: check_files(paths=None)
    .. automethod:: input_file(filename, lines=None, expected=None, 
line_offset=0)
    .. automethod:: input_dir(dirname)
-   .. automethod:: excluded(filename)
+   .. automethod:: excluded(filename, parent=None)
    .. automethod:: ignore_code(code)
    .. automethod:: get_checks(argument_name)
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pep8-1.4.5/docs/intro.rst 
new/pep8-1.4.6/docs/intro.rst
--- old/pep8-1.4.5/docs/intro.rst       2013-02-26 14:24:19.000000000 +0100
+++ new/pep8-1.4.6/docs/intro.rst       2013-06-15 18:27:32.000000000 +0200
@@ -134,6 +134,8 @@
     --count              print total number of errors and warnings to standard
                          error and set exit code to 1 if total is not null
     --max-line-length=n  set maximum allowed line length (default: 79)
+    --hang-closing       hang closing bracket instead of matching indentation 
of
+                         opening bracket's line
     --format=format      set the error format [default|pylint|<custom>]
     --diff               report only lines changed according to the unified 
diff
                          received on STDIN
@@ -145,8 +147,8 @@
       The project options are read from the [pep8] section of the tox.ini
       file or the setup.cfg file located in any parent folder of the path(s)
       being processed.  Allowed options are: exclude, filename, select,
-      ignore, max-line-length, count, format, quiet, show-pep8, show-source,
-      statistics, verbose.
+      ignore, max-line-length, hang-closing, count, format, quiet, show-pep8,
+      show-source, statistics, verbose.
 
       --config=path      user config file location (default: ~/.config/pep8)
 
@@ -163,9 +165,9 @@
   ignore = E226,E302,E41
   max-line-length = 160
 
-At the project level, a ``.pep8`` file, a ``tox.ini`` file or a ``setup.cfg``
-file is read if present.  Only the first file is considered.  If this file
-does not have a ``[pep8]`` section, no project specific configuration is
+At the project level, a ``tox.ini`` file or a ``setup.cfg`` file is read if
+present (``.pep8`` file is also supported, but it is deprecated).  If none of
+these files have a ``[pep8]`` section, no project specific configuration is
 loaded.
 
 If the ``ignore`` option is not in the configuration and not in the arguments,
@@ -191,21 +193,23 @@
 | E113     | unexpected indentation                                            
   |
 
+----------+----------------------------------------------------------------------+
 
+----------+----------------------------------------------------------------------+
-| E121     | continuation line indentation is not a multiple of four           
   |
+| E121 (^) | continuation line indentation is not a multiple of four           
   |
 
+----------+----------------------------------------------------------------------+
-| E122     | continuation line missing indentation or outdented                
   |
+| E122 (^) | continuation line missing indentation or outdented                
   |
 
+----------+----------------------------------------------------------------------+
-| E123     | closing bracket does not match indentation of opening bracket's 
line |
+| E123 (*) | closing bracket does not match indentation of opening bracket's 
line |
 
+----------+----------------------------------------------------------------------+
-| E124     | closing bracket does not match visual indentation                 
   |
+| E124 (^) | closing bracket does not match visual indentation                 
   |
 
+----------+----------------------------------------------------------------------+
-| E125     | continuation line does not distinguish itself from next logical 
line |
+| E125 (^) | continuation line does not distinguish itself from next logical 
line |
 
+----------+----------------------------------------------------------------------+
-| E126     | continuation line over-indented for hanging indent                
   |
+| E126 (^) | continuation line over-indented for hanging indent                
   |
 
+----------+----------------------------------------------------------------------+
-| E127     | continuation line over-indented for visual indent                 
   |
+| E127 (^) | continuation line over-indented for visual indent                 
   |
 
+----------+----------------------------------------------------------------------+
-| E128     | continuation line under-indented for visual indent                
   |
+| E128 (^) | continuation line under-indented for visual indent                
   |
++----------+----------------------------------------------------------------------+
+| E133 (*) | closing bracket is missing indentation                            
   |
 
+----------+----------------------------------------------------------------------+
 
+----------+----------------------------------------------------------------------+
 | **E2**   | *Whitespace*                                                      
   |
@@ -280,7 +284,7 @@
 
+----------+----------------------------------------------------------------------+
 | **E5**   | *Line length*                                                     
   |
 
+----------+----------------------------------------------------------------------+
-| E501     | line too long (82 > 79 characters)                                
   |
+| E501 (^) | line too long (82 > 79 characters)                                
   |
 
+----------+----------------------------------------------------------------------+
 | E502     | the backslash is redundant between brackets                       
   |
 
+----------+----------------------------------------------------------------------+
@@ -293,9 +297,9 @@
 
+----------+----------------------------------------------------------------------+
 | E703     | statement ends with a semicolon                                   
   |
 
+----------+----------------------------------------------------------------------+
-| E711     | comparison to None should be 'if cond is None:'                   
   |
+| E711 (^) | comparison to None should be 'if cond is None:'                   
   |
 
+----------+----------------------------------------------------------------------+
-| E712     | comparison to True should be 'if cond is True:' or 'if cond:'     
   |
+| E712 (^) | comparison to True should be 'if cond is True:' or 'if cond:'     
   |
 
+----------+----------------------------------------------------------------------+
 | E721     | do not compare types, use 'isinstance()'                          
   |
 
+----------+----------------------------------------------------------------------+
@@ -337,9 +341,16 @@
 | W604     | backticks are deprecated, use 'repr()'                            
   |
 
+----------+----------------------------------------------------------------------+
 
-**(*)** In the default configuration, the checks **E226**, **E241**
-and **E242** are ignored because they are not rules unanimously accepted,
-and `PEP 8`_ does not enforce them.
+**(*)** In the default configuration, the checks **E123**, **E133**, **E226**,
+**E241** and **E242** are ignored because they are not rules unanimously
+accepted, and `PEP 8`_ does not enforce them.  The check **E133** is mutually
+exclusive with check **E123**.  Use switch ``--hang-closing`` to report 
**E133**
+instead of **E123**.
+
+**(^)** These checks can be disabled at the line level using the ``# noqa``
+special comment.  This possibility should be reserved for special cases.
+
+  *Special cases aren't special enough to break the rules.*
 
 
 Note: most errors can be listed with such one-liner::
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pep8-1.4.5/pep8.egg-info/PKG-INFO 
new/pep8-1.4.6/pep8.egg-info/PKG-INFO
--- old/pep8-1.4.5/pep8.egg-info/PKG-INFO       2013-03-06 19:54:12.000000000 
+0100
+++ new/pep8-1.4.6/pep8.egg-info/PKG-INFO       2013-07-02 16:08:15.000000000 
+0200
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: pep8
-Version: 1.4.5
+Version: 1.4.6
 Summary: Python style guide checker
 Home-page: http://pep8.readthedocs.org/
 Author: Johann C. Rocholl
@@ -99,6 +99,40 @@
         =========
         
         
+        1.4.6 (2013-07-02)
+        ------------------
+        
+        * Honor ``# noqa`` for errors E711 and E712. (Issue #180)
+        
+        * When both a ``tox.ini`` and a ``setup.cfg`` are present in the 
project
+          directory, merge their contents.  The ``tox.ini`` file takes
+          precedence (same as before). (Issue #182)
+        
+        * Give priority to ``--select`` over ``--ignore``. (Issue #188)
+        
+        * Compare full path when excluding a file. (Issue #186)
+        
+        * Correctly report other E12 errors when E123 is ignored. (Issue #103)
+        
+        * New option ``--hang-closing`` to switch to the alternative style of
+          closing bracket indentation for hanging indent.  Add error E133 for
+          closing bracket which is missing indentation. (Issue #103)
+        
+        * Accept both styles of closing bracket indentation for hanging indent.
+          Do not report error E123 in the default configuration. (Issue #103)
+        
+        * Do not crash when running AST checks and the document contains null 
bytes.
+          (Issue #184)
+        
+        * Fix false positive E261/E262 when the file contains a BOM. (Issue 
#193)
+        
+        * Fix E701, E702 and E703 not detected sometimes. (Issue #196)
+        
+        * Fix E122 not detected in some cases. (Issue #201 and #208)
+        
+        * Fix false positive E121 with multiple brackets. (Issue #203)
+        
+        
         1.4.5 (2013-03-06)
         ------------------
         
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pep8-1.4.5/pep8.egg-info/SOURCES.txt 
new/pep8-1.4.6/pep8.egg-info/SOURCES.txt
--- old/pep8-1.4.5/pep8.egg-info/SOURCES.txt    2013-03-06 19:54:12.000000000 
+0100
+++ new/pep8-1.4.6/pep8.egg-info/SOURCES.txt    2013-07-02 16:08:15.000000000 
+0200
@@ -44,9 +44,11 @@
 testsuite/W60.py
 testsuite/__init__.py
 testsuite/latin-1.py
+testsuite/noqa.py
 testsuite/python3.py
 testsuite/support.py
 testsuite/test_all.py
 testsuite/test_api.py
 testsuite/test_shell.py
+testsuite/utf-8-bom.py
 testsuite/utf-8.py
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pep8-1.4.5/pep8.py new/pep8-1.4.6/pep8.py
--- old/pep8-1.4.5/pep8.py      2013-03-06 19:51:19.000000000 +0100
+++ new/pep8-1.4.6/pep8.py      2013-07-02 16:03:41.000000000 +0200
@@ -45,7 +45,7 @@
 700 statements
 900 syntax error
 """
-__version__ = '1.4.5'
+__version__ = '1.4.6'
 
 import os
 import sys
@@ -63,13 +63,13 @@
     from ConfigParser import RawConfigParser
 
 DEFAULT_EXCLUDE = '.svn,CVS,.bzr,.hg,.git,__pycache__'
-DEFAULT_IGNORE = 'E226,E24'
+DEFAULT_IGNORE = 'E123,E226,E24'
 if sys.platform == 'win32':
     DEFAULT_CONFIG = os.path.expanduser(r'~\.pep8')
 else:
     DEFAULT_CONFIG = os.path.join(os.getenv('XDG_CONFIG_HOME') or
                                   os.path.expanduser('~/.config'), 'pep8')
-PROJECT_CONFIG = ('.pep8', 'tox.ini', 'setup.cfg')
+PROJECT_CONFIG = ('setup.cfg', 'tox.ini', '.pep8')
 TESTSUITE_PATH = os.path.join(os.path.dirname(__file__), 'testsuite')
 MAX_LINE_LENGTH = 79
 REPORT_FORMAT = {
@@ -215,9 +215,7 @@
     """
     line = physical_line.rstrip()
     length = len(line)
-    if length > max_line_length:
-        if noqa(line):
-            return
+    if length > max_line_length and not noqa(line):
         if hasattr(line, 'decode'):   # Python 2
             # The line could contain multi-byte characters
             try:
@@ -383,7 +381,8 @@
         yield 0, "E113 unexpected indentation"
 
 
-def continuation_line_indentation(logical_line, tokens, indent_level, verbose):
+def continued_indentation(logical_line, tokens, indent_level, hang_closing,
+                          noqa, verbose):
     r"""
     Continuation lines should align wrapped elements either vertically using
     Python's implicit line joining inside parentheses, brackets and braces, or
@@ -411,7 +410,7 @@
     """
     first_row = tokens[0][2][0]
     nrows = 1 + tokens[-1][2][0] - first_row
-    if nrows == 1 or noqa(tokens[0][4]):
+    if noqa or nrows == 1:
         return
 
     # indent_next tells us whether the next block is indented; assuming
@@ -459,17 +458,19 @@
                 # an unbracketed continuation line (ie, backslash)
                 open_row = 0
             hang = rel_indent[row] - rel_indent[open_row]
-            visual_indent = indent_chances.get(start[1])
-
-            if token_type == tokenize.OP and text in ']})':
-                # this line starts with a closing bracket
-                if indent[depth]:
-                    if start[1] != indent[depth]:
-                        yield (start, "E124 closing bracket does not match "
-                               "visual indentation")
-                elif hang:
-                    yield (start, "E123 closing bracket does not match "
-                           "indentation of opening bracket's line")
+            close_bracket = (token_type == tokenize.OP and text in ']})')
+            visual_indent = (not close_bracket and hang > 0 and
+                             indent_chances.get(start[1]))
+
+            if close_bracket and indent[depth]:
+                # closing bracket for visual indent
+                if start[1] != indent[depth]:
+                    yield (start, "E124 closing bracket does not match "
+                           "visual indentation")
+            elif close_bracket and not hang:
+                # closing bracket matches indentation of opening bracket's line
+                if hang_closing:
+                    yield start, "E133 closing bracket is missing indentation"
             elif visual_indent is True:
                 # visual indent is verified
                 if not indent[depth]:
@@ -483,7 +484,9 @@
                        "under-indented for visual indent")
             elif hang == 4 or (indent_next and rel_indent[row] == 8):
                 # hanging indent is verified
-                pass
+                if close_bracket and not hang_closing:
+                    yield (start, "E123 closing bracket does not match "
+                           "indentation of opening bracket's line")
             else:
                 # indent is broken
                 if hang <= 0:
@@ -535,6 +538,7 @@
                 for idx in range(row, -1, -1):
                     if parens[idx]:
                         parens[idx] -= 1
+                        rel_indent[row] = rel_indent[idx]
                         break
             assert len(indent) == depth + 1
             if start[1] not in indent_chances:
@@ -543,7 +547,7 @@
 
         last_token_multiline = (start[0] != end[0])
 
-    if indent_next and rel_indent[-1] == 4:
+    if indent_next and expand_indent(line) == indent_level + 4:
         yield (last_indent, "E125 continuation line does not distinguish "
                "itself from next logical line")
 
@@ -565,11 +569,9 @@
     E211: dict ['key'] = list[index]
     E211: dict['key'] = list [index]
     """
-    prev_type = tokens[0][0]
-    prev_text = tokens[0][1]
-    prev_end = tokens[0][3]
+    prev_type, prev_text, __, prev_end, __ = tokens[0]
     for index in range(1, len(tokens)):
-        token_type, text, start, end, line = tokens[index]
+        token_type, text, start, end, __ = tokens[index]
         if (token_type == tokenize.OP and
             text in '([' and
             start != prev_end and
@@ -844,19 +846,21 @@
     line = logical_line
     last_char = len(line) - 1
     found = line.find(':')
-    if -1 < found < last_char:
+    while -1 < found < last_char:
         before = line[:found]
         if (before.count('{') <= before.count('}') and  # {'a': 1} (dict)
             before.count('[') <= before.count(']') and  # [1:2] (slice)
             before.count('(') <= before.count(')') and  # (Python 3 annotation)
                 not LAMBDA_REGEX.search(before)):       # lambda x: x
             yield found, "E701 multiple statements on one line (colon)"
+        found = line.find(':', found + 1)
     found = line.find(';')
-    if -1 < found:
+    while -1 < found:
         if found < last_char:
             yield found, "E702 multiple statements on one line (semicolon)"
         else:
             yield found, "E703 statement ends with a semicolon"
+        found = line.find(';', found + 1)
 
 
 def explicit_line_join(logical_line, tokens):
@@ -894,7 +898,7 @@
                 parens -= 1
 
 
-def comparison_to_singleton(logical_line):
+def comparison_to_singleton(logical_line, noqa):
     """
     Comparisons to singletons like None should always be done
     with "is" or "is not", never the equality operators.
@@ -908,7 +912,7 @@
     set to some other value.  The other value might have a type (such as a
     container) that could be false in a boolean context!
     """
-    match = COMPARE_SINGLETON_REGEX.search(logical_line)
+    match = not noqa and COMPARE_SINGLETON_REGEX.search(logical_line)
     if match:
         same = (match.group(1) == '==')
         singleton = match.group(2)
@@ -1018,7 +1022,6 @@
             return f.readlines()
         finally:
             f.close()
-
     isidentifier = re.compile(r'[a-zA-Z_]\w*').match
     stdin_get_value = sys.stdin.read
 else:
@@ -1036,7 +1039,6 @@
             return f.readlines()
         finally:
             f.close()
-
     isidentifier = str.isidentifier
 
     def stdin_get_value():
@@ -1185,6 +1187,7 @@
         self._logical_checks = options.logical_checks
         self._ast_checks = options.ast_checks
         self.max_line_length = options.max_line_length
+        self.hang_closing = options.hang_closing
         self.verbose = options.verbose
         self.filename = filename
         if filename is None:
@@ -1202,14 +1205,24 @@
                 self.lines = []
         else:
             self.lines = lines
+        if self.lines:
+            ord0 = ord(self.lines[0][0])
+            if ord0 in (0xef, 0xfeff):  # Strip the UTF-8 BOM
+                if ord0 == 0xfeff:
+                    self.lines[0] = self.lines[0][1:]
+                elif self.lines[0][:3] == '\xef\xbb\xbf':
+                    self.lines[0] = self.lines[0][3:]
         self.report = report or options.report
         self.report_error = self.report.error
 
     def report_invalid_syntax(self):
         exc_type, exc = sys.exc_info()[:2]
-        offset = exc.args[1]
-        if len(offset) > 2:
-            offset = offset[1:3]
+        if len(exc.args) > 1:
+            offset = exc.args[1]
+            if len(offset) > 2:
+                offset = offset[1:3]
+        else:
+            offset = (1, 0)
         self.report_error(offset[0], offset[1] or 0,
                           'E901 %s: %s' % (exc_type.__name__, exc.args[0]),
                           self.report_invalid_syntax)
@@ -1262,10 +1275,14 @@
         """
         self.mapping = []
         logical = []
+        comments = []
         length = 0
         previous = None
         for token in self.tokens:
             token_type, text = token[0:2]
+            if token_type == tokenize.COMMENT:
+                comments.append(text)
+                continue
             if token_type in SKIP_TOKENS:
                 continue
             if token_type == tokenize.STRING:
@@ -1288,6 +1305,7 @@
             length += len(text)
             previous = token
         self.logical_line = ''.join(logical)
+        self.noqa = comments and noqa(''.join(comments))
         # With Python 2, if the line ends with '\r\r\n' the assertion fails
         # assert self.logical_line.strip() == self.logical_line
 
@@ -1321,7 +1339,7 @@
     def check_ast(self):
         try:
             tree = compile(''.join(self.lines), '', 'exec', PyCF_ONLY_AST)
-        except SyntaxError:
+        except (SyntaxError, TypeError):
             return self.report_invalid_syntax()
         for name, cls, _ in self._ast_checks:
             checker = cls(tree, self.filename)
@@ -1578,7 +1596,7 @@
             options.ignore = tuple(DEFAULT_IGNORE.split(','))
         else:
             # Ignore all checks which are not explicitly selected
-            options.ignore = tuple(options.ignore or options.select and ('',))
+            options.ignore = ('',) if options.select else tuple(options.ignore)
         options.benchmark_keys = BENCHMARK_KEYS[:]
         options.ignore_code = self.ignore_code
         options.physical_checks = self.get_checks('physical_line')
@@ -1631,23 +1649,26 @@
                 print('directory ' + root)
             counters['directories'] += 1
             for subdir in sorted(dirs):
-                if self.excluded(os.path.join(root, subdir)):
+                if self.excluded(subdir, root):
                     dirs.remove(subdir)
             for filename in sorted(files):
                 # contain a pattern that matches?
                 if ((filename_match(filename, filepatterns) and
-                     not self.excluded(filename))):
+                     not self.excluded(filename, root))):
                     runner(os.path.join(root, filename))
 
-    def excluded(self, filename):
+    def excluded(self, filename, parent=None):
         """
         Check if options.exclude contains a pattern that matches filename.
         """
+        if not self.options.exclude:
+            return False
         basename = os.path.basename(filename)
-        return any((filename_match(filename, self.options.exclude,
-                                   default=False),
-                    filename_match(basename, self.options.exclude,
-                                   default=False)))
+        if filename_match(basename, self.options.exclude):
+            return True
+        if parent:
+            filename = os.path.join(parent, filename)
+        return filename_match(filename, self.options.exclude)
 
     def ignore_code(self, code):
         """
@@ -1677,8 +1698,9 @@
     parser = OptionParser(prog=prog, version=version,
                           usage="%prog [options] input ...")
     parser.config_options = [
-        'exclude', 'filename', 'select', 'ignore', 'max-line-length', 'count',
-        'format', 'quiet', 'show-pep8', 'show-source', 'statistics', 'verbose']
+        'exclude', 'filename', 'select', 'ignore', 'max-line-length',
+        'hang-closing', 'count', 'format', 'quiet', 'show-pep8',
+        'show-source', 'statistics', 'verbose']
     parser.add_option('-v', '--verbose', default=0, action='count',
                       help="print status messages, or debug with -vv")
     parser.add_option('-q', '--quiet', default=0, action='count',
@@ -1713,6 +1735,9 @@
                       default=MAX_LINE_LENGTH,
                       help="set maximum allowed line length "
                            "(default: %default)")
+    parser.add_option('--hang-closing', action='store_true',
+                      help="hang closing bracket instead of matching "
+                           "indentation of opening bracket's line")
     parser.add_option('--format', metavar='format', default='default',
                       help="set the error format [default|pylint|<custom>]")
     parser.add_option('--diff', action='store_true',
@@ -1741,17 +1766,11 @@
 
     parent = tail = args and os.path.abspath(os.path.commonprefix(args))
     while tail:
-        for name in PROJECT_CONFIG:
-            local_conf = os.path.join(parent, name)
-            if os.path.isfile(local_conf):
-                break
-        else:
-            parent, tail = os.path.split(parent)
-            continue
-        if options.verbose:
-            print('local configuration: %s' % local_conf)
-        config.read(local_conf)
-        break
+        if config.read([os.path.join(parent, fn) for fn in PROJECT_CONFIG]):
+            if options.verbose:
+                print('local configuration: in %s' % parent)
+            break
+        parent, tail = os.path.split(parent)
 
     pep8_section = parser.prog
     if config.has_section(pep8_section):
@@ -1819,13 +1838,10 @@
         options = read_config(options, args, arglist, parser)
         options.reporter = parse_argv and options.quiet == 1 and FileReport
 
-    if options.filename:
-        options.filename = options.filename.split(',')
+    options.filename = options.filename and options.filename.split(',')
     options.exclude = options.exclude.split(',')
-    if options.select:
-        options.select = options.select.split(',')
-    if options.ignore:
-        options.ignore = options.ignore.split(',')
+    options.select = options.select and options.select.split(',')
+    options.ignore = options.ignore and options.ignore.split(',')
 
     if options.diff:
         options.reporter = DiffReport
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pep8-1.4.5/testsuite/E12.py 
new/pep8-1.4.6/testsuite/E12.py
--- old/pep8-1.4.5/testsuite/E12.py     2012-06-26 19:01:54.000000000 +0200
+++ new/pep8-1.4.6/testsuite/E12.py     2013-06-16 19:58:48.000000000 +0200
@@ -4,6 +4,11 @@
 #: E122
 print "E122", (
 "dent")
+#: E123
+my_list = [
+    1, 2, 3,
+    4, 5, 6,
+    ]
 #: E124
 print "E124", ("visual",
                "indent_two"
@@ -37,19 +42,11 @@
 #:
 
 
-#: E123 W291
-print "E123", (   
-    "bad", "hanging", "close"
-    )
-#
-#: E123
-result = {
-    'foo': [
-        'bar', {
-            'baz': 'frop',
-            }
-        ]
-    }
+#: E121
+my_list = [
+    1, 2, 3,
+    4, 5, 6,
+     ]
 #: E121
 result = {
    'key1': 'value',
@@ -65,10 +62,116 @@
 abricot = 3 + \
           4 + \
           5 + 6
-#: E126
-abris = 3 + \
-        4 + \
-        5 + 6
+#: E121
+print "hello", (
+
+    "there",
+     # "john",
+    "dude")
+#: E121
+part = set_mimetype((
+    a.get('mime_type', 'text')),
+                       'default')
+#:
+
+
+#: E122
+if True:
+    result = some_function_that_takes_arguments(
+        'a', 'b', 'c',
+        'd', 'e', 'f',
+)
+#: E122
+if some_very_very_very_long_variable_name or var \
+or another_very_long_variable_name:
+    raise Exception()
+#: E122
+if some_very_very_very_long_variable_name or var[0] \
+or another_very_long_variable_name:
+    raise Exception()
+#: E122
+if True:
+    if some_very_very_very_long_variable_name or var \
+    or another_very_long_variable_name:
+        raise Exception()
+#: E122
+if True:
+    if some_very_very_very_long_variable_name or var[0] \
+    or another_very_long_variable_name:
+        raise Exception()
+#: E122
+dictionary = [
+    "is": {
+    "nested": yes(),
+    },
+]
+#: E122
+setup('',
+      scripts=[''],
+      classifiers=[
+      'Development Status :: 4 - Beta',
+          'Environment :: Console',
+          'Intended Audience :: Developers',
+      ])
+#:
+
+
+#: E123 W291
+print "E123", (   
+    "bad", "hanging", "close"
+    )
+#
+#: E123
+result = {
+    'foo': [
+        'bar', {
+            'baz': 'frop',
+            }
+        ]
+    }
+#: E123
+result = some_function_that_takes_arguments(
+    'a', 'b', 'c',
+    'd', 'e', 'f',
+    )
+#: E124
+my_list = [1, 2, 3,
+           4, 5, 6,
+]
+#: E124
+my_list = [1, 2, 3,
+           4, 5, 6,
+                   ]
+#: E124
+result = some_function_that_takes_arguments('a', 'b', 'c',
+                                            'd', 'e', 'f',
+)
+#: E124
+fooff(aaaa,
+      cca(
+          vvv,
+          dadd
+      ), fff,
+)
+#: E124
+fooff(aaaa,
+      ccaaa(
+          vvv,
+          dadd
+      ),
+      fff,
+)
+#: E124
+d = dict('foo',
+         help="exclude files or directories which match these "
+              "comma separated patterns (default: %s)" % DEFAULT_EXCLUDE
+              )
+#: E124 E128
+if line_removed:
+    self.event(cr, uid,
+        name="Removing the option for contract",
+        description="contract line has been removed",
+        )
 #:
 
 
@@ -101,6 +204,15 @@
 
 
 #: E126
+my_list = [
+    1, 2, 3,
+    4, 5, 6,
+        ]
+#: E126
+abris = 3 + \
+        4 + \
+        5 + 6
+#: E126
 fixed = re.sub(r'\t+', ' ', target[c::-1], 1)[::-1] + \
         target[c + 1:]
 #: E126
@@ -130,6 +242,18 @@
     ) or
         y == 4):
     pass
+#: E126
+troublesome_hash = {
+    "hash": "value",
+    "long": "the quick brown fox jumps over the lazy dog before doing a "
+        "somersault",
+}
+#: E126
+# probably not easily fixed, without using 'ast'
+troublesome_hash_ii = {
+    "long key that tends to happen more when you're indented":
+        "stringwithalongtoken you don't want to break",
+}
 #:
 
 
@@ -150,43 +274,6 @@
 #:
 
 
-#: E121
-print "hello", (
-
-    "there",
-     # "john",
-    "dude")
-#: E121
-part = set_mimetype((
-    a.get('mime_type', 'text')),
-                       'default')
-#: E124
-fooff(aaaa,
-      cca(
-          vvv,
-          dadd
-      ), fff,
-)
-#: E124
-fooff(aaaa,
-      ccaaa(
-          vvv,
-          dadd
-      ),
-      fff,
-)
-#: E126
-troublesome_hash = {
-    "hash": "value",
-    "long": "the quick brown fox jumps over the lazy dog before doing a "
-        "somersault",
-}
-#: E126
-# probably not easily fixed, without using 'ast'
-troublesome_hash_ii = {
-    "long key that tends to happen more when you're indented":
-        "stringwithalongtoken you don't want to break",
-}
 #: E128
 foo(1, 2, 3,
 4, 5, 6)
@@ -226,17 +313,6 @@
 #: E127
 foo(1, 2, 3,
              4, 5, 6)
-#: E124
-d = dict('foo',
-         help="exclude files or directories which match these "
-              "comma separated patterns (default: %s)" % DEFAULT_EXCLUDE
-              )
-#: E124 E128
-if line_removed:
-    self.event(cr, uid,
-        name="Removing the option for contract",
-        description="contract line has been removed",
-        )
 #: E128
 if line_removed:
     self.event(cr, uid,
@@ -264,22 +340,4 @@
 rv.update(d=('a' + 'b', 'c'),
           e=42, f=(42
                  + 42))
-#: E122
-if some_very_very_very_long_variable_name or var \
-or another_very_long_variable_name:
-    raise Exception()
-#: E122
-if some_very_very_very_long_variable_name or var[0] \
-or another_very_long_variable_name:
-    raise Exception()
-#: E122
-if True:
-    if some_very_very_very_long_variable_name or var \
-    or another_very_long_variable_name:
-        raise Exception()
-#: E122
-if True:
-    if some_very_very_very_long_variable_name or var[0] \
-    or another_very_long_variable_name:
-        raise Exception()
 #:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pep8-1.4.5/testsuite/E12not.py 
new/pep8-1.4.6/testsuite/E12not.py
--- old/pep8-1.4.5/testsuite/E12not.py  2013-02-14 20:03:13.000000000 +0100
+++ new/pep8-1.4.6/testsuite/E12not.py  2013-06-15 16:54:27.000000000 +0200
@@ -546,3 +546,36 @@
    c > d:
     moo_like_a_cow()
 #
+my_list = [
+    1, 2, 3,
+    4, 5, 6,
+]
+
+my_list = [1, 2, 3,
+           4, 5, 6,
+           ]
+
+result = some_function_that_takes_arguments(
+    'a', 'b', 'c',
+    'd', 'e', 'f',
+)
+
+result = some_function_that_takes_arguments('a', 'b', 'c',
+                                            'd', 'e', 'f',
+                                            )
+
+# issue 203
+dica = {
+    ('abc'
+     'def'): (
+        'abc'),
+}
+
+(abcdef[0]
+       [1]) = (
+    'abc')
+
+('abc'
+ 'def') == (
+    'abc')
+#
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pep8-1.4.5/testsuite/E70.py 
new/pep8-1.4.6/testsuite/E70.py
--- old/pep8-1.4.5/testsuite/E70.py     2013-01-18 22:46:55.000000000 +0100
+++ new/pep8-1.4.6/testsuite/E70.py     2013-05-03 23:20:09.000000000 +0200
@@ -1,9 +1,13 @@
 #: E701
 if a: a = False
+#: E701
+if not header or header[:6] != 'bytes=': return
 #: E702
 a = False; b = True
 #: E702
 import bdist_egg; bdist_egg.write_safety_flag(cmd.egg_info, safe)
 #: E703
 import shlex;
+#: E702 E703
+del a[:]; a.append(42);
 #:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pep8-1.4.5/testsuite/noqa.py 
new/pep8-1.4.6/testsuite/noqa.py
--- old/pep8-1.4.5/testsuite/noqa.py    1970-01-01 01:00:00.000000000 +0100
+++ new/pep8-1.4.6/testsuite/noqa.py    2013-04-28 01:04:43.000000000 +0200
@@ -0,0 +1,15 @@
+#: Okay
+# silence E501
+url = 
'https://api.github.com/repos/sigmavirus24/Todo.txt-python/branches/master?client_id=xxxxxxxxxxxxxxxxxxxxxxxxxxxx&?client_secret=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
  # noqa
+
+# silence E128
+from functools import (partial, reduce, wraps,  # noqa
+    cmp_to_key)
+
+from functools import (partial, reduce, wraps,
+    cmp_to_key)   # noqa
+
+a = 1
+if a == None:   # noqa
+    pass
+#:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pep8-1.4.5/testsuite/test_api.py 
new/pep8-1.4.6/testsuite/test_api.py
--- old/pep8-1.4.5/testsuite/test_api.py        2013-03-02 18:54:11.000000000 
+0100
+++ new/pep8-1.4.6/testsuite/test_api.py        2013-06-15 17:05:24.000000000 
+0200
@@ -10,6 +10,15 @@
 E11 = os.path.join(ROOT_DIR, 'testsuite', 'E11.py')
 
 
+class DummyChecker(object):
+    def __init__(self, tree, filename):
+        pass
+
+    def run(self):
+        if False:
+            yield
+
+
 class APITestCase(unittest.TestCase):
     """Test the public methods."""
 
@@ -68,13 +77,6 @@
                             for name, func, args in options.logical_checks))
 
     def test_register_ast_check(self):
-        class DummyChecker(object):
-            def __init__(self, tree, filename):
-                pass
-
-            def run(self):
-                if False:
-                    yield
         pep8.register_check(DummyChecker, ['Z701'])
 
         self.assertTrue(DummyChecker in pep8._checks['tree'])
@@ -87,18 +89,14 @@
                             for name, cls, args in options.ast_checks))
 
     def test_register_invalid_check(self):
-        class DummyChecker(object):
+        class InvalidChecker(DummyChecker):
             def __init__(self, filename):
                 pass
 
-            def run(self):
-                if False:
-                    yield
-
         def check_dummy(logical, tokens):
             if False:
                 yield
-        pep8.register_check(DummyChecker, ['Z741'])
+        pep8.register_check(InvalidChecker, ['Z741'])
         pep8.register_check(check_dummy, ['Z441'])
 
         for checkers in pep8._checks.values():
@@ -166,7 +164,7 @@
         self.assertEqual(pep8style.options.filename, ['*.py'])
         self.assertEqual(pep8style.options.format, 'default')
         self.assertEqual(pep8style.options.select, ())
-        self.assertEqual(pep8style.options.ignore, ('E226', 'E24'))
+        self.assertEqual(pep8style.options.ignore, ('E123', 'E226', 'E24'))
         self.assertEqual(pep8style.options.max_line_length, 79)
 
     def test_styleguide_ignore_code(self):
@@ -180,7 +178,7 @@
 
         options = parse_argv('').options
         self.assertEqual(options.select, ())
-        self.assertEqual(options.ignore, ('E226', 'E24'))
+        self.assertEqual(options.ignore, ('E123', 'E226', 'E24'))
 
         options = parse_argv('--doctest').options
         self.assertEqual(options.select, ())
@@ -194,6 +192,18 @@
         self.assertEqual(options.select, ('E', 'W'))
         self.assertEqual(options.ignore, ('',))
 
+        options = parse_argv('--select E --ignore E24').options
+        self.assertEqual(options.select, ('E',))
+        self.assertEqual(options.ignore, ('',))
+
+        options = parse_argv('--ignore E --select E24').options
+        self.assertEqual(options.select, ('E24',))
+        self.assertEqual(options.ignore, ('',))
+
+        options = parse_argv('--ignore W --select E24').options
+        self.assertEqual(options.select, ('E24',))
+        self.assertEqual(options.ignore, ('',))
+
         pep8style = pep8.StyleGuide(paths=[E11])
         self.assertFalse(pep8style.ignore_code('E112'))
         self.assertFalse(pep8style.ignore_code('W191'))
@@ -292,5 +302,30 @@
         self.assertRaises(TypeError, pep8style.check_files, 42)
         # < 3.3 raises TypeError; >= 3.3 raises AttributeError
         self.assertRaises(Exception, pep8style.check_files, [42])
+
+    def test_check_unicode(self):
+        # Do not crash if lines are Unicode (Python 2.x)
+        pep8.register_check(DummyChecker, ['Z701'])
+        source = '#\n'
+        if hasattr(source, 'decode'):
+            source = source.decode('ascii')
+
+        pep8style = pep8.StyleGuide()
+        count_errors = pep8style.input_file('stdin', lines=[source])
+
+        self.assertFalse(sys.stdout)
+        self.assertFalse(sys.stderr)
+        self.assertEqual(count_errors, 0)
+
+    def test_check_nullbytes(self):
+        pep8.register_check(DummyChecker, ['Z701'])
+
+        pep8style = pep8.StyleGuide()
+        count_errors = pep8style.input_file('stdin', lines=['\x00\n'])
+
+        self.assertTrue(sys.stdout[0].startswith("stdin:1:1: E901 TypeError"))
+        self.assertFalse(sys.stderr)
+        self.assertEqual(count_errors, 1)
+
         # TODO: runner
         # TODO: input_file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pep8-1.4.5/testsuite/test_shell.py 
new/pep8-1.4.6/testsuite/test_shell.py
--- old/pep8-1.4.5/testsuite/test_shell.py      2013-03-02 15:04:11.000000000 
+0100
+++ new/pep8-1.4.6/testsuite/test_shell.py      2013-05-02 00:35:15.000000000 
+0200
@@ -15,14 +15,17 @@
         self._saved_stdout = sys.stdout
         self._saved_stderr = sys.stderr
         self._saved_pconfig = pep8.PROJECT_CONFIG
-        self._saved_cpread = pep8.RawConfigParser.read
+        self._saved_cpread = pep8.RawConfigParser._read
         self._saved_stdin_get_value = pep8.stdin_get_value
         self._config_filenames = []
         self.stdin = ''
         sys.argv = ['pep8']
         sys.stdout = PseudoFile()
         sys.stderr = PseudoFile()
-        pep8.RawConfigParser.read = self._config_filenames.append
+
+        def fake_config_parser_read(cp, fp, filename):
+            self._config_filenames.append(filename)
+        pep8.RawConfigParser._read = fake_config_parser_read
         pep8.stdin_get_value = self.stdin_get_value
 
     def tearDown(self):
@@ -30,7 +33,7 @@
         sys.stdout = self._saved_stdout
         sys.stderr = self._saved_stderr
         pep8.PROJECT_CONFIG = self._saved_pconfig
-        pep8.RawConfigParser.read = self._saved_cpread
+        pep8.RawConfigParser._read = self._saved_cpread
         pep8.stdin_get_value = self._saved_stdin_get_value
 
     def stdin_get_value(self):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pep8-1.4.5/testsuite/utf-8-bom.py 
new/pep8-1.4.6/testsuite/utf-8-bom.py
--- old/pep8-1.4.5/testsuite/utf-8-bom.py       1970-01-01 01:00:00.000000000 
+0100
+++ new/pep8-1.4.6/testsuite/utf-8-bom.py       2013-05-03 23:04:47.000000000 
+0200
@@ -0,0 +1,6 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+hello = 'こんにちわ'
+
+# EOF

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to