emoji_data.sequence module#

final class emoji_data.sequence.EmojiSequence(code_points, type_field=None, version=None, variation=None, description=None)[source]#

Bases: object

Emoji and Text Presentation Sequences used to represent emoji

Parameters:
  • code_points (Union[int, Iterable[int]])

  • type_field (Optional[str])

  • version (Optional[str])

  • variation (Optional[str])

  • description (Optional[str])

property characters: EmojiCharacter'>]#

List of emoji character objects that make up the emoji sequence.

property code_points: Sequence[int]#

List of unicode integer value of the characters who make up this Emoji Sequence

property code_points_string: str#

Unicode style hex string of each emoji-characters’s code-point, separated by spaces

eg: "00A9 FE0F"

property description: str#

Description

classmethod find()[source]#

Return an iterator that yields all emoji sequences in a string without storing them all simultaneously.

Parameters:

s (str) – The string to search for emoji sequences.

Yields:

A 3-member tuple for each matched emoji sequence, where:

  • The first member is the found EmojiSequence object.

  • The second member is the start position of the emoji sequence in the string.

  • The third member is the end position of the emoji sequence in the string.

Return type:

Iterator[Tuple[<class ‘emoji_data.sequence.EmojiSequence’>, int, int]]

classmethod find_all()[source]#

Find all emoji sequences in a string and return them in a list.

Each item in the returned list is the same as the yield result of find().

This function is equivalent to:

list(EmojiSequence.find(s))

or

[x for x in EmojiSequence.find(s)]
Return type:

Sequence[Tuple[EmojiSequence, int, int]]

Parameters:

s (str)

classmethod from_characters()[source]#

Get an EmojiSequence instance from EmojiCharacter object or list

Parameters:

value (EmojiCharacter | Iterable[EmojiCharacter]) – Single or iterable object of EmojiCharacter, composing the sequence

Return type:

EmojiSequence

Returns:

Instance from internal dictionary

Raises:
classmethod from_hex()[source]#

Get an EmojiSequence instance by Unicode code point(s).

Parameters:

value (int | str | Iterable[int | str]) –

A single or sequence of HEX string/code.

It could be:

  • One or more code points in HEX format string, separated by spaces.

  • A single code point integer.

  • An iterable object whose members are code point strings in HEX format.

  • An iterable object whose members are code point integers.

Return type:

EmojiSequence

Returns:

An instance retrieved from the class’s internal dictionary.

Raises:

KeyError – If the passed-in value is not found in the class’s internal dictionary.

classmethod from_string()[source]#

Get an EmojiSequence instance from a string.

Parameters:

s (str) – An emoji string.

Return type:

EmojiSequence

Returns:

An instance retrieved from the internal dictionary.

Raises:

KeyError – If the passed-in string s is not found in the internal dictionary.

property hex: str#

Python style hex string of each emoji-characters’s code-point, separated by spaces

Example

"0xa9 0xfe0f"

classmethod initial()[source]#

Initial the class

Load Emoji Sequences from package data file into class internal dictionary

classmethod items()[source]#

Return an iterator over all key strings of emoji sequences in the class.

Yields:

A key string of an emoji sequence.

Return type:

Iterator[Tuple[str, <class ‘emoji_data.sequence.EmojiSequence’>]]

classmethod keys()[source]#

Return an iterator over all key strings of emoji sequences in the class.

Yields:

A key string corresponding to an emoji sequence.

Return type:

Iterator[str]

pattern: ClassVar[Pattern[str]]#

Compiled regular expression pattern object for all-together Emoji sequences.

property regex: str#

Regular expression string of the Emoji Sequence

property regex_pattern#

Compiled regular expression pattern of the Emoji Sequence

classmethod release()[source]#
property string: str#

String of the Emoji Sequence

property type_field: Literal['Basic_Emoji', 'Emoji_Keycap_Sequence', 'RGI_Emoji_Flag_Sequence', 'RGI_Emoji_Tag_Sequence', 'RGI_Emoji_Modifier_Sequence', 'RGI_Emoji_ZWJ_Sequence']#

A convenience for parsing the emoji sequence files, and is not intended to be maintained as a property.

classmethod values()[source]#

Return an iterator over all emoji sequences in the class.

Yields:

An emoji sequence instance.

Return type:

Iterator[<class ‘emoji_data.sequence.EmojiSequence’>]

property variation: Literal['emoji style', 'text style', '']#

"emoji style" or "text style" of a variable sequence

Available for Emoji Variation Sequences for UTS #51. Used with Emoji Version 16.0 and subsequent minor revisions (if any).

property version: str#

Version of the Emoji.

Example

E0.0, E0.6, E11.0