Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-pycodestyle for 
openSUSE:Factory checked in at 2022-08-23 14:25:36
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-pycodestyle (Old)
 and      /work/SRC/openSUSE:Factory/.python-pycodestyle.new.2083 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-pycodestyle"

Tue Aug 23 14:25:36 2022 rev:10 rq:995145 version:2.9.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-pycodestyle/python-pycodestyle.changes    
2021-11-09 23:54:04.179936084 +0100
+++ 
/work/SRC/openSUSE:Factory/.python-pycodestyle.new.2083/python-pycodestyle.changes
  2022-08-23 14:25:49.391117368 +0200
@@ -1,0 +2,12 @@
+Mon Aug 15 11:00:40 UTC 2022 - Dirk M??ller <dmuel...@suse.com>
+
+- update to 2.9.1:
+  * E275: fix false positive for yield expressions.
+  * E221, E222, E223, E224: add support for := operator. PR #1032.
+  * Drop python 2.7 / 3.5.
+  * E262: consider non-breaking spaces (\xa0) as whitespace. PR #1035.
+  * Improve performance of _is_binary_operator. PR #1052.
+  * E275: requires whitespace around keywords. PR #1063.
+  * Add support for python 3.11. PR #1070.
+
+-------------------------------------------------------------------

Old:
----
  pycodestyle-2.8.0.tar.gz

New:
----
  pycodestyle-2.9.1.tar.gz

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

Other differences:
------------------
++++++ python-pycodestyle.spec ++++++
--- /var/tmp/diff_new_pack.LHVk4b/_old  2022-08-23 14:25:50.235119225 +0200
+++ /var/tmp/diff_new_pack.LHVk4b/_new  2022-08-23 14:25:50.243119243 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package python-pycodestyle
 #
-# Copyright (c) 2020 SUSE LLC
+# Copyright (c) 2022 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -16,10 +16,10 @@
 #
 
 
-%{?!python_module:%define python_module() python-%{**} python3-%{**}}
-%define oldpython python
+%{?!python_module:%define python_module() python3-%{**}}
+%global skip_python2 1
 Name:           python-pycodestyle
-Version:        2.8.0
+Version:        2.9.1
 Release:        0
 Summary:        Python style guide checker
 License:        MIT
@@ -31,14 +31,10 @@
 BuildRequires:  fdupes
 BuildRequires:  python-rpm-macros
 BuildArch:      noarch
-%ifpython2
-Provides:       %{oldpython}-pep8 = %{version}
-Obsoletes:      %{oldpython}-pep8 < %{version}
-%endif
 Provides:       python-pep8 = %{version}
 Obsoletes:      python-pep8 < %{version}
 Requires(post):   update-alternatives
-Requires(postun):  update-alternatives
+Requires(postun):update-alternatives
 %python_subpackages
 
 %description

++++++ pycodestyle-2.8.0.tar.gz -> pycodestyle-2.9.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pycodestyle-2.8.0/CHANGES.txt 
new/pycodestyle-2.9.1/CHANGES.txt
--- old/pycodestyle-2.8.0/CHANGES.txt   2021-10-11 02:55:05.000000000 +0200
+++ new/pycodestyle-2.9.1/CHANGES.txt   2022-08-04 01:12:27.000000000 +0200
@@ -1,6 +1,25 @@
 Changelog
 =========
 
+2.9.1 (2022-08-03)
+------------------
+
+Changes:
+
+* E275: fix false positive for yield expressions.
+
+2.9.0 (2022-07-30)
+------------------
+
+Changes:
+
+* E221, E222, E223, E224: add support for ``:=`` operator.  PR #1032.
+* Drop python 2.7 / 3.5.
+* E262: consider non-breaking spaces (``\xa0``) as whitespace.  PR #1035.
+* Improve performance of ``_is_binary_operator``.  PR #1052.
+* E275: requires whitespace around keywords.  PR #1063.
+* Add support for python 3.11. PR #1070.
+
 2.8.0 (2021-10-10)
 ------------------
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pycodestyle-2.8.0/PKG-INFO 
new/pycodestyle-2.9.1/PKG-INFO
--- old/pycodestyle-2.8.0/PKG-INFO      2021-10-11 02:55:58.077881300 +0200
+++ new/pycodestyle-2.9.1/PKG-INFO      2022-08-04 01:13:14.211308700 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: pycodestyle
-Version: 2.8.0
+Version: 2.9.1
 Summary: Python style guide checker
 Home-page: https://pycodestyle.pycqa.org/
 Author: Johann C. Rocholl
@@ -17,17 +17,14 @@
 Classifier: License :: OSI Approved :: MIT License
 Classifier: Operating System :: OS Independent
 Classifier: Programming Language :: Python
-Classifier: Programming Language :: Python :: 2
-Classifier: Programming Language :: Python :: 2.7
 Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.5
 Classifier: Programming Language :: Python :: 3.6
 Classifier: Programming Language :: Python :: 3.7
 Classifier: Programming Language :: Python :: 3.8
 Classifier: Programming Language :: Python :: Implementation :: CPython
 Classifier: Programming Language :: Python :: Implementation :: PyPy
 Classifier: Topic :: Software Development :: Libraries :: Python Modules
-Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*
+Requires-Python: >=3.6
 License-File: LICENSE
 
 pycodestyle (formerly called pep8) - Python style guide checker
@@ -143,6 +140,25 @@
 Changelog
 =========
 
+2.9.1 (2022-08-03)
+------------------
+
+Changes:
+
+* E275: fix false positive for yield expressions.
+
+2.9.0 (2022-07-30)
+------------------
+
+Changes:
+
+* E221, E222, E223, E224: add support for ``:=`` operator.  PR #1032.
+* Drop python 2.7 / 3.5.
+* E262: consider non-breaking spaces (``\xa0``) as whitespace.  PR #1035.
+* Improve performance of ``_is_binary_operator``.  PR #1052.
+* E275: requires whitespace around keywords.  PR #1063.
+* Add support for python 3.11. PR #1070.
+
 2.8.0 (2021-10-10)
 ------------------
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pycodestyle-2.8.0/docs/conf.py 
new/pycodestyle-2.9.1/docs/conf.py
--- old/pycodestyle-2.8.0/docs/conf.py  2021-10-11 02:41:06.000000000 +0200
+++ new/pycodestyle-2.9.1/docs/conf.py  2022-07-30 20:16:16.000000000 +0200
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
 #
 # pycodestyle documentation build configuration file, created by
 # sphinx-quickstart on Tue Aug 21 09:47:49 2012.
@@ -43,9 +42,9 @@
 master_doc = 'index'
 
 # General information about the project.
-project = u'pycodestyle'
-authors = u'Johann C. Rocholl, Florent Xicluna, Ian Lee'
-copyright = u'2006-2016, %s' % (authors)
+project = 'pycodestyle'
+authors = 'Johann C. Rocholl, Florent Xicluna, Ian Lee'
+copyright = '2006-2016, %s' % (authors)
 
 # The version info for the project you're documenting, acts as replacement for
 # |version| and |release|, also used in various other places throughout the
@@ -195,7 +194,7 @@
 # (source start file, target name, title,
 #  author, documentclass [howto/manual]).
 latex_documents = [
-    ('index', 'pycodestyle.tex', u'pycodestyle documentation',
+    ('index', 'pycodestyle.tex', 'pycodestyle documentation',
      authors, 'manual'),
 ]
 
@@ -225,7 +224,7 @@
 # One entry per manual page. List of tuples
 # (source start file, name, description, authors, manual section).
 man_pages = [
-    ('index', 'pycodestyle', u'pycodestyle documentation',
+    ('index', 'pycodestyle', 'pycodestyle documentation',
      [authors], 1)
 ]
 
@@ -239,7 +238,7 @@
 # (source start file, target name, title, author,
 #  dir menu entry, description, category)
 texinfo_documents = [
-    ('index', 'pycodestyle', u'pycodestyle documentation', authors,
+    ('index', 'pycodestyle', 'pycodestyle documentation', authors,
      'pycodestyle', 'One line description of project.',
      'Miscellaneous'),
 ]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pycodestyle-2.8.0/docs/intro.rst 
new/pycodestyle-2.9.1/docs/intro.rst
--- old/pycodestyle-2.8.0/docs/intro.rst        2021-10-11 01:56:59.000000000 
+0200
+++ new/pycodestyle-2.9.1/docs/intro.rst        2022-07-30 20:35:01.000000000 
+0200
@@ -264,7 +264,7 @@
 
+------------+----------------------------------------------------------------------+
 | E202       | whitespace before ')'                                           
     |
 
+------------+----------------------------------------------------------------------+
-| E203       | whitespace before ':'                                           
     |
+| E203       | whitespace before ',', ';', or ':'                              
     |
 
+------------+----------------------------------------------------------------------+
 
+------------+----------------------------------------------------------------------+
 | E211       | whitespace before '('                                           
     |
@@ -406,9 +406,9 @@
 
+------------+----------------------------------------------------------------------+
 | **W5**     | *Line break warning*                                            
     |
 
+------------+----------------------------------------------------------------------+
-| W503 (*) ?? | line break before binary operator   ?? ?? ?? ?? ?? ?? ?? ?? ?? 
?? ?? ??          |
+| W503 (*)   | line break before binary operator                               
     |
 
+------------+----------------------------------------------------------------------+
-| W504 (*) ?? | line break after binary operator    ?? ?? ?? ?? ?? ?? ?? ?? ?? 
?? ?? ??          |
+| W504 (*)   | line break after binary operator                                
     |
 
+------------+----------------------------------------------------------------------+
 | W505 (\*^) | doc line too long (82 > 79 characters)                          
     |
 
+------------+----------------------------------------------------------------------+
@@ -432,7 +432,7 @@
 **(*)** In the default configuration, the checks **E121**, **E123**, **E126**, 
**E133**,
 **E226**, **E241**, **E242**, **E704**, **W503**, **W504** and **W505** are 
ignored
 because they are not rules unanimously accepted, and `PEP 8`_ does not enforce 
them.
-Please note that if the option **--ignore=errors** is used,
+Please note that if the option ``--ignore=errors`` is used,
 the default configuration will be overridden and ignore only the check(s) you 
skip.
 The check **W503** is mutually exclusive with check **W504**.
 The check **E133** is mutually exclusive with check **E123**.  Use switch
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pycodestyle-2.8.0/pycodestyle.egg-info/PKG-INFO 
new/pycodestyle-2.9.1/pycodestyle.egg-info/PKG-INFO
--- old/pycodestyle-2.8.0/pycodestyle.egg-info/PKG-INFO 2021-10-11 
02:55:57.000000000 +0200
+++ new/pycodestyle-2.9.1/pycodestyle.egg-info/PKG-INFO 2022-08-04 
01:13:13.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: pycodestyle
-Version: 2.8.0
+Version: 2.9.1
 Summary: Python style guide checker
 Home-page: https://pycodestyle.pycqa.org/
 Author: Johann C. Rocholl
@@ -17,17 +17,14 @@
 Classifier: License :: OSI Approved :: MIT License
 Classifier: Operating System :: OS Independent
 Classifier: Programming Language :: Python
-Classifier: Programming Language :: Python :: 2
-Classifier: Programming Language :: Python :: 2.7
 Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.5
 Classifier: Programming Language :: Python :: 3.6
 Classifier: Programming Language :: Python :: 3.7
 Classifier: Programming Language :: Python :: 3.8
 Classifier: Programming Language :: Python :: Implementation :: CPython
 Classifier: Programming Language :: Python :: Implementation :: PyPy
 Classifier: Topic :: Software Development :: Libraries :: Python Modules
-Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*
+Requires-Python: >=3.6
 License-File: LICENSE
 
 pycodestyle (formerly called pep8) - Python style guide checker
@@ -143,6 +140,25 @@
 Changelog
 =========
 
+2.9.1 (2022-08-03)
+------------------
+
+Changes:
+
+* E275: fix false positive for yield expressions.
+
+2.9.0 (2022-07-30)
+------------------
+
+Changes:
+
+* E221, E222, E223, E224: add support for ``:=`` operator.  PR #1032.
+* Drop python 2.7 / 3.5.
+* E262: consider non-breaking spaces (``\xa0``) as whitespace.  PR #1035.
+* Improve performance of ``_is_binary_operator``.  PR #1052.
+* E275: requires whitespace around keywords.  PR #1063.
+* Add support for python 3.11. PR #1070.
+
 2.8.0 (2021-10-10)
 ------------------
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pycodestyle-2.8.0/pycodestyle.egg-info/SOURCES.txt 
new/pycodestyle-2.9.1/pycodestyle.egg-info/SOURCES.txt
--- old/pycodestyle-2.8.0/pycodestyle.egg-info/SOURCES.txt      2021-10-11 
02:55:57.000000000 +0200
+++ new/pycodestyle-2.9.1/pycodestyle.egg-info/SOURCES.txt      2022-08-04 
01:13:14.000000000 +0200
@@ -19,7 +19,6 @@
 pycodestyle.egg-info/SOURCES.txt
 pycodestyle.egg-info/dependency_links.txt
 pycodestyle.egg-info/entry_points.txt
-pycodestyle.egg-info/namespace_packages.txt
 pycodestyle.egg-info/not-zip-safe
 pycodestyle.egg-info/top_level.txt
 testsuite/E10.py
@@ -53,6 +52,7 @@
 testsuite/noqa.py
 testsuite/python3.py
 testsuite/python310.py
+testsuite/python311.py
 testsuite/python35.py
 testsuite/python38.py
 testsuite/support.py
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/pycodestyle-2.8.0/pycodestyle.egg-info/entry_points.txt 
new/pycodestyle-2.9.1/pycodestyle.egg-info/entry_points.txt
--- old/pycodestyle-2.8.0/pycodestyle.egg-info/entry_points.txt 2021-10-11 
02:55:57.000000000 +0200
+++ new/pycodestyle-2.9.1/pycodestyle.egg-info/entry_points.txt 2022-08-04 
01:13:13.000000000 +0200
@@ -1,3 +1,2 @@
 [console_scripts]
 pycodestyle = pycodestyle:_main
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/pycodestyle-2.8.0/pycodestyle.egg-info/namespace_packages.txt 
new/pycodestyle-2.9.1/pycodestyle.egg-info/namespace_packages.txt
--- old/pycodestyle-2.8.0/pycodestyle.egg-info/namespace_packages.txt   
2021-10-11 02:55:57.000000000 +0200
+++ new/pycodestyle-2.9.1/pycodestyle.egg-info/namespace_packages.txt   
1970-01-01 01:00:00.000000000 +0100
@@ -1 +0,0 @@
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pycodestyle-2.8.0/pycodestyle.py 
new/pycodestyle-2.9.1/pycodestyle.py
--- old/pycodestyle-2.8.0/pycodestyle.py        2021-10-11 02:55:05.000000000 
+0200
+++ new/pycodestyle-2.9.1/pycodestyle.py        2022-08-04 01:12:27.000000000 
+0200
@@ -46,8 +46,6 @@
 700 statements
 900 syntax error
 """
-from __future__ import with_statement
-
 import bisect
 import inspect
 import keyword
@@ -57,18 +55,8 @@
 import time
 import tokenize
 import warnings
-
-try:
-    from functools import lru_cache
-except ImportError:
-    def lru_cache(maxsize=128):  # noqa as it's a fake implementation.
-        """Does not really need a real a lru_cache, it's just
-        optimization, so let's just do nothing here. Python 3.2+ will
-        just get better performances, time to upgrade?
-        """
-        return lambda function: function
-
 from fnmatch import fnmatch
+from functools import lru_cache
 from optparse import OptionParser
 
 try:
@@ -84,7 +72,7 @@
 ):  # pragma: no cover (<py310)
     tokenize._compile = lru_cache()(tokenize._compile)  # type: ignore
 
-__version__ = '2.8.0'
+__version__ = '2.9.1'
 
 DEFAULT_EXCLUDE = '.svn,CVS,.bzr,.hg,.git,__pycache__,.tox'
 DEFAULT_IGNORE = 'E121,E123,E126,E226,E24,E704,W503,W504'
@@ -122,16 +110,13 @@
 UNARY_OPERATORS = frozenset(['>>', '**', '*', '+', '-'])
 ARITHMETIC_OP = frozenset(['**', '*', '/', '//', '+', '-', '@'])
 WS_OPTIONAL_OPERATORS = ARITHMETIC_OP.union(['^', '&', '|', '<<', '>>', '%'])
-# Warn for -> function annotation operator in py3.5+ (issue 803)
-FUNCTION_RETURN_ANNOTATION_OP = ['->'] if sys.version_info >= (3, 5) else []
 ASSIGNMENT_EXPRESSION_OP = [':='] if sys.version_info >= (3, 8) else []
 WS_NEEDED_OPERATORS = frozenset([
     '**=', '*=', '/=', '//=', '+=', '-=', '!=', '<>', '<', '>',
     '%=', '^=', '&=', '|=', '==', '<=', '>=', '<<=', '>>=', '=',
-    'and', 'in', 'is', 'or'] +
-    FUNCTION_RETURN_ANNOTATION_OP +
+    'and', 'in', 'is', 'or', '->'] +
     ASSIGNMENT_EXPRESSION_OP)
-WHITESPACE = frozenset(' \t')
+WHITESPACE = frozenset(' \t\xa0')
 NEWLINE = frozenset([tokenize.NL, tokenize.NEWLINE])
 SKIP_TOKENS = NEWLINE.union([tokenize.INDENT, tokenize.DEDENT])
 # ERRORTOKEN is triggered by backticks in Python 3
@@ -152,13 +137,13 @@
 COMPARE_TYPE_REGEX = re.compile(r'(?:[=!]=|is(?:\s+not)?)\s+type(?:s.\w+Type'
                                 r'|\s*\(\s*([^)]*[^ )])\s*\))')
 KEYWORD_REGEX = re.compile(r'(\s*)\b(?:%s)\b(\s*)' % r'|'.join(KEYWORDS))
-OPERATOR_REGEX = re.compile(r'(?:[^,\s])(\s*)(?:[-+*/|!<=>%&^]+)(\s*)')
+OPERATOR_REGEX = re.compile(r'(?:[^,\s])(\s*)(?:[-+*/|!<=>%&^]+|:=)(\s*)')
 LAMBDA_REGEX = re.compile(r'\blambda\b')
 HUNK_REGEX = re.compile(r'^@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@.*$')
 STARTSWITH_DEF_REGEX = re.compile(r'^(async\s+def|def)\b')
 STARTSWITH_TOP_LEVEL_REGEX = re.compile(r'^(async\s+def\s+|def\s+|class\s+|@)')
 STARTSWITH_INDENT_STATEMENT_REGEX = re.compile(
-    r'^\s*({0})\b'.format('|'.join(s.replace(' ', r'\s+') for s in (
+    r'^\s*({})\b'.format('|'.join(s.replace(' ', r'\s+') for s in (
         'def', 'async def',
         'for', 'async for',
         'if', 'elif', 'else',
@@ -175,13 +160,10 @@
 
 
 def _get_parameters(function):
-    if sys.version_info >= (3, 3):
-        return [parameter.name
-                for parameter
-                in inspect.signature(function).parameters.values()
-                if parameter.kind == parameter.POSITIONAL_OR_KEYWORD]
-    else:
-        return inspect.getargspec(function)[0]
+    return [parameter.name
+            for parameter
+            in inspect.signature(function).parameters.values()
+            if parameter.kind == parameter.POSITIONAL_OR_KEYWORD]
 
 
 def register_check(check, codes=None):
@@ -307,12 +289,6 @@
             (len(chunks) == 2 and chunks[0] == '#')) and \
                 len(line) - len(chunks[-1]) < max_line_length - 7:
             return
-        if hasattr(line, 'decode'):   # Python 2
-            # The line could contain multi-byte characters
-            try:
-                length = len(line.decode('utf-8'))
-            except UnicodeError:
-                pass
         if length > max_line_length:
             return (max_line_length, "E501 line too long "
                     "(%d > %d characters)" % (length, max_line_length))
@@ -429,8 +405,8 @@
                     yield 0, "E306 expected %s blank line before a " \
                         "nested definition, found 0" % (method_lines,)
                 else:
-                    yield 0, "E301 expected %s blank line, found 0" % (
-                        method_lines,)
+                    yield 0, "E301 expected {} blank line, found 0".format(
+                        method_lines)
         elif blank_before != top_level_lines:
             yield 0, "E302 expected %s blank lines, found %d" % (
                 top_level_lines, blank_before)
@@ -474,7 +450,7 @@
             yield found + 1, "E201 whitespace after '%s'" % char
         elif line[found - 1] != ',':
             code = ('E202' if char in '}])' else 'E203')  # if char in ',;:'
-            yield found, "%s whitespace before '%s'" % (code, char)
+            yield found, f"{code} whitespace before '{char}'"
 
 
 @register_check
@@ -502,21 +478,26 @@
 
 
 @register_check
-def missing_whitespace_after_import_keyword(logical_line):
-    r"""Multiple imports in form from x import (a, b, c) should have
-    space between import statement and parenthesised name list.
+def missing_whitespace_after_keyword(logical_line, tokens):
+    r"""Keywords should be followed by whitespace.
 
     Okay: from foo import (bar, baz)
     E275: from foo import(bar, baz)
     E275: from importable.module import(bar, baz)
+    E275: if(foo): bar
     """
-    line = logical_line
-    indicator = ' import('
-    if line.startswith('from '):
-        found = line.find(indicator)
-        if -1 < found:
-            pos = found + len(indicator) - 1
-            yield pos, "E275 missing whitespace after keyword"
+    for tok0, tok1 in zip(tokens, tokens[1:]):
+        # This must exclude the True/False/None singletons, which can
+        # appear e.g. as "if x is None:", and async/await, which were
+        # valid identifier names in old Python versions.
+        if (tok0.end == tok1.start and
+                keyword.iskeyword(tok0.string) and
+                tok0.string not in SINGLETONS and
+                tok0.string not in ('async', 'await') and
+                not (tok0.string == 'except' and tok1.string == '*') and
+                not (tok0.string == 'yield' and tok1.string == ')') and
+                tok1.string not in ':\n'):
+            yield tok0.end, "E275 missing whitespace after keyword"
 
 
 @register_check
@@ -735,7 +716,7 @@
             indent[depth] = start[1]
             indent_chances[start[1]] = True
             if verbose >= 4:
-                print("bracket depth %s indent to %s" % (depth, start[1]))
+                print(f"bracket depth {depth} indent to {start[1]}")
         # deal with implicit string concatenation
         elif (token_type in (tokenize.STRING, tokenize.COMMENT) or
               text in ('u', 'ur', 'b', 'br')):
@@ -1064,21 +1045,24 @@
 
 @register_check
 def whitespace_before_comment(logical_line, tokens):
-    r"""Separate inline comments by at least two spaces.
+    """Separate inline comments by at least two spaces.
 
     An inline comment is a comment on the same line as a statement.
     Inline comments should be separated by at least two spaces from the
     statement. They should start with a # and a single space.
 
-    Each line of a block comment starts with a # and a single space
-    (unless it is indented text inside the comment).
+    Each line of a block comment starts with a # and one or multiple
+    spaces as there can be indented text inside the comment.
 
     Okay: x = x + 1  # Increment x
     Okay: x = x + 1    # Increment x
-    Okay: # Block comment
+    Okay: # Block comments:
+    Okay: #  - Block comment list
+    Okay: # \xa0- Block comment list
     E261: x = x + 1 # Increment x
     E262: x = x + 1  #Increment x
     E262: x = x + 1  #  Increment x
+    E262: x = x + 1  # \xa0Increment x
     E265: #Block comment
     E266: ### Block comment
     """
@@ -1228,7 +1212,7 @@
             lambda_kw = LAMBDA_REGEX.search(line, 0, found)
             if lambda_kw:
                 before = line[:lambda_kw.start()].rstrip()
-                if before[-1:] == '=' and isidentifier(before[:-1].strip()):
+                if before[-1:] == '=' and before[:-1].strip().isidentifier():
                     yield 0, ("E731 do not assign a lambda expression, use a "
                               "def")
                 break
@@ -1288,20 +1272,19 @@
                 parens -= 1
 
 
+# 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.
 _SYMBOLIC_OPS = frozenset("()[]{},:.;@=%~") | frozenset(("...",))
 
 
 def _is_binary_operator(token_type, text):
-    is_op_token = token_type == tokenize.OP
-    is_conjunction = text in ['and', 'or']
-    # NOTE(sigmavirus24): Previously the not_a_symbol check was executed
-    # conditionally. Since it is now *always* executed, text may be
-    # None. In that case we get a TypeError for `text not in str`.
-    not_a_symbol = text and text not in _SYMBOLIC_OPS
-    # 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 ((is_op_token or is_conjunction) and not_a_symbol)
+    return (
+        token_type == tokenize.OP or
+        text in {'and', 'or'}
+    ) and (
+        text not in _SYMBOLIC_OPS
+    )
 
 
 def _break_around_binary_operators(tokens):
@@ -1473,7 +1456,7 @@
     match = COMPARE_TYPE_REGEX.search(logical_line)
     if match and not noqa:
         inst = match.group(1)
-        if inst and isidentifier(inst) and inst not in SINGLETONS:
+        if inst and inst.isidentifier() and inst not in SINGLETONS:
             return  # Allow comparison for types which are not obvious
         yield match.start(), "E721 do not compare types, use 'isinstance()'"
 
@@ -1791,12 +1774,6 @@
             if prev_token is None or prev_token in SKIP_TOKENS:
                 lines = line.splitlines()
                 for line_num, physical_line in enumerate(lines):
-                    if hasattr(physical_line, 'decode'):  # Python 2
-                        # The line could contain multi-byte characters
-                        try:
-                            physical_line = physical_line.decode('utf-8')
-                        except UnicodeError:
-                            pass
                     if start[0] + line_num == 1 and line.startswith('#!'):
                         return
                     length = len(physical_line)
@@ -1822,30 +1799,21 @@
 ########################################################################
 
 
-if sys.version_info < (3,):
-    # Python 2: implicit encoding.
-    def readlines(filename):
-        """Read the source code."""
-        with open(filename, 'rU') as f:
+def readlines(filename):
+    """Read the source code."""
+    try:
+        with tokenize.open(filename) as f:
+            return f.readlines()
+    except (LookupError, SyntaxError, UnicodeError):
+        # Fall back if file encoding is improperly declared
+        with open(filename, encoding='latin-1') as f:
             return f.readlines()
-    isidentifier = re.compile(r'[a-zA-Z_]\w*$').match
-    stdin_get_value = sys.stdin.read
-else:
-    # Python 3
-    def readlines(filename):
-        """Read the source code."""
-        try:
-            with tokenize.open(filename) as f:
-                return f.readlines()
-        except (LookupError, SyntaxError, UnicodeError):
-            # Fall back if file encoding is improperly declared
-            with open(filename, encoding='latin-1') as f:
-                return f.readlines()
-    isidentifier = str.isidentifier
-
-    def stdin_get_value():
-        """Read the value from stdin."""
-        return TextIOWrapper(sys.stdin.buffer, errors='ignore').read()
+
+
+def stdin_get_value():
+    """Read the value from stdin."""
+    return TextIOWrapper(sys.stdin.buffer, errors='ignore').read()
+
 
 noqa = lru_cache(512)(re.compile(r'# no(?:qa|pep8)\b', re.I).search)
 
@@ -1911,7 +1879,7 @@
             continue
         if line[:3] == '@@ ':
             hunk_match = HUNK_REGEX.match(line)
-            (row, nrows) = [int(g or '1') for g in hunk_match.groups()]
+            (row, nrows) = (int(g or '1') for g in hunk_match.groups())
             rv[path].update(range(row, row + nrows))
         elif line[:3] == '+++':
             path = line[4:].split('\t', 1)[0]
@@ -1972,7 +1940,7 @@
 ########################################################################
 
 
-class Checker(object):
+class Checker:
     """Load a Python source file, tokenize it, check coding style."""
 
     def __init__(self, filename=None, lines=None,
@@ -2004,9 +1972,9 @@
         elif lines is None:
             try:
                 self.lines = readlines(filename)
-            except IOError:
+            except OSError:
                 (exc_type, exc) = sys.exc_info()[:2]
-                self._io_error = '%s: %s' % (exc_type.__name__, exc)
+                self._io_error = f'{exc_type.__name__}: {exc}'
                 self.lines = []
         else:
             self.lines = lines
@@ -2031,7 +1999,7 @@
         else:
             offset = (1, 0)
         self.report_error(offset[0], offset[1] or 0,
-                          'E901 %s: %s' % (exc_type.__name__, exc.args[0]),
+                          f'E901 {exc_type.__name__}: {exc.args[0]}',
                           self.report_invalid_syntax)
 
     def readline(self):
@@ -2224,7 +2192,7 @@
             token_type, text = token[0:2]
             if self.verbose >= 3:
                 if token[2][0] == token[3][0]:
-                    pos = '[%s:%s]' % (token[2][1] or '', token[3][1])
+                    pos = '[{}:{}]'.format(token[2][1] or '', token[3][1])
                 else:
                     pos = 'l.%s' % token[3][0]
                 print('l.%s\t%s\t%s\t%r' %
@@ -2251,7 +2219,7 @@
         return self.report.get_file_results()
 
 
-class BaseReport(object):
+class BaseReport:
     """Collect the results of the checks."""
 
     print_filename = False
@@ -2333,7 +2301,7 @@
 
     def print_benchmark(self):
         """Print benchmark numbers."""
-        print('%-7.2f %s' % (self.elapsed, 'seconds elapsed'))
+        print('{:<7.2f} {}'.format(self.elapsed, 'seconds elapsed'))
         if self.elapsed:
             for key in self._benchmark_keys:
                 print('%-7d %s per second (%d total)' %
@@ -2351,7 +2319,7 @@
     """Collect and print the results of the checks."""
 
     def __init__(self, options):
-        super(StandardReport, self).__init__(options)
+        super().__init__(options)
         self._fmt = REPORT_FORMAT.get(options.format.lower(),
                                       options.format)
         self._repeat = options.repeat
@@ -2361,13 +2329,12 @@
     def init_file(self, filename, lines, expected, line_offset):
         """Signal a new file."""
         self._deferred_print = []
-        return super(StandardReport, self).init_file(
+        return super().init_file(
             filename, lines, expected, line_offset)
 
     def error(self, line_number, offset, text, check):
         """Report an error, according to options."""
-        code = super(StandardReport, self).error(line_number, offset,
-                                                 text, check)
+        code = super().error(line_number, offset, text, check)
         if code and (self.counters[code] == 1 or self._repeat):
             self._deferred_print.append(
                 (line_number, offset, code, text[5:], check.__doc__))
@@ -2406,16 +2373,16 @@
     """Collect and print the results for the changed lines only."""
 
     def __init__(self, options):
-        super(DiffReport, self).__init__(options)
+        super().__init__(options)
         self._selected = options.selected_lines
 
     def error(self, line_number, offset, text, check):
         if line_number not in self._selected[self.filename]:
             return
-        return super(DiffReport, self).error(line_number, offset, text, check)
+        return super().error(line_number, offset, text, check)
 
 
-class StyleGuide(object):
+class StyleGuide:
     """Initialize a PEP-8 instance with few options."""
 
     def __init__(self, *args, **kwargs):
@@ -2505,8 +2472,10 @@
                     dirs.remove(subdir)
             for filename in sorted(files):
                 # contain a pattern that matches?
-                if ((filename_match(filename, filepatterns) and
-                     not self.excluded(filename, root))):
+                if (
+                    filename_match(filename, filepatterns) and
+                    not self.excluded(filename, root)
+                ):
                     runner(os.path.join(root, filename))
 
     def excluded(self, filename, parent=None):
@@ -2676,8 +2645,8 @@
                 print("  unknown option '%s' ignored" % opt)
                 continue
             if options.verbose > 1:
-                print("  %s = %s" % (opt,
-                                     config.get(pycodestyle_section, opt)))
+                print("  {} = {}".format(opt,
+                                         config.get(pycodestyle_section, opt)))
             normalized_opt = opt.replace('-', '_')
             opt_type = option_list[normalized_opt]
             if opt_type in ('int', 'count'):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pycodestyle-2.8.0/setup.py 
new/pycodestyle-2.9.1/setup.py
--- old/pycodestyle-2.8.0/setup.py      2021-10-11 02:41:06.000000000 +0200
+++ new/pycodestyle-2.9.1/setup.py      2022-07-30 20:16:16.000000000 +0200
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
 from setuptools import setup
 
 
@@ -30,14 +29,9 @@
     url='https://pycodestyle.pycqa.org/',
     license='Expat license',
     py_modules=['pycodestyle'],
-    namespace_packages=[],
     include_package_data=True,
     zip_safe=False,
-    python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*',
-    install_requires=[
-        # Broken with Python 3: https://github.com/pypa/pip/issues/650
-        # 'setuptools',
-    ],
+    python_requires='>=3.6',
     entry_points={
         'console_scripts': [
             'pycodestyle = pycodestyle:_main',
@@ -50,10 +44,7 @@
         'License :: OSI Approved :: MIT License',
         'Operating System :: OS Independent',
         'Programming Language :: Python',
-        'Programming Language :: Python :: 2',
-        'Programming Language :: Python :: 2.7',
         'Programming Language :: Python :: 3',
-        'Programming Language :: Python :: 3.5',
         'Programming Language :: Python :: 3.6',
         'Programming Language :: Python :: 3.7',
         'Programming Language :: Python :: 3.8',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pycodestyle-2.8.0/testsuite/E12not.py 
new/pycodestyle-2.9.1/testsuite/E12not.py
--- old/pycodestyle-2.8.0/testsuite/E12not.py   2021-10-11 02:09:26.000000000 
+0200
+++ new/pycodestyle-2.9.1/testsuite/E12not.py   2022-07-30 20:35:01.000000000 
+0200
@@ -40,8 +40,8 @@
 
 if start[1] > end_col and not (
         over_indent == 4 and indent_next):
-    return(0, "E121 continuation line over-"
-           "indented for visual indent")
+    return (0, "E121 continuation line over-"
+            "indented for visual indent")
 
 
 print "OK", ("visual",
@@ -175,7 +175,7 @@
 #
 
 if bar:
-    return(
+    return (
         start, 'E121 lines starting with a '
         'closing bracket should be indented '
         "to match that of the opening "
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pycodestyle-2.8.0/testsuite/E26.py 
new/pycodestyle-2.9.1/testsuite/E26.py
--- old/pycodestyle-2.8.0/testsuite/E26.py      2021-10-11 02:09:26.000000000 
+0200
+++ new/pycodestyle-2.9.1/testsuite/E26.py      2022-07-30 20:16:16.000000000 
+0200
@@ -57,3 +57,10 @@
     # ################################################################ #
     # ####################### another separator ###################### #
     # ################################################################ #
+#: E262:3:9
+# -*- coding: utf8 -*-
+# ??(One space one NBSP) Ok for block comment
+a = 42  # ??(One space one NBSP)
+#: E262:2:9
+#  (Two spaces) Ok for block comment
+a = 42  #  (Two spaces)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pycodestyle-2.8.0/testsuite/E27.py 
new/pycodestyle-2.9.1/testsuite/E27.py
--- old/pycodestyle-2.8.0/testsuite/E27.py      2021-10-11 01:56:59.000000000 
+0200
+++ new/pycodestyle-2.9.1/testsuite/E27.py      2022-08-04 00:52:37.000000000 
+0200
@@ -42,5 +42,17 @@
     from importable.module import(e, f)
 except ImportError:
     pass
+#: E275
+if(foo):
+    pass
+else:
+    pass
 #: Okay
 matched = {"true": True, "false": False}
+#: E275:2:11
+if True:
+    assert(1)
+#: Okay
+def f():
+    print((yield))
+    x = (yield)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pycodestyle-2.8.0/testsuite/E72.py 
new/pycodestyle-2.9.1/testsuite/E72.py
--- old/pycodestyle-2.8.0/testsuite/E72.py      2021-10-11 02:09:26.000000000 
+0200
+++ new/pycodestyle-2.9.1/testsuite/E72.py      2022-07-30 21:17:48.000000000 
+0200
@@ -80,3 +80,8 @@
     pass
 except Exception:
     pass
+#: Okay
+from . import compute_type
+
+if compute_type(foo) == 5:
+    pass
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pycodestyle-2.8.0/testsuite/W19.py 
new/pycodestyle-2.9.1/testsuite/W19.py
--- old/pycodestyle-2.8.0/testsuite/W19.py      2021-10-11 02:09:26.000000000 
+0200
+++ new/pycodestyle-2.9.1/testsuite/W19.py      2022-07-30 20:35:01.000000000 
+0200
@@ -41,8 +41,8 @@
 #: E101 E101 W191 W191
 if start[1] > end_col and not (
         over_indent == 4 and indent_next):
-       return(0, "E121 continuation line over-"
-              "indented for visual indent")
+       return (0, "E121 continuation line over-"
+               "indented for visual indent")
 #:
 
 #: E101 W191
@@ -58,7 +58,7 @@
        raise Exception("%s,%s - %s" % (row, col, self.moduleCount))
 #: E101 E101 E101 E101 W191 W191 W191 W191 W191 W191
 if bar:
-       return(
+       return (
            start, 'E121 lines starting with a '
            'closing bracket should be indented '
            "to match that of the opening "
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pycodestyle-2.8.0/testsuite/python311.py 
new/pycodestyle-2.9.1/testsuite/python311.py
--- old/pycodestyle-2.8.0/testsuite/python311.py        1970-01-01 
01:00:00.000000000 +0100
+++ new/pycodestyle-2.9.1/testsuite/python311.py        2022-07-30 
20:35:01.000000000 +0200
@@ -0,0 +1,23 @@
+#: Okay
+try:
+    ...
+except* OSError as e:
+    pass
+#: Okay
+from typing import Generic
+from typing import TypeVarTuple
+
+
+Ts = TypeVarTuple('Ts')
+
+
+class Shape(Generic[*Ts]):
+    pass
+
+
+def f(*args: *Ts) -> None:
+    ...
+
+
+def g(x: Shape[*Ts]) -> Shape[*Ts]:
+    ...
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pycodestyle-2.8.0/testsuite/python38.py 
new/pycodestyle-2.9.1/testsuite/python38.py
--- old/pycodestyle-2.8.0/testsuite/python38.py 2021-10-11 01:56:59.000000000 
+0200
+++ new/pycodestyle-2.9.1/testsuite/python38.py 2022-07-30 20:16:16.000000000 
+0200
@@ -42,3 +42,14 @@
 all_the_things: t.List[str] = []
 
 import logging
+#: E221:1:5 E222:1:9 E221:3:6
+if x  :=  1:
+    pass
+if (x  := 2):
+    pass
+#: E223:1:5 E224:1:8
+if x   :=      2:
+    pass
+#: E221:1:6 E221:1:19
+if (x  := 1) == (y  := 2):
+    pass
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pycodestyle-2.8.0/testsuite/test_all.py 
new/pycodestyle-2.9.1/testsuite/test_all.py
--- old/pycodestyle-2.8.0/testsuite/test_all.py 2021-10-11 01:56:59.000000000 
+0200
+++ new/pycodestyle-2.9.1/testsuite/test_all.py 2022-07-30 20:35:01.000000000 
+0200
@@ -7,9 +7,6 @@
 import pycodestyle
 from testsuite.support import init_tests, selftest, ROOT_DIR
 
-# Note: please only use a subset of unittest methods which were present
-# in Python 2.5: assert(True|False|Equal|NotEqual|Raises)
-
 
 class PycodestyleTestCase(unittest.TestCase):
     """Test the standard errors and warnings (E and W)."""
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pycodestyle-2.8.0/testsuite/test_api.py 
new/pycodestyle-2.9.1/testsuite/test_api.py
--- old/pycodestyle-2.8.0/testsuite/test_api.py 2021-10-11 02:09:26.000000000 
+0200
+++ new/pycodestyle-2.9.1/testsuite/test_api.py 2022-07-30 20:35:01.000000000 
+0200
@@ -322,18 +322,6 @@
         # < 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)
-        pycodestyle.register_check(DummyChecker, ['Z701'])
-        source = u'#\n'
-
-        pep8style = pycodestyle.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):
         pycodestyle.register_check(DummyChecker, ['Z701'])
 
@@ -341,10 +329,7 @@
         count_errors = pep8style.input_file('stdin', lines=['\x00\n'])
 
         stdout = sys.stdout.getvalue()
-        if 'ValueError' in stdout:  # pragma: no cover (python 3.5+)
-            expected = "stdin:1:1: E901 ValueError"
-        else:  # pragma: no cover (< python3.5)
-            expected = "stdin:1:1: E901 TypeError"
+        expected = "stdin:1:1: E901 ValueError"
         self.assertTrue(stdout.startswith(expected),
                         msg='Output %r does not start with %r' %
                         (stdout, expected))

Reply via email to