Name | emoji-country-flag JSON |
Version |
2.0.1
JSON |
| download |
home_page | None |
Summary | En/Decode unicode country flags emoji |
upload_time | 2024-07-05 07:28:12 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.10 |
license | MIT |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
|
flag
====
[![foodemoji on PyPI](https://img.shields.io/pypi/v/emoji-country-flag.svg)](https://pypi.python.org/pypi/emoji-country-flag)
[![Python Versions](https://img.shields.io/pypi/pyversions/emoji-country-flag.svg)](https://pypi.python.org/pypi/emoji-country-flag)
[![Coverage Status](https://coveralls.io/repos/github/cvzi/flag/badge.svg?branch=main)](https://coveralls.io/github/cvzi/flag?branch=main)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/6030d5de808c4fe2b2216699f1a7eafb)](https://app.codacy.com/gh/cvzi/flag/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
[![Maintainability](https://api.codeclimate.com/v1/badges/cf1f88720896db4d1b0a/maintainability)](https://codeclimate.com/github/cvzi/flag)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=cvzi_flag&metric=alert_status)](https://sonarcloud.io/dashboard?id=cvzi_flag)
Flag emoji for Python.
Converts flag emoji to ASCII and other way round.
This is based on [http://schinckel.net/2015/10/29/unicode-flags-in-python/](http://web.archive.org/web/20180425063617/https://schinckel.net/2015/10/29/unicode-flags-in-python/) by [schinckel](https://github.com/schinckel/)
How it works
------------
All the flag emoji are actually composed of two unicode letters. These are the 26 [regional indicator symbols](https://en.wikipedia.org/wiki/Regional_Indicator_Symbol).
Alone they look like this:
🇦 🇧 🇨 🇩 🇪 🇫 🇬 🇭 🇮 🇯 🇰 🇱 🇲 🇳 🇴 🇵 🇶 🇷 🇸 🇹 🇺 🇻 🇼 🇽 🇾 🇿
If you pair them up according to ISO 3166 some browsers and phones will display a flag.
For example TW is Taiwan: 🇹 + 🇼 = 🇹🇼
So, to encode an ASCII code like `:TW:` to 🇹🇼, we just need to convert the ASCII **T** and **W** to the corresponding regional indicator symbols 🇹 and 🇼.
To reverse it, we translate the regional indicator symbols back to ASCII letters.
Example
-------
```python
>>> import flag
>>> flag.flag("IL")
'🇮🇱'
>>> flag.flag("GBENG")
'🏴'
>>> flag.flagize("Flag of Israel :IL:")
'Flag of Israel 🇮🇱'
>>> flag.dflagize("Flag of Israel 🇮🇱")
'Flag of Israel :IL:'
>>> flag.flagize("England :gb-eng: is part of the UK :GB:", subregions=True)
'England 🏴 is part of the UK 🇬🇧'
>>> flag.dflagize("England 🏴 is part of the UK 🇬🇧", subregions=True)
'England :gb-eng: is part of the UK :GB:'
>>> my_flags = flag.Flag(only_supported=True, allow_subregions=True)
>>> my_flags.flagize("Convert actual flags like :US: but not unsupported ones like :XX:")
'Convert actual flags like 🇺🇸 but not unsupported ones like :XX:'
```
Install
-------
`pip install emoji-country-flag`
See: [https://pypi.org/project/emoji-country-flag/](https://pypi.org/project/emoji-country-flag/)
Python 3.10 or higher is required for the latest release.
The last release for Python 3.7 to 3.9 was [v1.3.2](https://github.com/cvzi/flag/releases/tag/v1.3.2).
The last release for Python 2.7, 3.4 and 3.5 was [v1.2.4](https://github.com/cvzi/flag/releases/tag/v1.2.4).
Documentation
-------------
[![Documentation Status](https://readthedocs.org/projects/flag/badge/?version=latest)](https://flag.readthedocs.io/en/latest/?badge=latest)
Documentation at [https://flag.readthedocs.io](https://flag.readthedocs.io)
Raw data
{
"_id": null,
"home_page": null,
"name": "emoji-country-flag",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": null,
"author": null,
"author_email": "cuzi <cuzi@openmail.cc>",
"download_url": "https://files.pythonhosted.org/packages/9e/a0/9be36debd24ba5d26623b2ec3b9bdb05d49b62573d239f2ffb64157ab68c/emoji_country_flag-2.0.1.tar.gz",
"platform": null,
"description": "flag\n====\n\n[![foodemoji on PyPI](https://img.shields.io/pypi/v/emoji-country-flag.svg)](https://pypi.python.org/pypi/emoji-country-flag)\n[![Python Versions](https://img.shields.io/pypi/pyversions/emoji-country-flag.svg)](https://pypi.python.org/pypi/emoji-country-flag)\n[![Coverage Status](https://coveralls.io/repos/github/cvzi/flag/badge.svg?branch=main)](https://coveralls.io/github/cvzi/flag?branch=main)\n[![Codacy Badge](https://app.codacy.com/project/badge/Grade/6030d5de808c4fe2b2216699f1a7eafb)](https://app.codacy.com/gh/cvzi/flag/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)\n[![Maintainability](https://api.codeclimate.com/v1/badges/cf1f88720896db4d1b0a/maintainability)](https://codeclimate.com/github/cvzi/flag)\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=cvzi_flag&metric=alert_status)](https://sonarcloud.io/dashboard?id=cvzi_flag)\n\nFlag emoji for Python. \nConverts flag emoji to ASCII and other way round.\n\nThis is based on [http://schinckel.net/2015/10/29/unicode-flags-in-python/](http://web.archive.org/web/20180425063617/https://schinckel.net/2015/10/29/unicode-flags-in-python/) by [schinckel](https://github.com/schinckel/)\n\nHow it works\n------------\n\nAll the flag emoji are actually composed of two unicode letters. These are the 26 [regional indicator symbols](https://en.wikipedia.org/wiki/Regional_Indicator_Symbol).\n\nAlone they look like this: \n\ud83c\udde6 \ud83c\udde7 \ud83c\udde8 \ud83c\udde9 \ud83c\uddea \ud83c\uddeb \ud83c\uddec \ud83c\udded \ud83c\uddee \ud83c\uddef \ud83c\uddf0 \ud83c\uddf1 \ud83c\uddf2 \ud83c\uddf3 \ud83c\uddf4 \ud83c\uddf5 \ud83c\uddf6 \ud83c\uddf7 \ud83c\uddf8 \ud83c\uddf9 \ud83c\uddfa \ud83c\uddfb \ud83c\uddfc \ud83c\uddfd \ud83c\uddfe \ud83c\uddff\n\nIf you pair them up according to ISO 3166 some browsers and phones will display a flag. \nFor example TW is Taiwan: \ud83c\uddf9 + \ud83c\uddfc = \ud83c\uddf9\ud83c\uddfc\n\nSo, to encode an ASCII code like `:TW:` to \ud83c\uddf9\ud83c\uddfc, we just need to convert the ASCII **T** and **W** to the corresponding regional indicator symbols \ud83c\uddf9 and \ud83c\uddfc. \nTo reverse it, we translate the regional indicator symbols back to ASCII letters.\n\nExample\n-------\n\n```python\n >>> import flag\n \n >>> flag.flag(\"IL\")\n '\ud83c\uddee\ud83c\uddf1'\n \n >>> flag.flag(\"GBENG\")\n '\ud83c\udff4\udb40\udc67\udb40\udc62\udb40\udc65\udb40\udc6e\udb40\udc67\udb40\udc7f'\n \n >>> flag.flagize(\"Flag of Israel :IL:\")\n 'Flag of Israel \ud83c\uddee\ud83c\uddf1'\n \n >>> flag.dflagize(\"Flag of Israel \ud83c\uddee\ud83c\uddf1\")\n 'Flag of Israel :IL:'\n \n >>> flag.flagize(\"England :gb-eng: is part of the UK :GB:\", subregions=True)\n 'England \ud83c\udff4\udb40\udc67\udb40\udc62\udb40\udc65\udb40\udc6e\udb40\udc67\udb40\udc7f is part of the UK \ud83c\uddec\ud83c\udde7'\n \n >>> flag.dflagize(\"England \ud83c\udff4\udb40\udc67\udb40\udc62\udb40\udc65\udb40\udc6e\udb40\udc67\udb40\udc7f is part of the UK \ud83c\uddec\ud83c\udde7\", subregions=True)\n 'England :gb-eng: is part of the UK :GB:'\n\n >>> my_flags = flag.Flag(only_supported=True, allow_subregions=True)\n >>> my_flags.flagize(\"Convert actual flags like :US: but not unsupported ones like :XX:\")\n 'Convert actual flags like \ud83c\uddfa\ud83c\uddf8 but not unsupported ones like :XX:'\n```\n\nInstall\n-------\n\n`pip install emoji-country-flag`\n\nSee: [https://pypi.org/project/emoji-country-flag/](https://pypi.org/project/emoji-country-flag/)\n\nPython 3.10 or higher is required for the latest release.\nThe last release for Python 3.7 to 3.9 was [v1.3.2](https://github.com/cvzi/flag/releases/tag/v1.3.2).\nThe last release for Python 2.7, 3.4 and 3.5 was [v1.2.4](https://github.com/cvzi/flag/releases/tag/v1.2.4).\n\nDocumentation\n-------------\n\n[![Documentation Status](https://readthedocs.org/projects/flag/badge/?version=latest)](https://flag.readthedocs.io/en/latest/?badge=latest)\n\nDocumentation at [https://flag.readthedocs.io](https://flag.readthedocs.io)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "En/Decode unicode country flags emoji",
"version": "2.0.1",
"project_urls": {
"documentation": "https://flag.readthedocs.io/",
"downloads": "https://pypi.org/project/emoji-country-flag/",
"homepage": "https://github.com/cvzi/flag",
"repository": "https://github.com/cvzi/flag"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "4d71e777f5b50df5dcf12740abe46d7896fa2d791516138a14a975ab8b71aa1c",
"md5": "c7823d20ea2ccaa75cd9c94bb995c8a8",
"sha256": "5465745b20f33d1ea46a53126f23f5aea34d66b20c2571c7bbb6a63925e4d95a"
},
"downloads": -1,
"filename": "emoji_country_flag-2.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c7823d20ea2ccaa75cd9c94bb995c8a8",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 25798,
"upload_time": "2024-07-05T07:28:11",
"upload_time_iso_8601": "2024-07-05T07:28:11.657959Z",
"url": "https://files.pythonhosted.org/packages/4d/71/e777f5b50df5dcf12740abe46d7896fa2d791516138a14a975ab8b71aa1c/emoji_country_flag-2.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9ea09be36debd24ba5d26623b2ec3b9bdb05d49b62573d239f2ffb64157ab68c",
"md5": "174572051da0ddd3106d1453e35ea516",
"sha256": "0faa32ca4f12da4e4c8324431947077b116caf998b0df0c01168ae8ece24e57a"
},
"downloads": -1,
"filename": "emoji_country_flag-2.0.1.tar.gz",
"has_sig": false,
"md5_digest": "174572051da0ddd3106d1453e35ea516",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 81150,
"upload_time": "2024-07-05T07:28:12",
"upload_time_iso_8601": "2024-07-05T07:28:12.813120Z",
"url": "https://files.pythonhosted.org/packages/9e/a0/9be36debd24ba5d26623b2ec3b9bdb05d49b62573d239f2ffb64157ab68c/emoji_country_flag-2.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-05 07:28:12",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "cvzi",
"github_project": "flag",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"lcname": "emoji-country-flag"
}