Hello community, here is the log from the commit of package i18nspector for openSUSE:Factory checked in at 2020-08-19 18:58:04 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/i18nspector (Old) and /work/SRC/openSUSE:Factory/.i18nspector.new.3399 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "i18nspector" Wed Aug 19 18:58:04 2020 rev:30 rq:827801 version:0.25.9 Changes: -------- --- /work/SRC/openSUSE:Factory/i18nspector/i18nspector.changes 2019-04-09 20:18:56.181862915 +0200 +++ /work/SRC/openSUSE:Factory/.i18nspector.new.3399/i18nspector.changes 2020-08-19 18:59:10.219922002 +0200 @@ -1,0 +2,9 @@ +Sat Aug 15 17:19:48 UTC 2020 - Kyrill Detinov <lazy.k...@opensuse.org> + +- Update to 0.25.9. + * Drop support for Python < 3.4. + * Fix compatibility with Python 3.9. + * Fix spelling and grammar in tag descriptions. + * Improve the test suite. + +------------------------------------------------------------------- Old: ---- i18nspector-0.25.8.tar.gz i18nspector-0.25.8.tar.gz.asc New: ---- i18nspector-0.25.9.tar.gz i18nspector-0.25.9.tar.gz.asc ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ i18nspector.spec ++++++ --- /var/tmp/diff_new_pack.BDYbMB/_old 2020-08-19 18:59:10.955922393 +0200 +++ /var/tmp/diff_new_pack.BDYbMB/_new 2020-08-19 18:59:10.959922395 +0200 @@ -1,7 +1,7 @@ # # spec file for package i18nspector # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,16 +17,16 @@ Name: i18nspector -Version: 0.25.8 +Version: 0.25.9 Release: 0 Summary: Tool for Checking gettext POT/PO/MO Files License: MIT Group: Development/Tools/Other -URL: http://jwilk.net/software/i18nspector +URL: https://jwilk.net/software/i18nspector Source0: https://github.com/jwilk/i18nspector/releases/download/%{version}/%{name}-%{version}.tar.gz Source1: https://github.com/jwilk/i18nspector/releases/download/%{version}/%{name}-%{version}.tar.gz.asc Source2: %{name}.keyring -BuildRequires: python3-devel >= 3.3.3 +BuildRequires: python3-devel >= 3.4 # Requires for tests. BuildRequires: python3-curses BuildRequires: python3-nose @@ -37,7 +37,7 @@ Requires: python3-rply BuildArch: noarch %if 0%{?suse_version} && 0%{?suse_version} < 1230 -Requires: python3 >= 3.3.3 +Requires: python3 >= 3.4 %endif %description @@ -62,7 +62,7 @@ %py3_compile . %check -make %{?_smp_mflags} test +%make_build test %files %license doc/LICENSE ++++++ i18nspector-0.25.8.tar.gz -> i18nspector-0.25.9.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/i18nspector-0.25.8/.pylintrc new/i18nspector-0.25.9/.pylintrc --- old/i18nspector-0.25.8/.pylintrc 2019-02-21 22:23:30.000000000 +0100 +++ new/i18nspector-0.25.9/.pylintrc 2020-08-06 10:23:02.000000000 +0200 @@ -5,6 +5,7 @@ disable = bad-builtin, bad-continuation, + bad-option-value, duplicate-code, fixme, inconsistent-return-statements, @@ -12,6 +13,9 @@ len-as-condition, locally-disabled, locally-enabled, + no-else-break, + no-else-continue, + no-else-raise, no-else-return, no-self-use, redefined-variable-type, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/i18nspector-0.25.8/Makefile new/i18nspector-0.25.9/Makefile --- old/i18nspector-0.25.8/Makefile 2019-02-21 22:23:30.000000000 +0100 +++ new/i18nspector-0.25.9/Makefile 2020-08-06 10:23:02.000000000 +0200 @@ -33,7 +33,7 @@ .PHONY: install install: i18nspector - # binary: + # executable: $(INSTALL) -d -m755 $(DESTDIR)$(bindir) python_exe=$$($(PYTHON) -c 'import sys; print(sys.executable)') && \ sed \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/i18nspector-0.25.8/data/tags new/i18nspector-0.25.9/data/tags --- old/i18nspector-0.25.8/data/tags 2019-02-21 22:23:30.000000000 +0100 +++ new/i18nspector-0.25.9/data/tags 2020-08-06 10:23:02.000000000 +0200 @@ -783,7 +783,7 @@ or ``msgstr`` consumes more arguments than ``msgid``; or ``msgstr[``\ *N*\ ``]`` consumes more arguments than ``msgid`` or ``msgid_plural``. . - Python, unlike C, requires that all unnamed arguments are consumed during conversion. + Python, unlike C, requires that all unnamed arguments must be consumed during conversion. references = https://docs.python.org/2/library/stdtypes.html#string-formatting-operations https://www.gnu.org/software/gettext/manual/html_node/Python.html#Python @@ -914,7 +914,7 @@ in the context of plural forms. The translator might want not to use the numeric argument in the singular form; but this is not possible if the argument is unnamed, - because python, unlike C, requires that all unnamed arguments are consumed during conversion. + because Python, unlike C, requires that all unnamed arguments must be consumed during conversion. Named arguments (such as ``%(n)d``) should be used instead. references = https://docs.python.org/2/library/stdtypes.html#string-formatting-operations diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/i18nspector-0.25.8/doc/LICENSE new/i18nspector-0.25.9/doc/LICENSE --- old/i18nspector-0.25.8/doc/LICENSE 2019-02-21 22:23:30.000000000 +0100 +++ new/i18nspector-0.25.9/doc/LICENSE 2020-08-06 10:23:02.000000000 +0200 @@ -1,4 +1,4 @@ -Copyright © 2012-2019 Jakub Wilk <jw...@jwilk.net> +Copyright © 2012-2020 Jakub Wilk <jw...@jwilk.net> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/i18nspector-0.25.8/doc/README new/i18nspector-0.25.9/doc/README --- old/i18nspector-0.25.8/doc/README 2019-02-21 22:23:30.000000000 +0100 +++ new/i18nspector-0.25.9/doc/README 2020-08-06 10:23:02.000000000 +0200 @@ -11,7 +11,7 @@ The following software is needed to run i18nspector: -* Python ≥ 3.3.3; +* Python ≥ 3.4; * polib_ ≥ 1.0.0, a gettext catalogs manipulation library; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/i18nspector-0.25.8/doc/changelog new/i18nspector-0.25.9/doc/changelog --- old/i18nspector-0.25.8/doc/changelog 2019-02-21 22:23:30.000000000 +0100 +++ new/i18nspector-0.25.9/doc/changelog 2020-08-06 10:23:02.000000000 +0200 @@ -1,6 +1,17 @@ +i18nspector (0.25.9) unstable; urgency=low + + * Drop support for Python < 3.4. + * Fix compatibility with Python 3.9. + https://bugs.python.org/issue39337 + * Fix spelling and grammar in tag descriptions. + * Improve the test suite. + + -- Jakub Wilk <jw...@jwilk.net> Thu, 06 Aug 2020 10:22:52 +0200 + i18nspector (0.25.8) unstable; urgency=low * Fix compatibility with Python 3.8. + https://bugs.python.org/issue32892 * Add writing system information for Maltese. * Rephrase help messages for --help, --version. * Improve error handling. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/i18nspector-0.25.8/doc/i18nspector.1 new/i18nspector-0.25.9/doc/i18nspector.1 --- old/i18nspector-0.25.8/doc/i18nspector.1 2019-02-21 22:23:42.000000000 +0100 +++ new/i18nspector-0.25.9/doc/i18nspector.1 2020-08-06 10:23:04.000000000 +0200 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH I18NSPECTOR 1 "2019-02-21" "i18nspector 0.25.8" "" +.TH I18NSPECTOR 1 "2020-08-06" "i18nspector 0.25.9" "" .SH NAME i18nspector \- checking tool for gettext POT, PO and MO files . @@ -1682,7 +1682,7 @@ or \fBmsgstr\fP consumes more arguments than \fBmsgid\fP; or \fBmsgstr[\fP\fIN\fP\fB]\fP consumes more arguments than \fBmsgid\fP or \fBmsgid_plural\fP\&. .sp -Python, unlike C, requires that all unnamed arguments are consumed during conversion. +Python, unlike C, requires that all unnamed arguments must be consumed during conversion. .sp References: .INDENT 0.0 @@ -1955,7 +1955,7 @@ in the context of plural forms. The translator might want not to use the numeric argument in the singular form; but this is not possible if the argument is unnamed, -because python, unlike C, requires that all unnamed arguments are consumed during conversion. +because Python, unlike C, requires that all unnamed arguments must be consumed during conversion. Named arguments (such as \fB%(n)d\fP) should be used instead. .sp References: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/i18nspector-0.25.8/doc/manpage.rst new/i18nspector-0.25.9/doc/manpage.rst --- old/i18nspector-0.25.8/doc/manpage.rst 2019-02-21 22:23:30.000000000 +0100 +++ new/i18nspector-0.25.9/doc/manpage.rst 2020-08-06 10:23:02.000000000 +0200 @@ -7,7 +7,7 @@ ---------------------------------------------- :manual section: 1 -:version: i18nspector 0.25.8 +:version: i18nspector 0.25.9 :date: |date| Synopsis diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/i18nspector-0.25.8/doc/tags.rst new/i18nspector-0.25.9/doc/tags.rst --- old/i18nspector-0.25.8/doc/tags.rst 2019-02-21 22:23:41.000000000 +0100 +++ new/i18nspector-0.25.9/doc/tags.rst 2020-08-06 10:23:04.000000000 +0200 @@ -1062,7 +1062,7 @@ or ``msgstr`` consumes more arguments than ``msgid``; or ``msgstr[``\ *N*\ ``]`` consumes more arguments than ``msgid`` or ``msgid_plural``. -Python, unlike C, requires that all unnamed arguments are consumed during conversion. +Python, unlike C, requires that all unnamed arguments must be consumed during conversion. References: @@ -1233,7 +1233,7 @@ in the context of plural forms. The translator might want not to use the numeric argument in the singular form; but this is not possible if the argument is unnamed, -because python, unlike C, requires that all unnamed arguments are consumed during conversion. +because Python, unlike C, requires that all unnamed arguments must be consumed during conversion. Named arguments (such as ``%(n)d``) should be used instead. References: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/i18nspector-0.25.8/doc/todo new/i18nspector-0.25.9/doc/todo --- old/i18nspector-0.25.8/doc/todo 2019-02-21 22:23:30.000000000 +0100 +++ new/i18nspector-0.25.9/doc/todo 2020-08-06 10:23:02.000000000 +0200 @@ -13,6 +13,8 @@ * ``cn`` → ``zh`` * ``cz`` → ``cs`` * ``dk`` → ``da`` + * ``en_AM`` → ``en_US`` + * ``en_BR`` → ``en_GB`` * ``en_UK`` → ``en_GB`` * ``gr`` → ``el`` * ``in`` → ``id`` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/i18nspector-0.25.8/i18nspector new/i18nspector-0.25.9/i18nspector --- old/i18nspector-0.25.8/i18nspector 2019-02-21 22:23:30.000000000 +0100 +++ new/i18nspector-0.25.9/i18nspector 2020-08-06 10:23:02.000000000 +0200 @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # encoding=UTF-8 -# Copyright © 2012-2018 Jakub Wilk <jw...@jwilk.net> +# Copyright © 2012-2019 Jakub Wilk <jw...@jwilk.net> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the “Software”), to deal @@ -32,11 +32,11 @@ def error(message): try: - import argparse + import argparse # pylint: disable=import-outside-toplevel ap = argparse.ArgumentParser() prog = ap.prog except ImportError: - import optparse # pylint: disable=deprecated-module + import optparse # pylint: disable=deprecated-module,import-outside-toplevel ap = optparse.OptionParser() prog = ap.get_prog_name() message = ''.join((prog, ': error: ', message, '\n')) @@ -49,7 +49,7 @@ error(message) def require_polib(*version): - import polib + import polib # pylint: disable=import-outside-toplevel polib_version = tuple( int(x) for x in polib.__version__.split('.') ) @@ -58,7 +58,7 @@ message = 'polib >= {ver} is required'.format(ver=version_str) error(message) -require_python(3, 3, 3) +require_python(3, 4) require_polib(1, 0, 0) # ---------------------------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/i18nspector-0.25.8/lib/check/msgformat/c.py new/i18nspector-0.25.9/lib/check/msgformat/c.py --- old/i18nspector-0.25.8/lib/check/msgformat/c.py 2019-02-21 22:23:30.000000000 +0100 +++ new/i18nspector-0.25.9/lib/check/msgformat/c.py 2020-08-06 10:23:02.000000000 +0200 @@ -31,7 +31,7 @@ class Checker(CheckerBase): - backend = backend + backend = backend # pylint: disable=self-assigning-variable def check_msgids(self, message, msgid_fmts): if msgid_fmts.get(0) is not None: @@ -83,7 +83,7 @@ if len(exc.args) == 2: [s, *args] = exc.args else: - [s, a1, a2] = exc.args + [s, a1, a2] = exc.args # pylint: disable=unbalanced-tuple-unpacking if a1 == a2: args = ['duplicate', a1] else: @@ -94,7 +94,7 @@ *args ) except backend.NonPortableConversion as exc: - [s, c1, c2] = exc.args + [s, c1, c2] = exc.args # pylint: disable=unbalanced-tuple-unpacking args = [c1, '=>', c2] if s != c1: args += ['in', s] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/i18nspector-0.25.8/lib/check/msgformat/pybrace.py new/i18nspector-0.25.9/lib/check/msgformat/pybrace.py --- old/i18nspector-0.25.8/lib/check/msgformat/pybrace.py 2019-02-21 22:23:30.000000000 +0100 +++ new/i18nspector-0.25.9/lib/check/msgformat/pybrace.py 2020-08-06 10:23:02.000000000 +0200 @@ -31,7 +31,7 @@ class Checker(CheckerBase): - backend = backend + backend = backend # pylint: disable=self-assigning-variable def check_string(self, ctx, message, s): prefix = message_repr(message, template='{}:') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/i18nspector-0.25.8/lib/check/msgformat/python.py new/i18nspector-0.25.9/lib/check/msgformat/python.py --- old/i18nspector-0.25.8/lib/check/msgformat/python.py 2019-02-21 22:23:30.000000000 +0100 +++ new/i18nspector-0.25.9/lib/check/msgformat/python.py 2020-08-06 10:23:02.000000000 +0200 @@ -31,7 +31,7 @@ class Checker(CheckerBase): - backend = backend + backend = backend # pylint: disable=self-assigning-variable def check_string(self, ctx, message, s): prefix = message_repr(message, template='{}:') @@ -61,7 +61,7 @@ if len(exc.args) == 2: [s, *args] = exc.args else: - [s, a1, a2] = exc.args + [s, a1, a2] = exc.args # pylint: disable=unbalanced-tuple-unpacking if a1 == a2: args = ['duplicate', a1] else: @@ -72,19 +72,19 @@ *args ) except backend.RedundantPrecision as exc: - [s, a] = exc.args + [s, a] = exc.args # pylint: disable=unbalanced-tuple-unpacking self.tag('python-format-string-redundant-precision', prefix, a, 'in', s ) except backend.RedundantLength as exc: - [s, a] = exc.args + [s, a] = exc.args # pylint: disable=unbalanced-tuple-unpacking self.tag('python-format-string-redundant-length', prefix, a, 'in', s ) except backend.ObsoleteConversion as exc: - [s, c1, c2] = exc.args + [s, c1, c2] = exc.args # pylint: disable=unbalanced-tuple-unpacking args = [c1, '=>', c2] if s != c1: args += ['in', s] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/i18nspector-0.25.8/lib/cli.py new/i18nspector-0.25.9/lib/cli.py --- old/i18nspector-0.25.8/lib/cli.py 2019-02-21 22:23:30.000000000 +0100 +++ new/i18nspector-0.25.9/lib/cli.py 2020-08-06 10:23:02.000000000 +0200 @@ -1,4 +1,4 @@ -# Copyright © 2012-2019 Jakub Wilk <jw...@jwilk.net> +# Copyright © 2012-2020 Jakub Wilk <jw...@jwilk.net> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the “Software”), to deal @@ -39,7 +39,7 @@ from lib import tags from lib import terminal -__version__ = '0.25.8' +__version__ = '0.25.9' def initialize_terminal(): if sys.stdout.isatty(): @@ -172,8 +172,11 @@ # __version__ is available only since rply 0.7.5: # https://github.com/alex/rply/pull/58 pass + if sys.version_info >= (3, 8): + import importlib.metadata # pylint: disable=import-outside-toplevel,import-error,no-name-in-module + return importlib.metadata.version('rply') # pylint: disable=no-member try: - import pkg_resources + import pkg_resources # pylint: disable=import-outside-toplevel [dist, *rest] = pkg_resources.require('rply') del rest except ImportError: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/i18nspector-0.25.8/lib/encodings.py new/i18nspector-0.25.9/lib/encodings.py --- old/i18nspector-0.25.8/lib/encodings.py 2019-02-21 22:23:30.000000000 +0100 +++ new/i18nspector-0.25.9/lib/encodings.py 2020-08-06 10:23:02.000000000 +0200 @@ -1,4 +1,4 @@ -# Copyright © 2012-2016 Jakub Wilk <jw...@jwilk.net> +# Copyright © 2012-2020 Jakub Wilk <jw...@jwilk.net> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the “Software”), to deal @@ -30,6 +30,7 @@ import itertools import os import unicodedata +import sys from lib import iconv from lib import misc @@ -129,6 +130,16 @@ return (e2c, c2e, extra_encodings) [_portable_encodings, _pycodec_to_encoding, _extra_encodings] = _read_encodings() +_unmangle_encoding = {} +if sys.version_info >= (3, 9): + # Python >= 3.9 replaces hyphens with underscores: + # https://bugs.python.org/issue39337 + # We need to undo this damage. + for _key in set(_portable_encodings) | set(_extra_encodings): + assert _key not in _unmangle_encoding + _unmangle_encoding[_key.replace('-', '_')] = _key + _key = None + del _key def _read_control_characters(): path = os.path.join(paths.datadir, 'control-characters') @@ -195,6 +206,7 @@ raise EncodingLookupError(encoding) def _codec_search_function(encoding): + encoding = _unmangle_encoding.get(encoding, encoding) if _portable_encodings.get(encoding, False) is None: # portable according to gettext documentation # but not supported directly by Python diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/i18nspector-0.25.8/lib/moparser.py new/i18nspector-0.25.9/lib/moparser.py --- old/i18nspector-0.25.8/lib/moparser.py 2019-02-21 22:23:30.000000000 +0100 +++ new/i18nspector-0.25.9/lib/moparser.py 2020-08-06 10:23:02.000000000 +0200 @@ -180,7 +180,7 @@ __all__ = ['Parser', 'SyntaxError'] def main(): - import argparse + import argparse # pylint: disable=import-outside-toplevel ap = argparse.ArgumentParser(description='msgunfmt(1) replacement') ap.add_argument('files', metavar='<file>', nargs='+') options = ap.parse_args() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/i18nspector-0.25.8/lib/polib4us.py new/i18nspector-0.25.9/lib/polib4us.py --- old/i18nspector-0.25.8/lib/polib4us.py 2019-02-21 22:23:30.000000000 +0100 +++ new/i18nspector-0.25.9/lib/polib4us.py 2020-08-06 10:23:02.000000000 +0200 @@ -1,4 +1,4 @@ -# Copyright © 2012-2016 Jakub Wilk <jw...@jwilk.net> +# Copyright © 2012-2019 Jakub Wilk <jw...@jwilk.net> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the “Software”), to deal @@ -177,7 +177,7 @@ # polib.POEntry.flags # =================== # Fix flag splitting. -# polib (<< 1.0.4) incorrectly requires that the flag-splitting comma is +# polib (<< 1.0.4) incorrectly requires that the flag-splitting comma must be # followed by a space. # https://bitbucket.org/izi/polib/issues/46 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/i18nspector-0.25.8/lib/tags.py new/i18nspector-0.25.9/lib/tags.py --- old/i18nspector-0.25.8/lib/tags.py 2019-02-21 22:23:30.000000000 +0100 +++ new/i18nspector-0.25.9/lib/tags.py 2020-08-06 10:23:02.000000000 +0200 @@ -1,4 +1,4 @@ -# Copyright © 2012-2018 Jakub Wilk <jw...@jwilk.net> +# Copyright © 2012-2020 Jakub Wilk <jw...@jwilk.net> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the “Software”), to deal @@ -23,6 +23,7 @@ ''' import configparser +import enum import functools import os import re @@ -32,65 +33,35 @@ from lib import terminal @functools.total_ordering -class OrderedObject(): - - _parent = None - - def __init__(self, name, value): - assert self._parent is not None - self._name = name - self._value = value - - # pylint: disable=protected-access +class OrderedEnum(enum.Enum): def __lt__(self, other): - if not isinstance(other, OrderedObject): + if not type(self) is type(other): return NotImplemented - if self._parent is not other._parent: - return NotImplemented - return self._value < other._value + return self.value < other.value # pylint: disable=comparison-with-callable def __eq__(self, other): - if not isinstance(other, OrderedObject): - return NotImplemented - if self._parent is not other._parent: + if not type(self) is type(other): return NotImplemented - return self._value == other._value - - # pylint: enable=protected-access - - def __hash__(self): - return hash(self._value) - - def __str__(self): - return str(self._name) - -class OrderedGroup(): - - def __init__(self, name, *items): - self._child_type = ct = type(name, (OrderedObject,), dict(_parent=self)) - self._objects = dict( - (name, ct(name, value)) - for value, name in enumerate(items) - ) + return self.value == other.value # pylint: disable=comparison-with-callable - def __getitem__(self, name): - return self._objects[name] + def __hash__(self): # pylint: disable=invalid-hash-returned + return self.value -severities = OrderedGroup('Severity', +severities = OrderedEnum('Severity', [ 'pedantic', 'wishlist', 'minor', 'normal', 'important', - 'serious' -) + 'serious', +]) -certainties = OrderedGroup('Certainty', +certainties = OrderedEnum('Certainty', [ 'wild-guess', 'possible', 'certain', -) +]) class InvalidSeverity(misc.DataIntegrityError): pass @@ -195,12 +166,12 @@ c = self.certainty C = certainties return { - S['pedantic']: 'P', - S['wishlist']: 'I', - S['minor']: 'IW'[c >= C['certain']], - S['normal']: 'IW'[c >= C['possible']], - S['important']: 'WE'[c >= C['possible']], - S['serious']: 'E', + S.pedantic: 'P', + S.wishlist: 'I', + S.minor: 'IW'[c >= C.certain], + S.normal: 'IW'[c >= C.possible], + S.important: 'WE'[c >= C.possible], + S.serious: 'E', }[s] def format(self, target, *extra, color=False): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/i18nspector-0.25.8/lib/terminal.py new/i18nspector-0.25.9/lib/terminal.py --- old/i18nspector-0.25.8/lib/terminal.py 2019-02-21 22:23:30.000000000 +0100 +++ new/i18nspector-0.25.9/lib/terminal.py 2020-08-06 10:23:02.000000000 +0200 @@ -78,7 +78,7 @@ ''' global _curses # pylint: disable=global-statement try: - import curses as _curses # pylint: disable=redefined-outer-name + import curses as _curses # pylint: disable=redefined-outer-name,import-outside-toplevel except ImportError: return try: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/i18nspector-0.25.8/private/online-build-po-corpus new/i18nspector-0.25.9/private/online-build-po-corpus --- old/i18nspector-0.25.8/private/online-build-po-corpus 2019-02-21 22:23:30.000000000 +0100 +++ new/i18nspector-0.25.9/private/online-build-po-corpus 2020-08-06 10:23:02.000000000 +0200 @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -# Copyright © 2012-2018 Jakub Wilk <jw...@jwilk.net> +# Copyright © 2012-2019 Jakub Wilk <jw...@jwilk.net> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the “Software”), to deal @@ -141,7 +141,7 @@ try: path, packages = line.rsplit('\t', 1) except ValueError: - raise RuntimeError('malfomed line: {!r}'.format(line)) + raise RuntimeError('malformed line: {!r}'.format(line)) if is_po_path(path): packages = packages.rstrip('\n').split(',') for pkg in packages: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/i18nspector-0.25.8/private/run-pylint new/i18nspector-0.25.9/private/run-pylint --- old/i18nspector-0.25.8/private/run-pylint 2019-02-21 22:23:30.000000000 +0100 +++ new/i18nspector-0.25.9/private/run-pylint 2020-08-06 10:23:02.000000000 +0200 @@ -1,6 +1,6 @@ #!/bin/sh -# Copyright © 2015-2018 Jakub Wilk <jw...@jwilk.net> +# Copyright © 2015-2019 Jakub Wilk <jw...@jwilk.net> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the “Software”), to deal @@ -46,7 +46,7 @@ log=$(mktemp -t pylint.XXXXXX) "$PYTHON" -m pylint "$@" > "$log" || [ $? != 1 ] ! grep -P '^\S+:' "$log" \ -| grep -v -P '^(?!lib/).+: missing-docstring ' \ +| grep -v -P '^(?!lib/).+: missing-(\w+-)?docstring ' \ | grep -v ": redefined-builtin \\[.*\\] Redefining built-in 'input'" \ | grep -v -P "^tests/.+: wrong-import-order \\[.*\\] external import \"import lib[.].+\" comes before \"from . import tools\"" \ | LC_ALL=C sort -k2 \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/i18nspector-0.25.8/private/tags-as-rst new/i18nspector-0.25.9/private/tags-as-rst --- old/i18nspector-0.25.8/private/tags-as-rst 2019-02-21 22:23:30.000000000 +0100 +++ new/i18nspector-0.25.9/private/tags-as-rst 2020-08-06 10:23:02.000000000 +0200 @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -# Copyright © 2012-2016 Jakub Wilk <jw...@jwilk.net> +# Copyright © 2012-2020 Jakub Wilk <jw...@jwilk.net> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the “Software”), to deal @@ -48,7 +48,7 @@ print(' |', ref) print() print('Severity, certainty:', end='\n\n') - print(' {}, {}'.format(tag.severity, tag.certainty)) + print(' {}, {}'.format(tag.severity.name, tag.certainty.name)) print() def main(): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/i18nspector-0.25.8/tests/blackbox_tests/__init__.py new/i18nspector-0.25.9/tests/blackbox_tests/__init__.py --- old/i18nspector-0.25.8/tests/blackbox_tests/__init__.py 2019-02-21 22:23:30.000000000 +0100 +++ new/i18nspector-0.25.9/tests/blackbox_tests/__init__.py 2020-08-06 10:23:02.000000000 +0200 @@ -198,7 +198,7 @@ # We cheat here a bit, because exec(3)ing is very expensive. # Let's load the needed Python modules, and use multiprocessing to # “emulate” the command execution. - import lib.cli + import lib.cli # pylint: disable=import-outside-toplevel assert lib.cli # make pyflakes happy prog = os.path.join(here, os.pardir, os.pardir, 'i18nspector') commandline = [sys.executable, prog] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/i18nspector-0.25.8/tests/coverage new/i18nspector-0.25.9/tests/coverage --- old/i18nspector-0.25.8/tests/coverage 2019-02-21 22:23:30.000000000 +0100 +++ new/i18nspector-0.25.9/tests/coverage 2020-08-06 10:23:02.000000000 +0200 @@ -3,29 +3,29 @@ Name Stmts Miss Branch BrPart Cover Missing ----------------------------------------------------------------------------- lib/__init__.py 1 0 0 0 100% -lib/check/__init__.py 801 749 503 0 4% 82-86, 89-102, 116-201, 204-220, 224-356, 360-504, 508-580, 584-627, 632-667, 672-716, 719-797, 800-880, 883-997, 1000-1007, 1010-1026, 1031 -lib/check/msgformat/__init__.py 81 68 36 0 11% 31, 38, 41-151 +lib/check/__init__.py 809 749 515 0 5% 82-86, 89-102, 116-201, 204-220, 224-356, 360-504, 508-580, 584-627, 632-667, 672-716, 719-797, 800-880, 883-997, 1000-1007, 1010-1026, 1031 +lib/check/msgformat/__init__.py 83 68 36 0 13% 31, 38, 41-151 lib/check/msgformat/c.py 67 56 36 0 11% 37-44, 47-105, 108-129 lib/check/msgformat/pybrace.py 35 26 13 0 19% 37-48, 51-75 lib/check/msgformat/python.py 77 67 47 0 8% 37-109, 112-149 lib/check/msgrepr.py 11 7 2 0 31% 28-34 -lib/cli.py 157 122 44 0 17% 45-49, 58-67, 70-71, 74-76, 82-111, 114-119, 125-131, 134-142, 145-153, 159, 168-183, 186-192, 195-229 +lib/cli.py 161 125 46 0 17% 45-49, 58-67, 70-71, 74-76, 82-111, 114-119, 125-131, 134-142, 145-153, 159, 168-186, 189-195, 198-232 lib/domains.py 15 0 0 0 100% -lib/encodings.py 124 34 32 1 75% 49-65, 77-85, 184, 198-210, 214-218, 182->184 +lib/encodings.py 132 38 36 2 73% 50-66, 78-86, 134->138, 138-140, 191->193, 193, 207-220, 224-228 lib/gettext.py 105 0 36 0 100% -lib/iconv.py 158 49 52 18 63% 41-42, 55-57, 64, 66, 68, 70, 83-84, 97-98, 111-123, 130-131, 134-145, 151, 153, 155, 157, 166-167, 180-181, 203-204, 213, 222-223, 226-237, 63->64, 65->66, 67->68, 69->70, 82->83, 96->97, 105->110, 110->111, 129->130, 150->151, 152->153, 154->155, 156->157, 165->166, 179->180, 198->213, 200->203, 221->222 -lib/intexpr.py 409 0 126 0 100% -lib/ling.py 243 2 98 3 99% 181, 281, 159->162, 179->181, 277->283 -lib/misc.py 41 0 16 0 100% -lib/moparser.py 138 92 56 3 28% 68, 76, 91-109, 112-178, 183-192, 195, 56->58, 74->76, 194->195 +lib/iconv.py 156 49 58 19 64% 41-42, 55-57, 63->64, 64, 65->66, 66, 67->68, 68, 69->70, 70, 82->83, 83-84, 96->97, 97-98, 105->110, 110->111, 111-123, 129->130, 129->exit, 130-131, 134-145, 150->151, 151, 152->153, 153, 154->155, 155, 156->157, 157, 165->166, 166-167, 179->180, 180-181, 198->213, 200->203, 203-204, 213, 221->222, 222-223, 226-237 +lib/intexpr.py 420 0 126 0 100% +lib/ling.py 243 2 98 3 99% 159->162, 179->181, 181, 277->283, 281 +lib/misc.py 42 0 16 0 100% +lib/moparser.py 138 92 56 3 28% 56->58, 68, 74->76, 76, 91-109, 112-178, 183-192, 194->195, 195 lib/paths.py 7 2 0 0 71% 36-37 -lib/polib4us.py 110 75 26 0 26% 41-42, 56, 72, 75-96, 100, 110-112, 133-145, 149, 161, 170-175, 186-194, 205, 208, 212-216, 228-235, 243-252 +lib/polib4us.py 120 75 26 0 31% 41-42, 56, 72, 75-96, 100, 110-112, 133-145, 149, 161, 170-175, 186-194, 205, 208, 212-216, 228-235, 243-252 lib/strformat/__init__.py 0 0 0 0 100% lib/strformat/c.py 285 0 168 0 100% lib/strformat/pybrace.py 156 0 74 0 100% -lib/strformat/python.py 206 0 94 0 100% -lib/tags.py 131 37 40 6 70% 47-51, 55, 58, 66, 111, 113, 116, 135-136, 147-149, 154-156, 169, 180-187, 193-197, 207-220, 239, 245, 54->55, 56->58, 110->111, 112->113, 115->116, 168->169 -lib/terminal.py 46 17 6 1 58% 37-38, 64, 80-93, 63->64 +lib/strformat/python.py 204 0 94 0 100% +lib/tags.py 117 29 34 4 75% 81->82, 82, 83->84, 84, 86->87, 87, 106-107, 118-120, 125-127, 139->140, 140, 151-158, 164-168, 178-191, 210, 216 +lib/terminal.py 48 17 6 1 59% 37-38, 63->64, 64, 80-93 lib/xml.py 21 0 2 0 100% ----------------------------------------------------------------------------- -TOTAL 3425 1403 1507 32 55% +TOTAL 3453 1402 1525 32 55% diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/i18nspector-0.25.8/tests/test_gettext.py new/i18nspector-0.25.9/tests/test_gettext.py --- old/i18nspector-0.25.8/tests/test_gettext.py 2019-02-21 22:23:30.000000000 +0100 +++ new/i18nspector-0.25.9/tests/test_gettext.py 2020-08-06 10:23:02.000000000 +0200 @@ -1,4 +1,4 @@ -# Copyright © 2012-2016 Jakub Wilk <jw...@jwilk.net> +# Copyright © 2012-2020 Jakub Wilk <jw...@jwilk.net> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the “Software”), to deal @@ -625,7 +625,7 @@ (n0, expr0) = M.parse_plural_forms(s) del expr0 assert_equal(n0, n) - (n1, expr1, ljunk1, rjunk1) = M.parse_plural_forms(s, strict=False) + (n1, expr1, ljunk1, rjunk1) = M.parse_plural_forms(s, strict=False) # pylint: disable=unbalanced-tuple-unpacking del expr1 assert_equal(n1, n) assert_equal(ljunk1, ljunk) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/i18nspector-0.25.8/tests/test_iconv.py new/i18nspector-0.25.9/tests/test_iconv.py --- old/i18nspector-0.25.8/tests/test_iconv.py 2019-02-21 22:23:30.000000000 +0100 +++ new/i18nspector-0.25.9/tests/test_iconv.py 2020-08-06 10:23:02.000000000 +0200 @@ -49,7 +49,7 @@ e = 'TCVN-5712' def test_incomplete_char(): - b = u'Ę'.encode('UTF-8')[:1] + b = 'Ę'.encode('UTF-8')[:1] with assert_raises(UnicodeDecodeError): M.decode(b, 'UTF-8') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/i18nspector-0.25.8/tests/test_tags.py new/i18nspector-0.25.9/tests/test_tags.py --- old/i18nspector-0.25.8/tests/test_tags.py 2019-02-21 22:23:30.000000000 +0100 +++ new/i18nspector-0.25.9/tests/test_tags.py 2020-08-06 10:23:02.000000000 +0200 @@ -1,4 +1,4 @@ -# Copyright © 2012-2016 Jakub Wilk <jw...@jwilk.net> +# Copyright © 2012-2019 Jakub Wilk <jw...@jwilk.net> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the “Software”), to deal @@ -21,11 +21,15 @@ import ast import importlib import inspect +import operator import pkgutil from nose.tools import ( assert_equal, + assert_false, assert_is_instance, + assert_raises, + assert_true, ) import lib.check @@ -98,4 +102,45 @@ for tag in sorted(source_tagnames | tagnames): yield test, tag +class test_enums: + + def t(self, group, *keys): + keys = [group[k] for k in keys] + operators = ( + operator.lt, + operator.le, + operator.eq, + operator.ge, + operator.gt, + operator.ne, + ) + for op in operators: + for i, x in enumerate(keys): + for j, y in enumerate(keys): + assert_equal(op(x, y), op(i, j)) + if op is operator.eq: + assert_false(op(x, j)) + elif op is operator.ne: + assert_true(op(x, j)) + else: + with assert_raises(TypeError): + op(x, j) + + def test_severities(self): + self.t(M.severities, + 'pedantic', + 'wishlist', + 'minor', + 'normal', + 'important', + 'serious', + ) + + def test_certainties(self): + self.t(M.certainties, + 'wild-guess', + 'possible', + 'certain', + ) + # vim:ts=4 sts=4 sw=4 et diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/i18nspector-0.25.8/tests/tools.py new/i18nspector-0.25.9/tests/tools.py --- old/i18nspector-0.25.8/tests/tools.py 2019-02-21 22:23:30.000000000 +0100 +++ new/i18nspector-0.25.9/tests/tools.py 2020-08-06 10:23:02.000000000 +0200 @@ -55,6 +55,8 @@ # sys.exit() can't be used here, because nose catches all exceptions, # including SystemExit + # pylint:disable=consider-using-sys-exit + @functools.wraps(f) def wrapper(*args, **kwargs): readfd, writefd = os.pipe() @@ -94,6 +96,8 @@ else: raise RuntimeError('unexpected isolated process status {}'.format(status)) + # pylint:enable=consider-using-sys-exit + return wrapper basedir = os.path.join(