Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-langtable for 
openSUSE:Factory checked in at 2022-10-12 18:25:46
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-langtable (Old)
 and      /work/SRC/openSUSE:Factory/.python-langtable.new.2275 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-langtable"

Wed Oct 12 18:25:46 2022 rev:6 rq:1010133 version:0.0.60

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-langtable/python-langtable.changes        
2022-09-07 11:05:54.256386340 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-langtable.new.2275/python-langtable.changes  
    2022-10-12 18:27:31.302063676 +0200
@@ -1,0 +2,7 @@
+Wed Oct 12 03:39:37 UTC 2022 - Yogalakshmi Arunachalam <[email protected]>
+
+- Update to version 0.0.60  
+  * Add list_common_locales() function (Resolves: #15)
+  * For ar_IN locale, langtable should give the 'ara' keyboard layout as the 
first choice (Resolves: Resolves: #14)
+
+-------------------------------------------------------------------

Old:
----
  langtable-0.0.59.tar.gz

New:
----
  langtable-0.0.60.tar.gz

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

Other differences:
------------------
++++++ python-langtable.spec ++++++
--- /var/tmp/diff_new_pack.xXMzpT/_old  2022-10-12 18:27:32.562066450 +0200
+++ /var/tmp/diff_new_pack.xXMzpT/_new  2022-10-12 18:27:32.566066458 +0200
@@ -18,7 +18,7 @@
 
 %define skip_python2 1
 Name:           python-langtable
-Version:        0.0.59
+Version:        0.0.60
 Release:        0
 Summary:        Database to guess defaults for locale settings
 # the translations in languages.xml and territories.xml are (mostly)

++++++ langtable-0.0.59.tar.gz -> langtable-0.0.60.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/langtable-0.0.59/ChangeLog 
new/langtable-0.0.60/ChangeLog
--- old/langtable-0.0.59/ChangeLog      2022-09-06 09:12:23.000000000 +0200
+++ new/langtable-0.0.60/ChangeLog      2022-09-21 16:56:17.000000000 +0200
@@ -1,3 +1,10 @@
+2022-09-21  Mike FABIAN  <[email protected]>
+
+       * Add list_common_locales() function
+       (Resolves: https://github.com/mike-fabian/langtable/issues/15)
+       * For ar_IN locale, langtable should give the 'ara' keyboard layout as 
the first choice
+       (Resolves: Resolves: https://github.com/mike-fabian/langtable/issues/14)
+
 2022-09-06  Mike FABIAN  <[email protected]>
 
        * Add ibus/m17n:ar:kbd as input method for Arabic and fix iso639-1 code 
for Arabic
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/langtable-0.0.59/PKG-INFO 
new/langtable-0.0.60/PKG-INFO
--- old/langtable-0.0.59/PKG-INFO       2022-09-06 11:24:15.133437200 +0200
+++ new/langtable-0.0.60/PKG-INFO       2022-09-21 17:07:48.342677400 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: langtable
-Version: 0.0.59
+Version: 0.0.60
 Summary: guess reasonable defaults for locale, keyboard, territory, ...
 Home-page: https://github.com/mike-fabian/langtable
 Author: Mike FABIAN
Binary files old/langtable-0.0.59/langtable/data/languages.xml.gz and 
new/langtable-0.0.60/langtable/data/languages.xml.gz differ
Binary files old/langtable-0.0.59/langtable/data/territories.xml.gz and 
new/langtable-0.0.60/langtable/data/territories.xml.gz differ
Binary files old/langtable-0.0.59/langtable/data/timezoneidparts.xml.gz and 
new/langtable-0.0.60/langtable/data/timezoneidparts.xml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/langtable-0.0.59/langtable/langtable.py 
new/langtable-0.0.60/langtable/langtable.py
--- old/langtable-0.0.59/langtable/langtable.py 2022-09-06 09:14:05.000000000 
+0200
+++ new/langtable-0.0.60/langtable/langtable.py 2022-09-21 16:51:19.000000000 
+0200
@@ -22,6 +22,7 @@
 #     list_locales()
 #     list_keyboards()
 #     list_common_languages()
+#     list_common_locales()
 #     list_common_keyboards()
 #     list_consolefonts()
 #     list_inputmethods()
@@ -118,6 +119,10 @@
 # keyboard layout as prevalent
 _KEYBOARD_LAYOUT_RANK_THRESHOLD = 500
 
+# Rank threshold to qualify a
+# locale as prevalent
+_LOCALE_RANK_THRESHOLD = 500
+
 # For the ICU/CLDR locale pattern see: http://userguide.icu-project.org/locale
 # (We ignore the variant code here)
 _cldr_locale_pattern = re.compile(
@@ -2210,7 +2215,7 @@
 
 def list_common_keyboards(languageId = None, scriptId = None, territoryId = 
None):
     '''Returns highest ranked keyboard layout(s)
-
+2
     :param languageId: identifier for the language
     :type languageId: string
     :param scriptId: identifier for the script
@@ -2268,6 +2273,81 @@
 
     return sorted(high_ranked_keyboards)
 
+def list_common_locales(languageId = None, scriptId = None, territoryId = 
None):
+    '''Returns highest ranked locales
+
+    :param languageId: identifier for the language
+    :type languageId: string
+    :param scriptId: identifier for the script
+    :type scriptId: string
+    :param territoryId: identifier for the territory
+    :type territoryId: string
+    :return: list of locales
+    :rtype: list of strings
+
+    **Examples:**
+
+    >>> list_common_locales()
+    ['ar_EG.UTF-8', 'en_US.UTF-8', 'en_GB.UTF-8', 'fr_FR.UTF-8', 
'de_DE.UTF-8', 'ja_JP.UTF-8', 'zh_CN.UTF-8', 'ru_RU.UTF-8', 'es_ES.UTF-8']
+
+    >>> list_common_locales(languageId='fr')
+    ['fr_FR.UTF-8']
+
+    >>> list_common_locales(territoryId='CA')
+    ['en_CA.UTF-8']
+
+    >>> list_common_locales(territoryId='FR')
+    ['fr_FR.UTF-8']
+
+    >>> list_common_locales(languageId='fr', territoryId='CA')
+    ['fr_CA.UTF-8']
+
+    >>> list_common_locales(languageId='de', territoryId='FR')
+    ['de_DE.UTF-8']
+
+    >>> list_common_locales(languageId='sr', scriptId='Latn')
+    ['sr_RS.UTF-8@latin']
+
+    >>> list_common_locales(languageId='sr', scriptId='Cyrl')
+    ['sr_RS.UTF-8']
+
+    >>> list_common_locales(languageId='zh', scriptId='Hans')
+    ['zh_CN.UTF-8']
+
+    >>> list_common_locales(languageId='zh', scriptId='Hant')
+    ['zh_TW.UTF-8']
+
+    >>> list_common_locales(languageId='zh', territoryId='TW')
+    ['zh_TW.UTF-8']
+    '''
+    high_ranked_locales = list()
+    if not languageId and not scriptId and not territoryId:
+        for language in list_common_languages():
+            locales = _languages_db[language].locales
+            selected_locales = [locale for locale, rank
+                                in sorted(locales.items(),
+                                          key=lambda x: (-x[1]))
+                                if rank >= _LOCALE_RANK_THRESHOLD]
+            if selected_locales:
+                high_ranked_locales.extend(selected_locales)
+        return high_ranked_locales
+
+    kwargs = dict()
+    locale = _parse_and_split_languageId(
+        languageId=languageId, scriptId=scriptId, territoryId=territoryId
+    )
+    if locale.language:
+        kwargs.update(dict(languageId=locale.language))
+    if locale.script:
+        kwargs.update(dict(scriptId=locale.script))
+    if locale.territory:
+        kwargs.update(dict(territoryId=locale.territory))
+    common_locales = list_locales(**kwargs)
+    if common_locales:
+        # Picking up first locale from the list
+        high_ranked_locales.append(common_locales[0])
+    return high_ranked_locales
+
 def list_consolefonts(concise=True, show_weights=False, languageId = None, 
scriptId = None, territoryId = None):
     u'''List likely Linux Console fonts
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/langtable-0.0.59/langtable.egg-info/PKG-INFO 
new/langtable-0.0.60/langtable.egg-info/PKG-INFO
--- old/langtable-0.0.59/langtable.egg-info/PKG-INFO    2022-09-06 
11:24:14.000000000 +0200
+++ new/langtable-0.0.60/langtable.egg-info/PKG-INFO    2022-09-21 
17:07:48.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: langtable
-Version: 0.0.59
+Version: 0.0.60
 Summary: guess reasonable defaults for locale, keyboard, territory, ...
 Home-page: https://github.com/mike-fabian/langtable
 Author: Mike FABIAN
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/langtable-0.0.59/setup.py 
new/langtable-0.0.60/setup.py
--- old/langtable-0.0.59/setup.py       2022-09-06 09:11:22.000000000 +0200
+++ new/langtable-0.0.60/setup.py       2022-09-21 16:51:19.000000000 +0200
@@ -8,7 +8,7 @@
     # within the egg directory easily:
     zip_safe=False,
     name='langtable',
-    version='0.0.59',
+    version='0.0.60',
     packages=setuptools.find_packages(),
     description='guess reasonable defaults for locale, keyboard, territory, 
...',
     long_description=codecs.open('README', encoding='UTF-8').read(),
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/langtable-0.0.59/test_cases.py 
new/langtable-0.0.60/test_cases.py
--- old/langtable-0.0.59/test_cases.py  2022-09-06 09:10:26.000000000 +0200
+++ new/langtable-0.0.60/test_cases.py  2022-09-21 16:42:17.000000000 +0200
@@ -421,7 +421,10 @@
     ['Zzzz']
 
     >>> list_keyboards(languageId="de", territoryId="BE") # doctest: 
+NORMALIZE_WHITESPACE
-        ['be(oss)']
+    ['be(oss)']
+
+    >>> list_keyboards(languageId="ar", territoryId="IN") # doctest: 
+NORMALIZE_WHITESPACE
+    ['ara']
 
     # script and territory given in languageId override script and territory 
in extra parameters:
     >>> list_keyboards(languageId="sr_Latn", scriptId="Cyrl", 
territoryId="BE") # doctest: +NORMALIZE_WHITESPACE
@@ -726,8 +729,8 @@
         IN: ['hi_IN.UTF-8', 'en_IN.UTF-8', 'bn_IN.UTF-8', 'te_IN.UTF-8', 
'mr_IN.UTF-8', 'ta_IN.UTF-8', 'ur_IN.UTF-8', 'gu_IN.UTF-8', 'kn_IN.UTF-8', 
'ml_IN.UTF-8', 'or_IN.UTF-8', 'pa_IN.UTF-8', 'as_IN.UTF-8', 'mai_IN.UTF-8', 
'sat_IN.UTF-8', 'ks_IN.UTF-8', 'ks_IN.UTF-8@devanagari', 'kok_IN.UTF-8', 
'sd_IN.UTF-8', 'sd_IN.UTF-8@devanagari', 'doi_IN.UTF-8', 'mni_IN.UTF-8', 
'brx_IN.UTF-8', 'raj_IN.UTF-8', 'mjw_IN.UTF-8', 'anp_IN.UTF-8', 'bhb_IN.UTF-8', 
'bho_IN.UTF-8', 'bo_IN.UTF-8', 'hne_IN.UTF-8', 'mag_IN.UTF-8', 'tcy_IN.UTF-8', 
'ar_IN.UTF-8']
          +: ['ar_IN.UTF-8']
         ar: ['ara', 'ara(azerty)', 'iq', 'ma', 'sy']
-        IN: ['in(eng)']
-         +: ['in(eng)', 'ara', 'ara(azerty)', 'iq', 'ma', 'sy']
+        IN: ['in(eng)', 'ara']
+         +: ['ara']
 
     >>> _test_language_territory(show_weights=False, languageId="ar", 
territoryId="DE") # doctest: +NORMALIZE_WHITESPACE
         ar: ['ar_EG.UTF-8', 'ar_SD.UTF-8', 'ar_DZ.UTF-8', 'ar_MA.UTF-8', 
'ar_IQ.UTF-8', 'ar_SA.UTF-8', 'ar_YE.UTF-8', 'ar_SY.UTF-8', 'ar_TN.UTF-8', 
'ar_LY.UTF-8', 'ar_JO.UTF-8', 'ar_AE.UTF-8', 'ar_LB.UTF-8', 'ar_KW.UTF-8', 
'ar_OM.UTF-8', 'ar_QA.UTF-8', 'ar_BH.UTF-8', 'ar_IN.UTF-8', 'ar_SS.UTF-8']
@@ -742,7 +745,7 @@
         IN: ['hi_IN.UTF-8', 'en_IN.UTF-8', 'bn_IN.UTF-8', 'te_IN.UTF-8', 
'mr_IN.UTF-8', 'ta_IN.UTF-8', 'ur_IN.UTF-8', 'gu_IN.UTF-8', 'kn_IN.UTF-8', 
'ml_IN.UTF-8', 'or_IN.UTF-8', 'pa_IN.UTF-8', 'as_IN.UTF-8', 'mai_IN.UTF-8', 
'sat_IN.UTF-8', 'ks_IN.UTF-8', 'ks_IN.UTF-8@devanagari', 'kok_IN.UTF-8', 
'sd_IN.UTF-8', 'sd_IN.UTF-8@devanagari', 'doi_IN.UTF-8', 'mni_IN.UTF-8', 
'brx_IN.UTF-8', 'raj_IN.UTF-8', 'mjw_IN.UTF-8', 'anp_IN.UTF-8', 'bhb_IN.UTF-8', 
'bho_IN.UTF-8', 'bo_IN.UTF-8', 'hne_IN.UTF-8', 'mag_IN.UTF-8', 'tcy_IN.UTF-8', 
'ar_IN.UTF-8']
          +: ['as_IN.UTF-8']
         as: ['in(eng)']
-        IN: ['in(eng)']
+        IN: ['in(eng)', 'ara']
          +: ['in(eng)']
 
     >>> _test_language_territory(show_weights=False, languageId="bn", 
territoryId="BD") # doctest: +NORMALIZE_WHITESPACE
@@ -758,7 +761,7 @@
         IN: ['hi_IN.UTF-8', 'en_IN.UTF-8', 'bn_IN.UTF-8', 'te_IN.UTF-8', 
'mr_IN.UTF-8', 'ta_IN.UTF-8', 'ur_IN.UTF-8', 'gu_IN.UTF-8', 'kn_IN.UTF-8', 
'ml_IN.UTF-8', 'or_IN.UTF-8', 'pa_IN.UTF-8', 'as_IN.UTF-8', 'mai_IN.UTF-8', 
'sat_IN.UTF-8', 'ks_IN.UTF-8', 'ks_IN.UTF-8@devanagari', 'kok_IN.UTF-8', 
'sd_IN.UTF-8', 'sd_IN.UTF-8@devanagari', 'doi_IN.UTF-8', 'mni_IN.UTF-8', 
'brx_IN.UTF-8', 'raj_IN.UTF-8', 'mjw_IN.UTF-8', 'anp_IN.UTF-8', 'bhb_IN.UTF-8', 
'bho_IN.UTF-8', 'bo_IN.UTF-8', 'hne_IN.UTF-8', 'mag_IN.UTF-8', 'tcy_IN.UTF-8', 
'ar_IN.UTF-8']
          +: ['bn_IN.UTF-8']
         bn: ['in(eng)']
-        IN: ['in(eng)']
+        IN: ['in(eng)', 'ara']
          +: ['in(eng)']
 
     >>> _test_language_territory(show_weights=False, languageId="zh", 
territoryId="CN") # doctest: +NORMALIZE_WHITESPACE

Reply via email to