Hello community, here is the log from the commit of package python-pylama for openSUSE:Factory checked in at 2019-05-10 09:09:50 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-pylama (Old) and /work/SRC/openSUSE:Factory/.python-pylama.new.5148 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pylama" Fri May 10 09:09:50 2019 rev:4 rq:701546 version:7.7.1 Changes: -------- --- /work/SRC/openSUSE:Factory/python-pylama/python-pylama.changes 2019-02-19 12:02:20.385077891 +0100 +++ /work/SRC/openSUSE:Factory/.python-pylama.new.5148/python-pylama.changes 2019-05-10 09:10:04.347081977 +0200 @@ -1,0 +2,8 @@ +Tue May 7 14:04:53 UTC 2019 - [email protected] + +- version update to 7.7.1 + * no upstream changelog +- modified sources + % dummy.py + +------------------------------------------------------------------- Old: ---- pylama-7.6.6.tar.gz New: ---- pylama-7.7.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-pylama.spec ++++++ --- /var/tmp/diff_new_pack.GrXp5w/_old 2019-05-10 09:10:05.011083872 +0200 +++ /var/tmp/diff_new_pack.GrXp5w/_new 2019-05-10 09:10:05.011083872 +0200 @@ -18,13 +18,14 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-pylama -Version: 7.6.6 +Version: 7.7.1 Release: 0 Summary: Code audit tool for python License: LGPL-3.0-only Group: Development/Languages/Python URL: https://github.com/klen/pylama Source: https://files.pythonhosted.org/packages/source/p/pylama/pylama-%{version}.tar.gz +# https://github.com/klen/pylama/issues/147 Source1: https://raw.githubusercontent.com/klen/pylama/develop/dummy.py BuildRequires: %{python_module eradicate >= 0.2} BuildRequires: %{python_module mccabe >= 0.5.2} @@ -37,6 +38,7 @@ BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildRequires: git-core +BuildRequires: mypy BuildRequires: python-rpm-macros Requires: python-setuptools Requires(post): update-alternatives ++++++ dummy.py ++++++ --- /var/tmp/diff_new_pack.GrXp5w/_old 2019-05-10 09:10:05.027083918 +0200 +++ /var/tmp/diff_new_pack.GrXp5w/_new 2019-05-10 09:10:05.027083918 +0200 @@ -125,3 +125,13 @@ Message.__init__(self, filename, lineno) self.message_args = (names,) error = 1 # noQa and some comments + + +class BadTyping(Message): + """Test the MyPy linting.""" + + message = 'error: No return value expected' + + def bad_method(self): # type: () -> None + """Return type mismatch.""" + return 1 ++++++ pylama-7.6.6.tar.gz -> pylama-7.7.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylama-7.6.6/AUTHORS new/pylama-7.7.1/AUTHORS --- old/pylama-7.6.6/AUTHORS 2018-11-02 11:58:42.000000000 +0100 +++ new/pylama-7.7.1/AUTHORS 2019-04-10 20:11:55.000000000 +0200 @@ -13,6 +13,7 @@ * Gram (https://github.com/orsinium) * GrandVizierOlaf (https://github.com/grandvizierolaf) * Grzegorz Śliwiński (https://github.com/fizyk) +* Ian Epperson (https://github.com/ianepperson) * Jarek Śmiejczak (https://github.com/jotes) * Jens Persson (https://github.com/MrShark) * Johan Bloemberg (https://github.com/aequitas) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylama-7.6.6/PKG-INFO new/pylama-7.7.1/PKG-INFO --- old/pylama-7.6.6/PKG-INFO 2018-11-02 11:59:14.000000000 +0100 +++ new/pylama-7.7.1/PKG-INFO 2019-04-10 20:20:37.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: pylama -Version: 7.6.6 +Version: 7.7.1 Summary: pylama -- Code audit tool for python Home-page: https://github.com/klen/pylama @@ -22,6 +22,7 @@ * Radon_ © Michele Lacchia * gjslint_ © The Closure Linter Authors (should be installed 'pylama_gjslint' module); * eradicate_ © Steven Myint; + * Mypy_ © Jukka Lehtosalo and contributors; .. _badges: @@ -243,7 +244,9 @@ max_line_length = 100 disable = R - See code-checkers' documentation for more info. + See code-checkers' documentation for more info. Let's notice that dashes are + replaced by underscores (e.g. Pylint's "max-line-length" becomes + "max_line_length"). Set options for file (group of files) @@ -409,6 +412,7 @@ .. _gjslint: https://developers.google.com/closure/utilities .. _klen: http://klen.github.io/ .. _eradicate: https://github.com/myint/eradicate + .. _Mypy: https://github.com/python/mypy .. |logo| image:: https://raw.github.com/klen/pylama/develop/docs/_static/logo.png :width: 100 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylama-7.6.6/README.rst new/pylama-7.7.1/README.rst --- old/pylama-7.6.6/README.rst 2018-11-02 11:58:42.000000000 +0100 +++ new/pylama-7.7.1/README.rst 2019-04-10 20:11:55.000000000 +0200 @@ -13,6 +13,7 @@ * Radon_ © Michele Lacchia * gjslint_ © The Closure Linter Authors (should be installed 'pylama_gjslint' module); * eradicate_ © Steven Myint; +* Mypy_ © Jukka Lehtosalo and contributors; .. _badges: @@ -234,7 +235,9 @@ max_line_length = 100 disable = R -See code-checkers' documentation for more info. +See code-checkers' documentation for more info. Let's notice that dashes are +replaced by underscores (e.g. Pylint's "max-line-length" becomes +"max_line_length"). Set options for file (group of files) @@ -400,6 +403,7 @@ .. _gjslint: https://developers.google.com/closure/utilities .. _klen: http://klen.github.io/ .. _eradicate: https://github.com/myint/eradicate +.. _Mypy: https://github.com/python/mypy .. |logo| image:: https://raw.github.com/klen/pylama/develop/docs/_static/logo.png :width: 100 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylama-7.6.6/pylama/__init__.py new/pylama-7.7.1/pylama/__init__.py --- old/pylama-7.6.6/pylama/__init__.py 2018-11-02 11:58:42.000000000 +0100 +++ new/pylama-7.7.1/pylama/__init__.py 2019-04-10 20:20:19.000000000 +0200 @@ -4,7 +4,7 @@ :license: BSD, see LICENSE for more details. """ -__version__ = "7.6.6" +__version__ = "7.7.1" __project__ = "pylama" __author__ = "Kirill Klenov <[email protected]>" __license__ = "GNU LGPL" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylama-7.6.6/pylama/config.py new/pylama-7.7.1/pylama/config.py --- old/pylama-7.6.6/pylama/config.py 2018-10-09 19:30:11.000000000 +0200 +++ new/pylama-7.7.1/pylama/config.py 2019-04-10 20:11:55.000000000 +0200 @@ -12,7 +12,7 @@ from .lint.extensions import LINTERS #: A default checkers -DEFAULT_LINTERS = 'pycodestyle', 'pyflakes', 'mccabe', 'eradicate' +DEFAULT_LINTERS = 'pycodestyle', 'pyflakes', 'mccabe' CURDIR = os.getcwd() CONFIG_FILES = 'pylama.ini', 'setup.cfg', 'tox.ini', 'pytest.ini' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylama-7.6.6/pylama/lint/extensions.py new/pylama-7.7.1/pylama/lint/extensions.py --- old/pylama-7.6.6/pylama/lint/extensions.py 2018-10-09 18:48:22.000000000 +0200 +++ new/pylama-7.7.1/pylama/lint/extensions.py 2019-04-10 20:11:55.000000000 +0200 @@ -46,6 +46,12 @@ except ImportError: pass +try: + from pylama.lint.pylama_mypy import Linter + LINTERS['mypy'] = Linter() +except ImportError: + pass + from pkg_resources import iter_entry_points diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylama-7.6.6/pylama/lint/pylama_eradicate.py new/pylama-7.7.1/pylama/lint/pylama_eradicate.py --- old/pylama-7.6.6/pylama/lint/pylama_eradicate.py 2018-10-02 17:43:19.000000000 +0200 +++ new/pylama-7.7.1/pylama/lint/pylama_eradicate.py 2019-04-10 20:11:55.000000000 +0200 @@ -29,7 +29,7 @@ lnum=line_number, offset=len(line) - len(line.rstrip()), # https://github.com/sobolevn/flake8-eradicate#output-example - text=converter('E800: Found commented out code: ') + line, + text=converter('E800 Found commented out code: ') + line, # https://github.com/sobolevn/flake8-eradicate#error-codes type='E800', )) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylama-7.6.6/pylama/lint/pylama_mypy.py new/pylama-7.7.1/pylama/lint/pylama_mypy.py --- old/pylama-7.6.6/pylama/lint/pylama_mypy.py 1970-01-01 01:00:00.000000000 +0100 +++ new/pylama-7.7.1/pylama/lint/pylama_mypy.py 2019-04-10 20:11:55.000000000 +0200 @@ -0,0 +1,88 @@ +"""MyPy support.""" + +from mypy import api + +from pylama.lint import Linter as Abstract + + +class _MyPyMessage(object): + """Parser for a single MyPy output line.""" + types = { + 'error': 'E', + 'warning': 'W', + 'note': 'N' + } + + def __init__(self, line): + self.filename = None + self.line_num = None + self.column = None + self.text = None + self.note = None + self.message_type = None + self.valid = False + + self._parse(line) + + def _parse(self, line): + """Parse the output line""" + try: + result = line.split(':', maxsplit=4) + filename, line_num_txt, column_txt, message_type, text = result + except ValueError: + return + + try: + self.line_num = int(line_num_txt.strip()) + self.column = int(column_txt.strip()) + except ValueError: + return + + self.filename = filename + self.message_type = message_type.strip() + self.text = text.strip() + self.valid = True + + def add_note(self, note): + """Add in additional information about this message""" + self.note = note + + def to_result(self): + """Convert to the Linter.run return value""" + text = [self.text] + if self.note: + text.append(self.note) + + return { + 'lnum': self.line_num, + 'col': self.column, + 'text': ' - '.join(text), + 'type': self.types.get(self.message_type, '') + } + + +class Linter(Abstract): + """MyPy runner.""" + + @staticmethod + def run(path, code=None, params=None, **meta): + """Check code with mypy. + + :return list: List of errors. + """ + args = [path, '--follow-imports=skip', '--show-column-numbers'] + stdout, stderr, status = api.run(args) + messages = [] + for line in stdout.split('\n'): + line.strip() + if not line: + continue + message = _MyPyMessage(line) + if message.valid: + if message.message_type == 'note': + if messages[-1].line_num == message.line_num: + messages[-1].add_note(message.text) + else: + messages.append(message) + + return [m.to_result() for m in messages] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylama-7.6.6/pylama.egg-info/PKG-INFO new/pylama-7.7.1/pylama.egg-info/PKG-INFO --- old/pylama-7.6.6/pylama.egg-info/PKG-INFO 2018-11-02 11:59:14.000000000 +0100 +++ new/pylama-7.7.1/pylama.egg-info/PKG-INFO 2019-04-10 20:20:37.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: pylama -Version: 7.6.6 +Version: 7.7.1 Summary: pylama -- Code audit tool for python Home-page: https://github.com/klen/pylama @@ -22,6 +22,7 @@ * Radon_ © Michele Lacchia * gjslint_ © The Closure Linter Authors (should be installed 'pylama_gjslint' module); * eradicate_ © Steven Myint; + * Mypy_ © Jukka Lehtosalo and contributors; .. _badges: @@ -243,7 +244,9 @@ max_line_length = 100 disable = R - See code-checkers' documentation for more info. + See code-checkers' documentation for more info. Let's notice that dashes are + replaced by underscores (e.g. Pylint's "max-line-length" becomes + "max_line_length"). Set options for file (group of files) @@ -409,6 +412,7 @@ .. _gjslint: https://developers.google.com/closure/utilities .. _klen: http://klen.github.io/ .. _eradicate: https://github.com/myint/eradicate + .. _Mypy: https://github.com/python/mypy .. |logo| image:: https://raw.github.com/klen/pylama/develop/docs/_static/logo.png :width: 100 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylama-7.6.6/pylama.egg-info/SOURCES.txt new/pylama-7.7.1/pylama.egg-info/SOURCES.txt --- old/pylama-7.6.6/pylama.egg-info/SOURCES.txt 2018-11-02 11:59:14.000000000 +0100 +++ new/pylama-7.7.1/pylama.egg-info/SOURCES.txt 2019-04-10 20:20:37.000000000 +0200 @@ -29,6 +29,7 @@ pylama/lint/extensions.py pylama/lint/pylama_eradicate.py pylama/lint/pylama_mccabe.py +pylama/lint/pylama_mypy.py pylama/lint/pylama_pycodestyle.py pylama/lint/pylama_pydocstyle.py pylama/lint/pylama_pyflakes.py diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylama-7.6.6/pylama.egg-info/requires.txt new/pylama-7.7.1/pylama.egg-info/requires.txt --- old/pylama-7.6.6/pylama.egg-info/requires.txt 2018-11-02 11:59:14.000000000 +0100 +++ new/pylama-7.7.1/pylama.egg-info/requires.txt 2019-04-10 20:20:37.000000000 +0200 @@ -1,4 +1,4 @@ -mccabe >= 0.5.2 -pycodestyle >= 2.3.1 -pydocstyle >= 2.0.0 -pyflakes >= 1.5.0 +mccabe>=0.5.2 +pycodestyle>=2.3.1 +pydocstyle>=2.0.0 +pyflakes>=1.5.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylama-7.6.6/setup.cfg new/pylama-7.7.1/setup.cfg --- old/pylama-7.6.6/setup.cfg 2018-11-02 11:59:14.000000000 +0100 +++ new/pylama-7.7.1/setup.cfg 2019-04-10 20:20:37.000000000 +0200 @@ -34,5 +34,4 @@ [egg_info] tag_build = tag_date = 0 -tag_svn_revision = 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylama-7.6.6/tests/test_config.py new/pylama-7.7.1/tests/test_config.py --- old/pylama-7.6.6/tests/test_config.py 2018-11-02 11:58:42.000000000 +0100 +++ new/pylama-7.7.1/tests/test_config.py 2019-04-10 20:11:55.000000000 +0200 @@ -19,7 +19,7 @@ options = parse_options('-o dummy dummy.py'.split()) linters, _ = zip(*options.linters) - assert set(linters) == set(['pycodestyle', 'mccabe', 'pyflakes', 'eradicate']) + assert set(linters) == set(['pycodestyle', 'mccabe', 'pyflakes']) assert options.skip == [] @@ -28,14 +28,14 @@ options.ignore = ['E301', 'D102'] options.linters = ['pycodestyle', 'pydocstyle', 'pyflakes', 'mccabe'] errors = run('dummy.py', options=options) - assert len(errors) == 31 + assert len(errors) == 32 numbers = [error.number for error in errors] assert 'D100' in numbers assert 'E301' not in numbers assert 'D102' not in numbers - options.ignore = ['E3', 'D', 'E2'] + options.ignore = ['E3', 'D', 'E2', 'E8'] errors = run('dummy.py', options=options) assert not errors diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pylama-7.6.6/tests/test_linters.py new/pylama-7.7.1/tests/test_linters.py --- old/pylama-7.6.6/tests/test_linters.py 2018-11-02 11:58:42.000000000 +0100 +++ new/pylama-7.7.1/tests/test_linters.py 2019-04-10 20:11:55.000000000 +0200 @@ -1,3 +1,5 @@ +import sys + from pylama.config import parse_options from pylama.core import run from pylama.lint.extensions import LINTERS @@ -52,3 +54,11 @@ assert len(options.linters) == 1 errors = run('dummy.py', options=options) assert errors + + +def test_mypy(): + if sys.version_info.major >= 3 and sys.version_info.minor >= 5: + options = parse_options(linters=['mypy']) + assert len(options.linters) == 1 + errors = run('dummy.py', options=options) + assert len(errors) == 1
