Hello community, here is the log from the commit of package python-pyflakes for openSUSE:Factory checked in at 2017-11-04 10:23:27 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-pyflakes (Old) and /work/SRC/openSUSE:Factory/.python-pyflakes.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "python-pyflakes" Sat Nov 4 10:23:27 2017 rev:20 rq:528595 version:1.6.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-pyflakes/python-pyflakes.changes 2017-04-19 18:05:28.263288799 +0200 +++ /work/SRC/openSUSE:Factory/.python-pyflakes.new/python-pyflakes.changes 2017-11-04 10:24:37.121082844 +0100 @@ -1,0 +2,7 @@ +Sun Sep 24 21:39:36 UTC 2017 - arun@gmx.de + +- update to version 1.6.0: + * Process function scope variable annotations for used names + * Find Python files without extensions by their shebang + +------------------------------------------------------------------- Old: ---- pyflakes-1.5.0.tar.gz New: ---- pyflakes-1.6.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-pyflakes.spec ++++++ --- /var/tmp/diff_new_pack.3ImOK1/_old 2017-11-04 10:24:37.589065815 +0100 +++ /var/tmp/diff_new_pack.3ImOK1/_new 2017-11-04 10:24:37.589065815 +0100 @@ -18,7 +18,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-pyflakes -Version: 1.5.0 +Version: 1.6.0 Release: 0 Url: https://launchpad.net/pyflakes Summary: Passive checker of Python programs ++++++ pyflakes-1.5.0.tar.gz -> pyflakes-1.6.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyflakes-1.5.0/NEWS.txt new/pyflakes-1.6.0/NEWS.txt --- old/pyflakes-1.5.0/NEWS.txt 2017-01-10 02:00:33.000000000 +0100 +++ new/pyflakes-1.6.0/NEWS.txt 2017-08-03 16:36:44.000000000 +0200 @@ -1,3 +1,7 @@ +1.6.0 (2017-08-03) + - Process function scope variable annotations for used names + - Find Python files without extensions by their shebang + 1.5.0 (2017-01-09) - Enable support for PEP 526 annotated assignments diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyflakes-1.5.0/PKG-INFO new/pyflakes-1.6.0/PKG-INFO --- old/pyflakes-1.5.0/PKG-INFO 2017-01-10 02:01:20.000000000 +0100 +++ new/pyflakes-1.6.0/PKG-INFO 2017-08-03 16:54:11.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: pyflakes -Version: 1.5.0 +Version: 1.6.0 Summary: passive checker of Python programs Home-page: https://github.com/PyCQA/pyflakes Author: A lot of people @@ -17,7 +17,7 @@ modules with side effects. It's also much faster. It is `available on PyPI https://pypi.python.org/pypi/pyflakes`_ - and it supports all active versions of Python from 2.5 to 3.5. + and it supports all active versions of Python from 2.5 to 3.6. @@ -69,7 +69,7 @@ Contributing ------------ - Issues are tracked on `Launchpad https://bugs.launchpad.net/pyflakes`_. + Issues are tracked on `GitHub https://github.com/PyCQA/pyflakes/issues`_. Patches may be submitted via a `GitHub pull request`_ or via the mailing list if you prefer. If you are comfortable doing so, please `rebase your changes`_ @@ -80,7 +80,7 @@ All changes should include tests and pass flake8_. - .. image:: https://api.travis-ci.org/PyCQA/pyflakes.svg + .. image:: https://api.travis-ci.org/PyCQA/pyflakes.svg?branch=master :target: https://travis-ci.org/PyCQA/pyflakes :alt: Build status diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyflakes-1.5.0/README.rst new/pyflakes-1.6.0/README.rst --- old/pyflakes-1.5.0/README.rst 2016-12-30 16:09:43.000000000 +0100 +++ new/pyflakes-1.6.0/README.rst 2017-08-03 16:28:59.000000000 +0200 @@ -9,7 +9,7 @@ modules with side effects. It's also much faster. It is `available on PyPI https://pypi.python.org/pypi/pyflakes`_ -and it supports all active versions of Python from 2.5 to 3.5. +and it supports all active versions of Python from 2.5 to 3.6. @@ -61,7 +61,7 @@ Contributing ------------ -Issues are tracked on `Launchpad https://bugs.launchpad.net/pyflakes`_. +Issues are tracked on `GitHub https://github.com/PyCQA/pyflakes/issues`_. Patches may be submitted via a `GitHub pull request`_ or via the mailing list if you prefer. If you are comfortable doing so, please `rebase your changes`_ @@ -72,7 +72,7 @@ All changes should include tests and pass flake8_. -.. image:: https://api.travis-ci.org/PyCQA/pyflakes.svg +.. image:: https://api.travis-ci.org/PyCQA/pyflakes.svg?branch=master :target: https://travis-ci.org/PyCQA/pyflakes :alt: Build status diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyflakes-1.5.0/pyflakes/__init__.py new/pyflakes-1.6.0/pyflakes/__init__.py --- old/pyflakes-1.5.0/pyflakes/__init__.py 2017-01-10 02:00:48.000000000 +0100 +++ new/pyflakes-1.6.0/pyflakes/__init__.py 2017-08-03 16:35:03.000000000 +0200 @@ -1 +1 @@ -__version__ = '1.5.0' +__version__ = '1.6.0' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyflakes-1.5.0/pyflakes/api.py new/pyflakes-1.6.0/pyflakes/api.py --- old/pyflakes-1.5.0/pyflakes/api.py 2016-03-15 18:28:26.000000000 +0100 +++ new/pyflakes-1.6.0/pyflakes/api.py 2017-06-21 16:37:06.000000000 +0200 @@ -5,6 +5,7 @@ import sys import os +import re import _ast from pyflakes import checker, __version__ @@ -13,6 +14,9 @@ __all__ = ['check', 'checkPath', 'checkRecursive', 'iterSourceCode', 'main'] +PYTHON_SHEBANG_REGEX = re.compile(br'^#!.*\bpython[23w]?\b\s*$') + + def check(codeString, filename, reporter=None): """ Check the Python source given by C{codeString} for flakes. @@ -108,6 +112,25 @@ return check(codestr, filename, reporter) +def isPythonFile(filename): + """Return True if filename points to a Python file.""" + if filename.endswith('.py'): + return True + + max_bytes = 128 + + try: + with open(filename, 'rb') as f: + text = f.read(max_bytes) + if not text: + return False + except IOError: + return False + + first_line = text.splitlines()[0] + return PYTHON_SHEBANG_REGEX.match(first_line) + + def iterSourceCode(paths): """ Iterate over all Python source files in C{paths}. @@ -120,8 +143,9 @@ if os.path.isdir(path): for dirpath, dirnames, filenames in os.walk(path): for filename in filenames: - if filename.endswith('.py'): - yield os.path.join(dirpath, filename) + full_path = os.path.join(dirpath, filename) + if isPythonFile(full_path): + yield full_path else: yield path diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyflakes-1.5.0/pyflakes/checker.py new/pyflakes-1.6.0/pyflakes/checker.py --- old/pyflakes-1.5.0/pyflakes/checker.py 2017-01-10 01:59:55.000000000 +0100 +++ new/pyflakes-1.6.0/pyflakes/checker.py 2017-06-21 16:37:06.000000000 +0200 @@ -870,7 +870,19 @@ def handleDoctests(self, node): try: - (docstring, node_lineno) = self.getDocstring(node.body[0]) + if hasattr(node, 'docstring'): + docstring = node.docstring + + # This is just a reasonable guess. In Python 3.7, docstrings no + # longer have line numbers associated with them. This will be + # incorrect if there are empty lines between the beginning + # of the function and the docstring. + node_lineno = node.lineno + if hasattr(node, 'args'): + node_lineno = max([node_lineno] + + [arg.lineno for arg in node.args.args]) + else: + (docstring, node_lineno) = self.getDocstring(node.body[0]) examples = docstring and self._getDoctestExamples(docstring) except (ValueError, IndexError): # e.g. line 6 of the docstring for <string> has inconsistent @@ -1337,19 +1349,12 @@ pass def ANNASSIGN(self, node): - """ - Annotated assignments don't have annotations evaluated on function - scope, hence the custom implementation. - - See: PEP 526. - """ if node.value: # Only bind the *targets* if the assignment has a value. # Otherwise it's not really ast.Store and shouldn't silence # UndefinedLocal warnings. self.handleNode(node.target, node) - if not isinstance(self.scope, FunctionScope): - self.handleNode(node.annotation, node) + self.handleNode(node.annotation, node) if node.value: # If the assignment has value, handle the *value* now. self.handleNode(node.value, node) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyflakes-1.5.0/pyflakes/test/test_api.py new/pyflakes-1.6.0/pyflakes/test/test_api.py --- old/pyflakes-1.5.0/pyflakes/test/test_api.py 2016-09-01 21:49:06.000000000 +0200 +++ new/pyflakes-1.6.0/pyflakes/test/test_api.py 2017-06-21 16:37:06.000000000 +0200 @@ -187,6 +187,36 @@ sorted(iterSourceCode([self.tempdir])), sorted([apath, bpath, cpath])) + def test_shebang(self): + """ + Find Python files that don't end with `.py`, but contain a Python + shebang. + """ + python = os.path.join(self.tempdir, 'a') + with open(python, 'w') as fd: + fd.write('#!/usr/bin/env python\n') + + self.makeEmptyFile('b') + + with open(os.path.join(self.tempdir, 'c'), 'w') as fd: + fd.write('hello\nworld\n') + + python2 = os.path.join(self.tempdir, 'd') + with open(python2, 'w') as fd: + fd.write('#!/usr/bin/env python2\n') + + python3 = os.path.join(self.tempdir, 'e') + with open(python3, 'w') as fd: + fd.write('#!/usr/bin/env python3\n') + + pythonw = os.path.join(self.tempdir, 'f') + with open(pythonw, 'w') as fd: + fd.write('#!/usr/bin/env pythonw\n') + + self.assertEqual( + sorted(iterSourceCode([self.tempdir])), + sorted([python, python2, python3, pythonw])) + def test_multipleDirectories(self): """ L{iterSourceCode} can be given multiple directories. It will recurse @@ -518,6 +548,9 @@ If the source file is not readable, this is reported on standard error. """ + if os.getuid() == 0: + self.skipTest('root user can access all files regardless of ' + 'permissions') sourcePath = self.makeTempFile('') os.chmod(sourcePath, 0) count, errors = self.getErrors(sourcePath) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyflakes-1.5.0/pyflakes/test/test_other.py new/pyflakes-1.6.0/pyflakes/test/test_other.py --- old/pyflakes-1.5.0/pyflakes/test/test_other.py 2017-01-10 01:59:55.000000000 +0100 +++ new/pyflakes-1.6.0/pyflakes/test/test_other.py 2017-06-21 16:37:02.000000000 +0200 @@ -1839,13 +1839,18 @@ name: str = 'Bob' age: int = 18 foo: not_a_real_type = None - ''', m.UnusedVariable, m.UnusedVariable, m.UnusedVariable) + ''', m.UnusedVariable, m.UnusedVariable, m.UnusedVariable, m.UndefinedName) self.flakes(''' def f(): name: str print(name) ''', m.UndefinedName) self.flakes(''' + from typing import Any + def f(): + a: Any + ''') + self.flakes(''' foo: not_a_real_type ''', m.UndefinedName) self.flakes(''' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyflakes-1.5.0/pyflakes.egg-info/PKG-INFO new/pyflakes-1.6.0/pyflakes.egg-info/PKG-INFO --- old/pyflakes-1.5.0/pyflakes.egg-info/PKG-INFO 2017-01-10 02:01:19.000000000 +0100 +++ new/pyflakes-1.6.0/pyflakes.egg-info/PKG-INFO 2017-08-03 16:54:11.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: pyflakes -Version: 1.5.0 +Version: 1.6.0 Summary: passive checker of Python programs Home-page: https://github.com/PyCQA/pyflakes Author: A lot of people @@ -17,7 +17,7 @@ modules with side effects. It's also much faster. It is `available on PyPI https://pypi.python.org/pypi/pyflakes`_ - and it supports all active versions of Python from 2.5 to 3.5. + and it supports all active versions of Python from 2.5 to 3.6. @@ -69,7 +69,7 @@ Contributing ------------ - Issues are tracked on `Launchpad https://bugs.launchpad.net/pyflakes`_. + Issues are tracked on `GitHub https://github.com/PyCQA/pyflakes/issues`_. Patches may be submitted via a `GitHub pull request`_ or via the mailing list if you prefer. If you are comfortable doing so, please `rebase your changes`_ @@ -80,7 +80,7 @@ All changes should include tests and pass flake8_. - .. image:: https://api.travis-ci.org/PyCQA/pyflakes.svg + .. image:: https://api.travis-ci.org/PyCQA/pyflakes.svg?branch=master :target: https://travis-ci.org/PyCQA/pyflakes :alt: Build status diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyflakes-1.5.0/setup.cfg new/pyflakes-1.6.0/setup.cfg --- old/pyflakes-1.5.0/setup.cfg 2017-01-10 02:01:20.000000000 +0100 +++ new/pyflakes-1.6.0/setup.cfg 2017-08-03 16:54:11.000000000 +0200 @@ -1,8 +1,7 @@ -[wheel] +[bdist_wheel] universal = 1 [egg_info] tag_build = tag_date = 0 -tag_svn_revision = 0