emoji_data.sequence module#
- final class emoji_data.sequence.EmojiSequence(code_points, type_field=None, version=None, variation=None, description=None)[source]#
Bases:
objectEmoji and Text Presentation Sequences used to represent emoji
- Parameters:
- 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"
- 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
EmojiSequenceobject.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[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
yieldresult offind().This function is equivalent to:
list(EmojiSequence.find(s))
or
[x for x in EmojiSequence.find(s)]
- classmethod from_characters()[source]#
Get an
EmojiSequenceinstance fromEmojiCharacterobject or list- Parameters:
value (
Union[EmojiCharacter,Iterable[EmojiCharacter]]) – Single or iterable object ofEmojiCharacter, composing the sequence- Return type:
- Returns:
Instance from internal dictionary
- Raises:
KeyError – When passed-in value not found in internal dictionary
TypeError – When passed-in value is not
EmojiCharacterobject or list
- classmethod from_hex()[source]#
Get an
EmojiSequenceinstance by Unicode code point(s).- Parameters:
value (
Union[int,str,Iterable[Union[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:
- 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
EmojiSequenceinstance from a string.
- 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:
- classmethod keys()[source]#
Return an iterator over all key strings of emoji sequences in the class.
-
pattern:
ClassVar[Pattern[str]]# Compiled regular expression pattern object for all-together Emoji sequences.
- property regex_pattern#
Compiled regular expression pattern 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: