Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-translitcodec for openSUSE:Factory checked in at 2022-10-12 18:24:42 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-translitcodec (Old) and /work/SRC/openSUSE:Factory/.python-translitcodec.new.2275 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-translitcodec" Wed Oct 12 18:24:42 2022 rev:4 rq:1009906 version:0.7.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-translitcodec/python-translitcodec.changes 2021-05-03 22:08:03.972518099 +0200 +++ /work/SRC/openSUSE:Factory/.python-translitcodec.new.2275/python-translitcodec.changes 2022-10-12 18:26:21.881910841 +0200 @@ -1,0 +2,7 @@ +Tue Oct 11 16:08:46 UTC 2022 - Yogalakshmi Arunachalam <yarunacha...@suse.com> + +- update to version 0.7.0 + * Added support for error handles + * Fixed conversion of the German eszett char + +------------------------------------------------------------------- Old: ---- translitcodec-0.6.0.tar.gz New: ---- translitcodec-0.7.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-translitcodec.spec ++++++ --- /var/tmp/diff_new_pack.8Tb8XI/_old 2022-10-12 18:26:22.445912083 +0200 +++ /var/tmp/diff_new_pack.8Tb8XI/_new 2022-10-12 18:26:22.457912109 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-translitcodec # -# Copyright (c) 2021 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 @@ -19,7 +19,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} %define skip_python2 1 Name: python-translitcodec -Version: 0.6.0 +Version: 0.7.0 Release: 0 Summary: Unicode to 8-bit charset transliteration codec License: MIT ++++++ translitcodec-0.6.0.tar.gz -> translitcodec-0.7.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/translitcodec-0.6.0/AUTHORS new/translitcodec-0.7.0/AUTHORS --- old/translitcodec-0.6.0/AUTHORS 2015-05-11 12:15:57.000000000 +0200 +++ new/translitcodec-0.7.0/AUTHORS 2021-05-08 20:06:34.000000000 +0200 @@ -6,6 +6,7 @@ - Craig Dennis <cr...@idealist.org> - Piotr Skamruk <piotr.skam...@gmail.com> - Claude Paroz <cla...@2xlibre.net> +- Wojciech Bana?? <fizi...@gmail.com> The translitcodec source distribution includes the 'transtab' package by Markus Kuhn <mk...@acm.org>. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/translitcodec-0.6.0/CHANGES new/translitcodec-0.7.0/CHANGES --- old/translitcodec-0.6.0/CHANGES 2020-12-13 11:55:42.000000000 +0100 +++ new/translitcodec-0.7.0/CHANGES 2021-05-08 20:09:24.000000000 +0200 @@ -2,20 +2,27 @@ translitcodec Changes ===================== +0.7.0 +----- +Released on May 8, 2021 + +- Added support for error handles +- Fixed conversion of the German eszett char + 0.6.0 ---- +----- Released on December 13, 2020 - Add support for Python 3.9 0.5.2 ---- +----- Released on January 19, 2020 - Install package with setuptools 0.5.1 ---- +----- Released on January 19, 2020 - Add python_requires to prevent installation with Python 2 packages diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/translitcodec-0.6.0/PKG-INFO new/translitcodec-0.7.0/PKG-INFO --- old/translitcodec-0.6.0/PKG-INFO 2020-12-13 12:00:15.000000000 +0100 +++ new/translitcodec-0.7.0/PKG-INFO 2021-05-08 20:38:43.611086600 +0200 @@ -1,6 +1,6 @@ -Metadata-Version: 1.2 +Metadata-Version: 2.1 Name: translitcodec -Version: 0.6.0 +Version: 0.7.0 Summary: Unicode to 8-bit charset transliteration codec Home-page: https://github.com/claudep/translitcodec Author: Jason Kirtland @@ -45,23 +45,54 @@ The package also supplies a 'transliterate' codec, an alias for 'translit/long'. + + Another way to use the library is to use an error handle. + Error handles are available: + + * 'strict/translit/long', 'strict/translit/short', 'strict/translit/one' - similar to 'strict' + * 'ignore/translit/long', 'ignore/translit/short', 'ignore/translit/one' - similar to 'ignore' + * 'replace/translit/long', 'replace/translit/short', 'replace/translit/one' - similar to 'replace' + + These error handles above, work similarly to Python's built-in ones. + The difference is that transliteration is attempted first. + + >>> codecs.encode('Za???????? g????l?? ja???? ??? ??????!@#', 'ISO-8859-2', 'replace/translit/long').decode('ISO-8859-2') + 'Za???????? g????l?? ja???? EUR :-)?!@#' + >>> codecs.encode('Za???????? g????l?? ja???? ??? ??????!@#', 'ISO-8859-2', 'replace/translit/short').decode('ISO-8859-2') + 'Za???????? g????l?? ja???? E :-)?!@#' + >>> codecs.encode('Za???????? g????l?? ja???? ??? ??????!@#', 'ISO-8859-2', 'replace/translit/one').decode('ISO-8859-2') + 'Za???????? g????l?? ja???? E ??!@#' + >>> codecs.encode('Za???????? g????l?? ja???? ??? ??????!@#', 'ISO-8859-2', 'ignore/translit/long').decode('ISO-8859-2') + 'Za???????? g????l?? ja???? EUR :-)!@#' + >>> codecs.encode('Za???????? g????l?? ja???? ??? ??????!@#', 'ISO-8859-2', 'ignore/translit/short').decode('ISO-8859-2') + 'Za???????? g????l?? ja???? E :-)!@#' + >>> codecs.encode('Za???????? g????l?? ja???? ??? ??????!@#', 'ISO-8859-2', 'ignore/translit/one').decode('ISO-8859-2') + 'Za???????? g????l?? ja???? E !@#' + translitcodec Changes ===================== + 0.7.0 + ----- + Released on May 8, 2021 + + - Added support for error handles + - Fixed conversion of the German eszett char + 0.6.0 - --- + ----- Released on December 13, 2020 - Add support for Python 3.9 0.5.2 - --- + ----- Released on January 19, 2020 - Install package with setuptools 0.5.1 - --- + ----- Released on January 19, 2020 - Add python_requires to prevent installation with Python 2 packages @@ -120,3 +151,4 @@ Classifier: Topic :: Software Development :: Libraries Classifier: Topic :: Utilities Requires-Python: >=3 +Description-Content-Type: text/x-rst diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/translitcodec-0.6.0/README new/translitcodec-0.7.0/README --- old/translitcodec-0.6.0/README 2020-01-18 19:12:02.000000000 +0100 +++ new/translitcodec-0.7.0/README 2021-05-08 20:33:21.000000000 +0200 @@ -40,3 +40,26 @@ The package also supplies a 'transliterate' codec, an alias for 'translit/long'. + +Another way to use the library is to use an error handle. +Error handles are available: + + * 'strict/translit/long', 'strict/translit/short', 'strict/translit/one' - similar to 'strict' + * 'ignore/translit/long', 'ignore/translit/short', 'ignore/translit/one' - similar to 'ignore' + * 'replace/translit/long', 'replace/translit/short', 'replace/translit/one' - similar to 'replace' + +These error handles above, work similarly to Python's built-in ones. +The difference is that transliteration is attempted first. + + >>> codecs.encode('Za???????? g????l?? ja???? ??? ??????!@#', 'ISO-8859-2', 'replace/translit/long').decode('ISO-8859-2') + 'Za???????? g????l?? ja???? EUR :-)?!@#' + >>> codecs.encode('Za???????? g????l?? ja???? ??? ??????!@#', 'ISO-8859-2', 'replace/translit/short').decode('ISO-8859-2') + 'Za???????? g????l?? ja???? E :-)?!@#' + >>> codecs.encode('Za???????? g????l?? ja???? ??? ??????!@#', 'ISO-8859-2', 'replace/translit/one').decode('ISO-8859-2') + 'Za???????? g????l?? ja???? E ??!@#' + >>> codecs.encode('Za???????? g????l?? ja???? ??? ??????!@#', 'ISO-8859-2', 'ignore/translit/long').decode('ISO-8859-2') + 'Za???????? g????l?? ja???? EUR :-)!@#' + >>> codecs.encode('Za???????? g????l?? ja???? ??? ??????!@#', 'ISO-8859-2', 'ignore/translit/short').decode('ISO-8859-2') + 'Za???????? g????l?? ja???? E :-)!@#' + >>> codecs.encode('Za???????? g????l?? ja???? ??? ??????!@#', 'ISO-8859-2', 'ignore/translit/one').decode('ISO-8859-2') + 'Za???????? g????l?? ja???? E !@#' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/translitcodec-0.6.0/setup.py new/translitcodec-0.7.0/setup.py --- old/translitcodec-0.6.0/setup.py 2020-01-19 21:14:34.000000000 +0100 +++ new/translitcodec-0.7.0/setup.py 2021-05-08 20:37:25.000000000 +0200 @@ -3,6 +3,7 @@ lines = codecs.open('README', 'r', 'utf-8').readlines()[3:] +lines.append('\n') lines.extend(codecs.open('CHANGES', 'r', 'utf-8').readlines()[1:]) desc = ''.join(lines).lstrip() @@ -13,6 +14,7 @@ version=version, description='Unicode to 8-bit charset transliteration codec', long_description=desc, + long_description_content_type='text/x-rst', author='Jason Kirtland', author_email='j...@discorporate.us', url='https://github.com/claudep/translitcodec', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/translitcodec-0.6.0/tests/test_codec.py new/translitcodec-0.7.0/tests/test_codec.py --- old/translitcodec-0.6.0/tests/test_codec.py 2020-01-18 19:10:15.000000000 +0100 +++ new/translitcodec-0.7.0/tests/test_codec.py 2021-05-08 20:06:34.000000000 +0200 @@ -62,3 +62,41 @@ codecs.encode(alphabet_lower, 'transliterate'), 'aaabcddeeghiklmnooopqrstuuvxy' ) + + +class ErrorHandlersTests(TestCase): + data = 'Za???????? g????l?? ja???? ??? ??????!@#' + page = 'ISO-8859-2' + + def _process(self, error_handler_name): + return codecs.encode(self.data, self.page, error_handler_name).decode(self.page) + + def test_replace_long(self): + assert self._process('replace/translit/long') == 'Za???????? g????l?? ja???? EUR :-)?!@#' + + def test_replace_short(self): + assert self._process('replace/translit/short') == 'Za???????? g????l?? ja???? E :-)?!@#' + + def test_replace_one(self): + assert self._process('replace/translit/one') == 'Za???????? g????l?? ja???? E ??!@#' + + def test_ignore_long(self): + assert self._process('ignore/translit/long') == 'Za???????? g????l?? ja???? EUR :-)!@#' + + def test_ignore_short(self): + assert self._process('ignore/translit/short') == 'Za???????? g????l?? ja???? E :-)!@#' + + def test_ignore_one(self): + assert self._process('ignore/translit/one') == 'Za???????? g????l?? ja???? E !@#' + + def test_strict_long(self): + with self.assertRaises(UnicodeEncodeError): + self._process('strict/translit/long') + + def test_strict_short(self): + with self.assertRaises(UnicodeEncodeError): + self._process('strict/translit/short') + + def test_strict_one(self): + with self.assertRaises(UnicodeEncodeError): + self._process('strict/translit/one') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/translitcodec-0.6.0/translitcodec/__init__.py new/translitcodec-0.7.0/translitcodec/__init__.py --- old/translitcodec-0.6.0/translitcodec/__init__.py 2020-12-13 11:56:49.000000000 +0100 +++ new/translitcodec-0.7.0/translitcodec/__init__.py 2021-05-08 20:14:17.000000000 +0200 @@ -14,7 +14,7 @@ import unicodedata -__version_info__ = (0, 6, 0) +__version_info__ = (0, 7, 0) __version__ = '.'.join(str(_) for _ in __version_info__) @@ -60,6 +60,120 @@ return input.translate(single_table), length +def _error_handle_base(exc, table, unknown_char_cb): + if isinstance(exc, UnicodeEncodeError): + char = unicodedata.normalize('NFKC', exc.object[exc.start:exc.end])[0] + new_char = char.translate(table) + if char == new_char: + new_char = unknown_char_cb(char, new_char, exc) + return new_char, exc.start + 1 + else: + raise exc + + +def replace_long(exc): + """Error handler for transliterate to 8 bit using as many letters as needed. + + For example, \u00e4 LATIN SMALL LETTER A WITH DIAERESIS ``??`` will + be replaced with ``ae``. + + If the character is not replaced, then the '?' character is returned. + """ + return _error_handle_base(exc, long_table, lambda c, n, e: '?') + + +def replace_short(exc): + """Error handler for transliterate to 8 bit using as few letters as possible. + + For example, \u00e4 LATIN SMALL LETTER A WITH DIAERESIS ``??`` will + be replaced with ``a``. + + If the character is not replaced, then the '?' character is returned. + """ + return _error_handle_base(exc, short_table, lambda c, n, e: '?') + + +def replace_single(exc): + """Error handler for transliterate to 8 bit using only single letter replacements. + + For example, \u2639 WHITE FROWNING FACE ``???`` will be passed + through unchanged. + + If the character is not replaced, then the '?' character is returned. + """ + return _error_handle_base(exc, single_table, lambda c, n, e: '?') + + +def ignore_long(exc): + """Error handler for transliterate to 8 bit using as many letters as needed. + + For example, \u00e4 LATIN SMALL LETTER A WITH DIAERESIS ``??`` will + be replaced with ``ae``. + + If the character is not replaced, then it will be skipped. + """ + return _error_handle_base(exc, long_table, lambda c, n, e: '') + + +def ignore_short(exc): + """Error handler for transliterate to 8 bit using as few letters as possible. + + For example, \u00e4 LATIN SMALL LETTER A WITH DIAERESIS ``??`` will + be replaced with ``a``. + + If the character is not replaced, then it will be skipped. + """ + return _error_handle_base(exc, short_table, lambda c, n, e: '') + + +def ignore_single(exc): + """Error handler for transliterate to 8 bit using only single letter replacements. + + For example, \u2639 WHITE FROWNING FACE ``???`` will be passed + through unchanged. + + If the character is not replaced, then it will be skipped. + """ + return _error_handle_base(exc, single_table, lambda c, n, e: '') + + +def re_reaise(c, n, e): + raise e + + +def strict_long(exc): + """Error handler for transliterate to 8 bit using as many letters as needed. + + For example, \u00e4 LATIN SMALL LETTER A WITH DIAERESIS ``??`` will + be replaced with ``ae``. + + If the character is not replaced, then an exception is thrown. + """ + return _error_handle_base(exc, long_table, re_reaise) + + +def strict_short(exc): + """Error handler for transliterate to 8 bit using as few letters as possible. + + For example, \u00e4 LATIN SMALL LETTER A WITH DIAERESIS ``??`` will + be replaced with ``a``. + + If the character is not replaced, then an exception is thrown. + """ + return _error_handle_base(exc, short_table, re_reaise) + + +def strict_single(exc): + """Error handler for transliterate to 8 bit using only single letter replacements. + + For example, \u2639 WHITE FROWNING FACE ``???`` will be passed + through unchanged. + + If the character is not replaced, then an exception is thrown. + """ + return _error_handle_base(exc, single_table, re_reaise) + + def no_decode(input, errors='strict'): raise TypeError("transliterating codec does not support decode.") @@ -110,6 +224,18 @@ codecs.register(trans_search) +codecs.register_error('replace/translit/long', replace_long) +codecs.register_error('replace/translit/short', replace_short) +codecs.register_error('replace/translit/one', replace_single) + +codecs.register_error('ignore/translit/long', ignore_long) +codecs.register_error('ignore/translit/short', ignore_short) +codecs.register_error('ignore/translit/one', ignore_single) + +codecs.register_error('strict/translit/long', strict_long) +codecs.register_error('strict/translit/short', strict_short) +codecs.register_error('strict/translit/one', strict_single) + ### Code below is generated by update_table.py; do not edit. ### > @@ -1023,7 +1149,7 @@ 220: 'U', 221: 'Y', 222: 'Th', - 223: '??', + 223: 'ss', 224: 'a', 225: 'a', 226: 'a', @@ -1861,7 +1987,7 @@ 219: 'U', 220: 'U', 221: 'Y', - 223: '??', + 223: 's', 224: 'a', 225: 'a', 226: 'a', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/translitcodec-0.6.0/translitcodec.egg-info/PKG-INFO new/translitcodec-0.7.0/translitcodec.egg-info/PKG-INFO --- old/translitcodec-0.6.0/translitcodec.egg-info/PKG-INFO 2020-12-13 12:00:15.000000000 +0100 +++ new/translitcodec-0.7.0/translitcodec.egg-info/PKG-INFO 2021-05-08 20:38:43.000000000 +0200 @@ -1,6 +1,6 @@ -Metadata-Version: 1.2 +Metadata-Version: 2.1 Name: translitcodec -Version: 0.6.0 +Version: 0.7.0 Summary: Unicode to 8-bit charset transliteration codec Home-page: https://github.com/claudep/translitcodec Author: Jason Kirtland @@ -45,23 +45,54 @@ The package also supplies a 'transliterate' codec, an alias for 'translit/long'. + + Another way to use the library is to use an error handle. + Error handles are available: + + * 'strict/translit/long', 'strict/translit/short', 'strict/translit/one' - similar to 'strict' + * 'ignore/translit/long', 'ignore/translit/short', 'ignore/translit/one' - similar to 'ignore' + * 'replace/translit/long', 'replace/translit/short', 'replace/translit/one' - similar to 'replace' + + These error handles above, work similarly to Python's built-in ones. + The difference is that transliteration is attempted first. + + >>> codecs.encode('Za???????? g????l?? ja???? ??? ??????!@#', 'ISO-8859-2', 'replace/translit/long').decode('ISO-8859-2') + 'Za???????? g????l?? ja???? EUR :-)?!@#' + >>> codecs.encode('Za???????? g????l?? ja???? ??? ??????!@#', 'ISO-8859-2', 'replace/translit/short').decode('ISO-8859-2') + 'Za???????? g????l?? ja???? E :-)?!@#' + >>> codecs.encode('Za???????? g????l?? ja???? ??? ??????!@#', 'ISO-8859-2', 'replace/translit/one').decode('ISO-8859-2') + 'Za???????? g????l?? ja???? E ??!@#' + >>> codecs.encode('Za???????? g????l?? ja???? ??? ??????!@#', 'ISO-8859-2', 'ignore/translit/long').decode('ISO-8859-2') + 'Za???????? g????l?? ja???? EUR :-)!@#' + >>> codecs.encode('Za???????? g????l?? ja???? ??? ??????!@#', 'ISO-8859-2', 'ignore/translit/short').decode('ISO-8859-2') + 'Za???????? g????l?? ja???? E :-)!@#' + >>> codecs.encode('Za???????? g????l?? ja???? ??? ??????!@#', 'ISO-8859-2', 'ignore/translit/one').decode('ISO-8859-2') + 'Za???????? g????l?? ja???? E !@#' + translitcodec Changes ===================== + 0.7.0 + ----- + Released on May 8, 2021 + + - Added support for error handles + - Fixed conversion of the German eszett char + 0.6.0 - --- + ----- Released on December 13, 2020 - Add support for Python 3.9 0.5.2 - --- + ----- Released on January 19, 2020 - Install package with setuptools 0.5.1 - --- + ----- Released on January 19, 2020 - Add python_requires to prevent installation with Python 2 packages @@ -120,3 +151,4 @@ Classifier: Topic :: Software Development :: Libraries Classifier: Topic :: Utilities Requires-Python: >=3 +Description-Content-Type: text/x-rst