File: api.rst

package info (click to toggle)
python-emoji 2.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,444 kB
  • sloc: python: 53,212; javascript: 262; makefile: 12
file content (111 lines) | stat: -rw-r--r-- 4,696 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
.. _api:

API Reference
~~~~~~~~~~~~~

.. py:module:: emoji
   :noindex:


+-----------------------------+--------------------------------------------------------------+
| Table of Contents           |                                                              |
+=============================+==============================================================+
| **Functions:**              |                                                              |
+-----------------------------+--------------------------------------------------------------+
| :func:`emojize`             | Replace emoji names with Unicode codes                       |
+-----------------------------+--------------------------------------------------------------+
| :func:`demojize`            | Replace Unicode emoji with emoji shortcodes                  |
+-----------------------------+--------------------------------------------------------------+
| :func:`replace_emoji`       | Replace Unicode emoji with a customizable string             |
+-----------------------------+--------------------------------------------------------------+
| :func:`emoji_list`          | Location of all emoji in a string                            |
+-----------------------------+--------------------------------------------------------------+
| :func:`distinct_emoji_list` | Distinct list of emojis in the string                        |
+-----------------------------+--------------------------------------------------------------+
| :func:`emoji_count`         | Number of emojis in a string                                 |
+-----------------------------+--------------------------------------------------------------+
| :func:`is_emoji`            | Check if a string/character is a single emoji                |
+-----------------------------+--------------------------------------------------------------+
| :func:`version`             | Find Unicode/Emoji version of an emoji                       |
+-----------------------------+--------------------------------------------------------------+
| **Module variables:**       |                                                              |
+-----------------------------+--------------------------------------------------------------+
| :data:`EMOJI_DATA`          | Dict of all emoji                                            |
+-----------------------------+--------------------------------------------------------------+
| :data:`STATUS`              | Dict of Unicode/Emoji status                                 |
+-----------------------------+--------------------------------------------------------------+


.. automodule:: emoji
   :members:


EMOJI_DATA
------------

.. data:: EMOJI_DATA
   :type: dict
   :canonical: emoji.unicode_codes.data_dict.EMOJI_DATA

     Contains all emoji as keys and their names, Unicode version and status

     .. code-block:: python

       EMOJI_DATA = {
         '🥇': {
             'en' : ':1st_place_medal:',
             'status' : emoji.STATUS["fully_qualified"],
             'E' : 3,
             'de': ':goldmedaille:',
             'es': ':medalla_de_oro:',
             'fr': ':médaille_d’or:',
             'pt': ':medalha_de_ouro:',
             'it': ':medaglia_d’oro:'
         },
         ...
       }

**Source code:** `emoji/unicode_codes/data_dict.py <https://github.com/carpedm20/emoji/raw/master/emoji/unicode_codes/data_dict.py>`_ **(2MB)**

Emoji status
------------

.. data:: STATUS
   :type: dict
   :canonical: emoji.unicode_codes.data_dict.STATUS

     The status values that are used in :data:`emoji.EMOJI_DATA`.

     For more information on the meaning of these values see http://www.unicode.org/reports/tr51/#Emoji_Implementation_Notes

   .. literalinclude:: ../emoji/unicode_codes/data_dict.py
      :language: python
      :start-at: component =
      :end-before: EMOJI_DATA
      :caption: emoji/unicode_codes/data_dict.py


.. _Emoji version:

Emoji version
-------------

Every emoji in :data:`emoji.EMOJI_DATA` has a version number. The number refers to the release of
that emoji in the Unicode Standard.
It is stored in the key ``'E'``. For example the emoji 🥇 ``:1st_place_medal:`` is version
``E3.0`` that is Emoji 3.0 or Unicode 9.0:

>>> emoji.EMOJI_DATA['🥇']['E']
3

For more information see http://www.unicode.org/reports/tr51/#Versioning

The following table lists all versions, the number that is used in :data:`emoji.EMOJI_DATA` in
the "Data File Comment" column:

.. literalinclude:: ../emoji/unicode_codes/data_dict.py
   :start-after: emoji_data_files.py
   :end-before: """
   :caption: Unicode/Emoji Version (emoji/unicode_codes/data_dict.py)
   :dedent: 2