Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-hanzidentifier for 
openSUSE:Factory checked in at 2022-10-29 20:17:39
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-hanzidentifier (Old)
 and      /work/SRC/openSUSE:Factory/.python-hanzidentifier.new.2275 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-hanzidentifier"

Sat Oct 29 20:17:39 2022 rev:3 rq:1032188 version:1.1.0

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/python-hanzidentifier/python-hanzidentifier.changes  
    2021-06-01 10:41:26.573219724 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-hanzidentifier.new.2275/python-hanzidentifier.changes
    2022-10-29 20:18:45.070736350 +0200
@@ -1,0 +2,7 @@
+Fri Oct 28 17:32:02 UTC 2022 - Yogalakshmi Arunachalam <yarunacha...@suse.com>
+
+- Update to version v1.1.0 (2020-10-15)
+  * New function: count_chinese(). Thanks to ramwin.
+  * Drop Python 2 
+
+-------------------------------------------------------------------

Old:
----
  hanzidentifier-1.0.2.tar.gz

New:
----
  hanzidentifier-1.1.0.tar.gz

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

Other differences:
------------------
++++++ python-hanzidentifier.spec ++++++
--- /var/tmp/diff_new_pack.WPlhP7/_old  2022-10-29 20:18:45.490738587 +0200
+++ /var/tmp/diff_new_pack.WPlhP7/_new  2022-10-29 20:18:45.498738629 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package python-hanzidentifier
 #
-# 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
@@ -18,7 +18,7 @@
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-hanzidentifier
-Version:        1.0.2
+Version:        1.1.0
 Release:        0
 License:        MIT
 Summary:        Python module that identifies Chinese text as Simplified or 
Traditional

++++++ hanzidentifier-1.0.2.tar.gz -> hanzidentifier-1.1.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hanzidentifier-1.0.2/.gitignore 
new/hanzidentifier-1.1.0/.gitignore
--- old/hanzidentifier-1.0.2/.gitignore 1970-01-01 01:00:00.000000000 +0100
+++ new/hanzidentifier-1.1.0/.gitignore 2022-10-16 03:15:43.000000000 +0200
@@ -0,0 +1 @@
+__pycache__
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hanzidentifier-1.0.2/Makefile 
new/hanzidentifier-1.1.0/Makefile
--- old/hanzidentifier-1.0.2/Makefile   1970-01-01 01:00:00.000000000 +0100
+++ new/hanzidentifier-1.1.0/Makefile   2022-10-16 03:15:43.000000000 +0200
@@ -0,0 +1,35 @@
+PROJECT = hanzidentifier
+
+.PHONY: clean lint test test-all coverage dist release
+
+help:
+       @echo "clean - remove all build artifacts"
+       @echo "lint - check style with flake8"
+       @echo "test - run tests quickly with the current Python"
+       @echo "test-all - run tests in all environments"
+       @echo "coverage - check code coverage"
+       @echo "dist - make the source and binary distributions"
+       @echo "release - package and upload a release"
+
+clean:
+       rm -rf build dist egg *.egg-info .eggs htmlcov
+       find . -name '*.py[co]' -exec rm -f {} +
+
+lint:
+       flake8 $(PROJECT) tests setup.py
+
+test:
+       python3 setup.py test
+
+test-all:
+       tox
+
+coverage:
+       coverage run --source $(PROJECT) setup.py test
+       coverage report --fail-under=100
+
+dist: clean
+       python3 setup.py sdist bdist_wheel
+
+release: clean dist
+       twine upload -s dist/*
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hanzidentifier-1.0.2/README.rst 
new/hanzidentifier-1.1.0/README.rst
--- old/hanzidentifier-1.0.2/README.rst 2015-08-06 22:43:58.000000000 +0200
+++ new/hanzidentifier-1.1.0/README.rst 2022-10-16 03:15:43.000000000 +0200
@@ -75,6 +75,12 @@
 Change Log
 ----------
 
+v1.1.0 (2020-10-15)
+~~~~~~~~~~~~~~~~~~~
+
+* New function: ``count_chinese()``. Thanks to ramwin.
+* Drop Python 2.
+
 v1.0.2 (2015-08-06)
 ~~~~~~~~~~~~~~~~~~~
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hanzidentifier-1.0.2/hanzidentifier.py 
new/hanzidentifier-1.1.0/hanzidentifier.py
--- old/hanzidentifier-1.0.2/hanzidentifier.py  2015-08-06 22:43:58.000000000 
+0200
+++ new/hanzidentifier-1.1.0/hanzidentifier.py  2022-10-16 03:15:43.000000000 
+0200
@@ -14,14 +14,14 @@
 
 _TRADITIONAL_CHARACTERS = set(list(cedict.traditional))
 _SIMPLIFIED_CHARACTERS = set(list(cedict.simplified))
-_SHARED_CHARACTERS = _TRADITIONAL_CHARACTERS.intersection(
-    _SIMPLIFIED_CHARACTERS)
+_SHARED_CHARACTERS = _TRADITIONAL_CHARACTERS & _SIMPLIFIED_CHARACTERS
 _ALL_CHARACTERS = cedict.all
+HANZI_MATCH = re.compile(f"[^{_ALL_CHARACTERS}]")
 
 
 def _get_hanzi(s):
     """Extract a string's Chinese characters."""
-    return set(re.sub('[^%s]' % _ALL_CHARACTERS, '', s))
+    return set(HANZI_MATCH.sub("", s))
 
 
 def identify(s):
@@ -78,9 +78,9 @@
     chinese = _get_hanzi(s)
     if not chinese:
         return False
-    elif chinese.issubset(_SHARED_CHARACTERS):
+    if chinese.issubset(_SHARED_CHARACTERS):
         return True
-    elif chinese.issubset(_TRADITIONAL_CHARACTERS):
+    if chinese.issubset(_TRADITIONAL_CHARACTERS):
         return True
     return False
 
@@ -95,8 +95,17 @@
     chinese = _get_hanzi(s)
     if not chinese:
         return False
-    elif chinese.issubset(_SHARED_CHARACTERS):
+    if chinese.issubset(_SHARED_CHARACTERS):
         return True
-    elif chinese.issubset(_SIMPLIFIED_CHARACTERS):
+    if chinese.issubset(_SIMPLIFIED_CHARACTERS):
         return True
     return False
+
+
+def count_chinese(s: str) -> int:
+    """count how many chinese exist in a string"""
+    result = 0
+    for i in s:
+        if has_chinese(i):
+            result += 1
+    return result
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hanzidentifier-1.0.2/setup.py 
new/hanzidentifier-1.1.0/setup.py
--- old/hanzidentifier-1.0.2/setup.py   2015-08-06 22:43:58.000000000 +0200
+++ new/hanzidentifier-1.1.0/setup.py   2022-10-16 03:15:43.000000000 +0200
@@ -6,7 +6,7 @@
 
 setup(
     name='hanzidentifier',
-    version='1.0.2',
+    version='1.1.0',
     author='Thomas Roten',
     author_email='tho...@roten.us',
     url='https://github.com/tsroten/hanzidentifier',
@@ -20,10 +20,7 @@
         'License :: OSI Approved :: MIT License',
         'Operating System :: OS Independent',
         'Intended Audience :: Developers',
-        'Programming Language :: Python :: 2.7',
         'Programming Language :: Python :: 3',
-        'Programming Language :: Python :: 3.3',
-        'Programming Language :: Python :: 3.4',
         'Topic :: Text Processing :: Linguistic',
         ],
     keywords=['chinese', 'mandarin', 'hanzi', 'characters', 'simplified',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hanzidentifier-1.0.2/tests/test_hanzidentifier.py 
new/hanzidentifier-1.1.0/tests/test_hanzidentifier.py
--- old/hanzidentifier-1.0.2/tests/test_hanzidentifier.py       2015-08-06 
22:43:58.000000000 +0200
+++ new/hanzidentifier-1.1.0/tests/test_hanzidentifier.py       2022-10-16 
03:15:43.000000000 +0200
@@ -34,6 +34,16 @@
     def test_return_mixed(self):
         self.assertEqual(hanzidentifier.MIXED, hanzidentifier.identify(MIXED))
 
+    def test_count_chinese(self):
+        self.assertEqual(
+            hanzidentifier.count_chinese(BOTH),
+            2,
+        )
+        self.assertEqual(
+            hanzidentifier.count_chinese(SIMPLIFIED),
+            3,
+        )
+
 
 class TestHelperFunctions(unittest.TestCase):
 
@@ -55,5 +65,6 @@
         self.assertTrue(hanzidentifier.is_traditional(TRADITIONAL))
         self.assertFalse(hanzidentifier.is_traditional(UNKNOWN))
 
+
 if __name__ == '__main__':
     unittest.main()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hanzidentifier-1.0.2/tox.ini 
new/hanzidentifier-1.1.0/tox.ini
--- old/hanzidentifier-1.0.2/tox.ini    2015-08-06 22:43:58.000000000 +0200
+++ new/hanzidentifier-1.1.0/tox.ini    2022-10-16 03:15:43.000000000 +0200
@@ -1,4 +1,4 @@
 [tox]
-envlist = py27,py34
+envlist = py37,py38,py39,py310
 [testenv]
-commands=python setup.py test
+commands=python3 setup.py test

Reply via email to