%global _empty_manifest_terminate_build 0 Name: python-iso639-lang Version: 2.1.0 Release: 1 Summary: A lightweight library for the ISO 639 standard. License: MIT License URL: https://github.com/LBeaudoux/iso639 Source0: https://mirrors.nju.edu.cn/pypi/web/packages/4e/16/89c74fc1cdb4952fb17704370afcf6887ceea7b0b33e684013a598475be7/iso639-lang-2.1.0.tar.gz BuildArch: noarch %description # iso639-lang ![PyPI](https://img.shields.io/pypi/v/iso639-lang) ![Supported Python versions](https://img.shields.io/pypi/pyversions/iso639-lang.svg) ![PyPI - Downloads](https://img.shields.io/pypi/dm/iso639-lang) **iso639-lang** is a simple library to handle the ISO 639 series of international standards for language codes. ```python >>> from iso639 import Lang >>> Lang("fr") Lang(name='French', pt1='fr', pt2b='fre', pt2t='fra', pt3='fra', pt5='') ``` iso639-lang allows you to switch from one language code to another easily. There’s no need to manually download or parse data files, just use the `Lang` class! ISO 639-1, ISO 639-2, ISO 639-3 and ISO 639-5 parts are all supported. ## Installing iso639-lang and Supported Versions iso639-lang is available on PyPI: ```console $ pip install iso639-lang ``` iso639-lang supports Python 3.6+. ## Usage Handling language codes with iso639-lang is very simple. Begin by importing the `Lang` class: ```python >>> from iso639 import Lang ``` `Lang` is instantiable with any ISO 639 language code or name. For example, let’s try to get the ISO 639 codes for French: ```python >>> lg = Lang("French") >>> lg.name 'French' >>> lg.pt1 'fr' >>> lg.pt2b 'fre' >>> lg.pt2t 'fra' >>> lg.pt3 'fra' >>> lg.pt5 '' ``` You can use the `asdict` method to return ISO 639 language values as a Python dictionary. ```python >>> lg.asdict() {'name': 'French', 'pt1': 'fr', 'pt2b': 'fre', 'pt2t': 'fra', 'pt3': 'fra', 'pt5': ''} ``` ### In data structures Lists of `Lang` instances are sortable by name. ```python >>> langs = [Lang("deu"), Lang("eng"), Lang("rus"), Lang("eng")] >>> [lg.name for lg in sorted(langs)] ['English', 'English', 'German', 'Russian'] ``` As `Lang` is hashable, `Lang` instances can be added to a set or used as dictionary keys. ```python >>> [lg.pt3 for lg in set(langs)] ['eng', 'rus', 'deu'] ``` ### Iterator `iter_langs()` iterates through all possible `Lang` instances, ordered alphabetically by name. ```python >>> from iso639 import iter_langs >>> [lg.name for lg in iter_langs()] ["'Are'are", "'Auhelawa", "A'ou", ... , 'ǂHua', 'ǂUngkue', 'ǃXóõ'] ``` ### Language Types The type of a language is accessible thanks to the `type` method. ```python >>> lg = Lang("Latin") >>> lg.type() 'Ancient' ``` ### Macrolanguages You can easily determine whether a language is a macrolanguage or an individual language. ```python >>> lg = Lang("Arabic") >>> lg.scope() 'Macrolanguage' ``` Use the `macro` method to get the macrolanguage of an individual language. ```python >>> lg = Lang("Wu Chinese") >>> lg.macro() Lang(name='Chinese', pt1='zh', pt2b='chi', pt2t='zho', pt3='zho', pt5='') ``` Conversely, you can also list all the individual languages that share a common macrolanguage. ```python >>> lg = Lang("Persian") >>> lg.individuals() [Lang(name='Iranian Persian', pt1='', pt2b='', pt2t='', pt3='pes', pt5=''), Lang(name='Dari', pt1='', pt2b='', pt2t='', pt3='prs', pt5='')] ``` ### Exceptions When an invalid language value is passed to `Lang`, an `InvalidLanguageValue` exception is raised. ```python >>> from iso639.exceptions import InvalidLanguageValue >>> try: ... Lang("foobar") ... except InvalidLanguageValue as e: ... e.msg ... "'foobar' not supported by ISO 639" ``` When an deprecated language value is passed to `Lang`, a `DeprecatedLanguageValue` exception is raised. ```python >>> from iso639.exceptions import DeprecatedLanguageValue >>> try: ... Lang("gsc") ... except DeprecatedLanguageValue as e: ... lg = Lang(e.change_to) ... f"{e.name} replaced by {lg.name}" ... 'Gascon replaced by Occitan (post 1500)' ``` ## Sources of data used by iso639-lang As of March 7, 2022, iso639-lang is based on the latest official code tables provided by the ISO 639 registration authorities. | Standard | Name | Registration Authority | | --------- | ------------------------------------------------------------------------------------------ | ---------------------- | | [ISO 639-1](https://iso639-3.sil.org/sites/iso639-3/files/downloads/iso-639-3.tab) | *Part 1: Alpha-2 code* | Infoterm | | [ISO 639-2](https://www.loc.gov/standards/iso639-2/ISO-639-2_utf-8.txt) | *Part 2: Alpha-3 code* | Library of Congress | | [ISO 639-3](https://iso639-3.sil.org/sites/iso639-3/files/downloads/iso-639-3.tab) | *Part 3: Alpha-3 code for comprehensive coverage of languages* | SIL International | | ISO 639-4 | *Part 4: Implementation guidelines and general principles for language coding* (not a list) | ISO/TC 37/SC 2 | | [ISO 639-5](http://id.loc.gov/vocabulary/iso639-5.tsv) | *Part 5: Alpha-3 code for language families and groups* | Library of Congress | %package -n python3-iso639-lang Summary: A lightweight library for the ISO 639 standard. Provides: python-iso639-lang BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip %description -n python3-iso639-lang # iso639-lang ![PyPI](https://img.shields.io/pypi/v/iso639-lang) ![Supported Python versions](https://img.shields.io/pypi/pyversions/iso639-lang.svg) ![PyPI - Downloads](https://img.shields.io/pypi/dm/iso639-lang) **iso639-lang** is a simple library to handle the ISO 639 series of international standards for language codes. ```python >>> from iso639 import Lang >>> Lang("fr") Lang(name='French', pt1='fr', pt2b='fre', pt2t='fra', pt3='fra', pt5='') ``` iso639-lang allows you to switch from one language code to another easily. There’s no need to manually download or parse data files, just use the `Lang` class! ISO 639-1, ISO 639-2, ISO 639-3 and ISO 639-5 parts are all supported. ## Installing iso639-lang and Supported Versions iso639-lang is available on PyPI: ```console $ pip install iso639-lang ``` iso639-lang supports Python 3.6+. ## Usage Handling language codes with iso639-lang is very simple. Begin by importing the `Lang` class: ```python >>> from iso639 import Lang ``` `Lang` is instantiable with any ISO 639 language code or name. For example, let’s try to get the ISO 639 codes for French: ```python >>> lg = Lang("French") >>> lg.name 'French' >>> lg.pt1 'fr' >>> lg.pt2b 'fre' >>> lg.pt2t 'fra' >>> lg.pt3 'fra' >>> lg.pt5 '' ``` You can use the `asdict` method to return ISO 639 language values as a Python dictionary. ```python >>> lg.asdict() {'name': 'French', 'pt1': 'fr', 'pt2b': 'fre', 'pt2t': 'fra', 'pt3': 'fra', 'pt5': ''} ``` ### In data structures Lists of `Lang` instances are sortable by name. ```python >>> langs = [Lang("deu"), Lang("eng"), Lang("rus"), Lang("eng")] >>> [lg.name for lg in sorted(langs)] ['English', 'English', 'German', 'Russian'] ``` As `Lang` is hashable, `Lang` instances can be added to a set or used as dictionary keys. ```python >>> [lg.pt3 for lg in set(langs)] ['eng', 'rus', 'deu'] ``` ### Iterator `iter_langs()` iterates through all possible `Lang` instances, ordered alphabetically by name. ```python >>> from iso639 import iter_langs >>> [lg.name for lg in iter_langs()] ["'Are'are", "'Auhelawa", "A'ou", ... , 'ǂHua', 'ǂUngkue', 'ǃXóõ'] ``` ### Language Types The type of a language is accessible thanks to the `type` method. ```python >>> lg = Lang("Latin") >>> lg.type() 'Ancient' ``` ### Macrolanguages You can easily determine whether a language is a macrolanguage or an individual language. ```python >>> lg = Lang("Arabic") >>> lg.scope() 'Macrolanguage' ``` Use the `macro` method to get the macrolanguage of an individual language. ```python >>> lg = Lang("Wu Chinese") >>> lg.macro() Lang(name='Chinese', pt1='zh', pt2b='chi', pt2t='zho', pt3='zho', pt5='') ``` Conversely, you can also list all the individual languages that share a common macrolanguage. ```python >>> lg = Lang("Persian") >>> lg.individuals() [Lang(name='Iranian Persian', pt1='', pt2b='', pt2t='', pt3='pes', pt5=''), Lang(name='Dari', pt1='', pt2b='', pt2t='', pt3='prs', pt5='')] ``` ### Exceptions When an invalid language value is passed to `Lang`, an `InvalidLanguageValue` exception is raised. ```python >>> from iso639.exceptions import InvalidLanguageValue >>> try: ... Lang("foobar") ... except InvalidLanguageValue as e: ... e.msg ... "'foobar' not supported by ISO 639" ``` When an deprecated language value is passed to `Lang`, a `DeprecatedLanguageValue` exception is raised. ```python >>> from iso639.exceptions import DeprecatedLanguageValue >>> try: ... Lang("gsc") ... except DeprecatedLanguageValue as e: ... lg = Lang(e.change_to) ... f"{e.name} replaced by {lg.name}" ... 'Gascon replaced by Occitan (post 1500)' ``` ## Sources of data used by iso639-lang As of March 7, 2022, iso639-lang is based on the latest official code tables provided by the ISO 639 registration authorities. | Standard | Name | Registration Authority | | --------- | ------------------------------------------------------------------------------------------ | ---------------------- | | [ISO 639-1](https://iso639-3.sil.org/sites/iso639-3/files/downloads/iso-639-3.tab) | *Part 1: Alpha-2 code* | Infoterm | | [ISO 639-2](https://www.loc.gov/standards/iso639-2/ISO-639-2_utf-8.txt) | *Part 2: Alpha-3 code* | Library of Congress | | [ISO 639-3](https://iso639-3.sil.org/sites/iso639-3/files/downloads/iso-639-3.tab) | *Part 3: Alpha-3 code for comprehensive coverage of languages* | SIL International | | ISO 639-4 | *Part 4: Implementation guidelines and general principles for language coding* (not a list) | ISO/TC 37/SC 2 | | [ISO 639-5](http://id.loc.gov/vocabulary/iso639-5.tsv) | *Part 5: Alpha-3 code for language families and groups* | Library of Congress | %package help Summary: Development documents and examples for iso639-lang Provides: python3-iso639-lang-doc %description help # iso639-lang ![PyPI](https://img.shields.io/pypi/v/iso639-lang) ![Supported Python versions](https://img.shields.io/pypi/pyversions/iso639-lang.svg) ![PyPI - Downloads](https://img.shields.io/pypi/dm/iso639-lang) **iso639-lang** is a simple library to handle the ISO 639 series of international standards for language codes. ```python >>> from iso639 import Lang >>> Lang("fr") Lang(name='French', pt1='fr', pt2b='fre', pt2t='fra', pt3='fra', pt5='') ``` iso639-lang allows you to switch from one language code to another easily. There’s no need to manually download or parse data files, just use the `Lang` class! ISO 639-1, ISO 639-2, ISO 639-3 and ISO 639-5 parts are all supported. ## Installing iso639-lang and Supported Versions iso639-lang is available on PyPI: ```console $ pip install iso639-lang ``` iso639-lang supports Python 3.6+. ## Usage Handling language codes with iso639-lang is very simple. Begin by importing the `Lang` class: ```python >>> from iso639 import Lang ``` `Lang` is instantiable with any ISO 639 language code or name. For example, let’s try to get the ISO 639 codes for French: ```python >>> lg = Lang("French") >>> lg.name 'French' >>> lg.pt1 'fr' >>> lg.pt2b 'fre' >>> lg.pt2t 'fra' >>> lg.pt3 'fra' >>> lg.pt5 '' ``` You can use the `asdict` method to return ISO 639 language values as a Python dictionary. ```python >>> lg.asdict() {'name': 'French', 'pt1': 'fr', 'pt2b': 'fre', 'pt2t': 'fra', 'pt3': 'fra', 'pt5': ''} ``` ### In data structures Lists of `Lang` instances are sortable by name. ```python >>> langs = [Lang("deu"), Lang("eng"), Lang("rus"), Lang("eng")] >>> [lg.name for lg in sorted(langs)] ['English', 'English', 'German', 'Russian'] ``` As `Lang` is hashable, `Lang` instances can be added to a set or used as dictionary keys. ```python >>> [lg.pt3 for lg in set(langs)] ['eng', 'rus', 'deu'] ``` ### Iterator `iter_langs()` iterates through all possible `Lang` instances, ordered alphabetically by name. ```python >>> from iso639 import iter_langs >>> [lg.name for lg in iter_langs()] ["'Are'are", "'Auhelawa", "A'ou", ... , 'ǂHua', 'ǂUngkue', 'ǃXóõ'] ``` ### Language Types The type of a language is accessible thanks to the `type` method. ```python >>> lg = Lang("Latin") >>> lg.type() 'Ancient' ``` ### Macrolanguages You can easily determine whether a language is a macrolanguage or an individual language. ```python >>> lg = Lang("Arabic") >>> lg.scope() 'Macrolanguage' ``` Use the `macro` method to get the macrolanguage of an individual language. ```python >>> lg = Lang("Wu Chinese") >>> lg.macro() Lang(name='Chinese', pt1='zh', pt2b='chi', pt2t='zho', pt3='zho', pt5='') ``` Conversely, you can also list all the individual languages that share a common macrolanguage. ```python >>> lg = Lang("Persian") >>> lg.individuals() [Lang(name='Iranian Persian', pt1='', pt2b='', pt2t='', pt3='pes', pt5=''), Lang(name='Dari', pt1='', pt2b='', pt2t='', pt3='prs', pt5='')] ``` ### Exceptions When an invalid language value is passed to `Lang`, an `InvalidLanguageValue` exception is raised. ```python >>> from iso639.exceptions import InvalidLanguageValue >>> try: ... Lang("foobar") ... except InvalidLanguageValue as e: ... e.msg ... "'foobar' not supported by ISO 639" ``` When an deprecated language value is passed to `Lang`, a `DeprecatedLanguageValue` exception is raised. ```python >>> from iso639.exceptions import DeprecatedLanguageValue >>> try: ... Lang("gsc") ... except DeprecatedLanguageValue as e: ... lg = Lang(e.change_to) ... f"{e.name} replaced by {lg.name}" ... 'Gascon replaced by Occitan (post 1500)' ``` ## Sources of data used by iso639-lang As of March 7, 2022, iso639-lang is based on the latest official code tables provided by the ISO 639 registration authorities. | Standard | Name | Registration Authority | | --------- | ------------------------------------------------------------------------------------------ | ---------------------- | | [ISO 639-1](https://iso639-3.sil.org/sites/iso639-3/files/downloads/iso-639-3.tab) | *Part 1: Alpha-2 code* | Infoterm | | [ISO 639-2](https://www.loc.gov/standards/iso639-2/ISO-639-2_utf-8.txt) | *Part 2: Alpha-3 code* | Library of Congress | | [ISO 639-3](https://iso639-3.sil.org/sites/iso639-3/files/downloads/iso-639-3.tab) | *Part 3: Alpha-3 code for comprehensive coverage of languages* | SIL International | | ISO 639-4 | *Part 4: Implementation guidelines and general principles for language coding* (not a list) | ISO/TC 37/SC 2 | | [ISO 639-5](http://id.loc.gov/vocabulary/iso639-5.tsv) | *Part 5: Alpha-3 code for language families and groups* | Library of Congress | %prep %autosetup -n iso639-lang-2.1.0 %build %py3_build %install %py3_install install -d -m755 %{buildroot}/%{_pkgdocdir} if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi pushd %{buildroot} if [ -d usr/lib ]; then find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/lib64 ]; then find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/bin ]; then find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/sbin ]; then find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst fi touch doclist.lst if [ -d usr/share/man ]; then find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst fi popd mv %{buildroot}/filelist.lst . mv %{buildroot}/doclist.lst . %files -n python3-iso639-lang -f filelist.lst %dir %{python3_sitelib}/* %files help -f doclist.lst %{_docdir}/* %changelog * Fri May 05 2023 Python_Bot - 2.1.0-1 - Package Spec generated