Skip to content

Commit

Permalink
Merge pull request #166 from landgrafhomyak/master
Browse files Browse the repository at this point in the history
Type hints
  • Loading branch information
TahirJalilov authored Sep 17, 2022
2 parents 83cec96 + 7413185 commit b27cf78
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 0 deletions.
30 changes: 30 additions & 0 deletions emoji/__init__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
from .core import (
demojize as demojize,
distinct_emoji_list as distinct_emoji_list,
emoji_count as emoji_count,
emoji_list as emoji_list,
emojize as emojize,
is_emoji as is_emoji,
replace_emoji as replace_emoji,
version as version,
)
from .unicode_codes import EMOJI_DATA, LANGUAGES, STATUS

__all__ = [
"emojize",
"demojize",
"emoji_count",
"emoji_list",
"distinct_emoji_list",
"replace_emoji",
"version",
"is_emoji",
"EMOJI_DATA",
"STATUS",
"LANGUAGES",
]
__version__: str
__author__: str
__email__: str
__source__: str
__license__: str
35 changes: 35 additions & 0 deletions emoji/core.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
from collections.abc import Callable
from typing_extensions import Literal, TypedDict

_DEFAULT_DELIMITER: str

class _EmojiLisReturn(TypedDict):
emoji: str
location: int

class _EmojiListReturn(TypedDict):
emoji: str
match_start: int
match_end: int

def emojize(
string: str,
delimiters: tuple[str, str] = ...,
variant: Literal["text_type", "emoji_type", None] = ...,
language: str = ...,
version: float | None = ...,
handle_version: str | Callable[[str, dict[str, str]], str] | None = ...,
) -> str: ...
def demojize(
string: str,
delimiters: tuple[str, str] = ...,
language: str = ...,
version: float | None = ...,
handle_version: str | Callable[[str, dict[str, str]], str] | None = ...,
) -> str: ...
def replace_emoji(string: str, replace: str | Callable[[str, dict[str, str]], str] = ..., version: float = ...) -> str: ...
def emoji_list(string: str) -> list[_EmojiListReturn]: ...
def distinct_emoji_list(string: str) -> list[str]: ...
def emoji_count(string: str, unique: bool = ...) -> int: ...
def version(string: str) -> float: ...
def is_emoji(string: str) -> bool: ...
Empty file added emoji/py.typed
Empty file.
6 changes: 6 additions & 0 deletions emoji/unicode_codes/__init__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from .data_dict import *

__all__ = ["get_emoji_unicode_dict", "get_aliases_unicode_dict", "EMOJI_DATA", "STATUS", "LANGUAGES"]

def get_emoji_unicode_dict(lang: str) -> dict[str, str]: ...
def get_aliases_unicode_dict() -> dict[str, str]: ...
7 changes: 7 additions & 0 deletions emoji/unicode_codes/data_dict.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from typing import Any

__all__ = ["EMOJI_DATA", "STATUS", "LANGUAGES"]

STATUS: dict[str, int]
LANGUAGES: list[str]
EMOJI_DATA: dict[str, dict[str, Any]]
Empty file added emoji/unicode_codes/py.typed
Empty file.
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
'Topic :: Multimedia :: Graphics :: Presentation',
'Topic :: Software Development :: Libraries :: Python Modules',
'Typing :: Typed'
],
description="Emoji for Python",
keywords=['emoji'],
Expand Down

0 comments on commit b27cf78

Please sign in to comment.