How to use the demoji.findall function in demoji

To help you get started, we’ve selected a few demoji examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bsolomon1124 / demoji / tests / test_demoji.py View on Github external
"傳騰訊入股Reddit 言論自由不保?",
        "🇩🇯",
        "⬛",
        "🔵",
        "🇨🇫",
        "‼",
    ]
    assert len(demoji.findall(" xxx ".join(batch))) == len(batch) - 2

    tweet = """\
    #startspreadingthenews yankees win great start by 🎅🏾 going 5strong innings with 5k’s🔥 🐂
    solo homerun 🌋🌋 with 2 solo homeruns and👹 3run homerun… 🤡 🚣🏼 👨🏽‍⚖️ with rbi’s … 🔥🔥
    🇲🇽 and 🇳🇮 to close the game🔥🔥!!!….
    WHAT A GAME!!..
    """
    assert demoji.findall(tweet) == {
        "🔥": "fire",
        "🌋": "volcano",
        "👨🏽\u200d⚖️": "man judge: medium skin tone",
        "🎅🏾": "Santa Claus: medium-dark skin tone",
        "🇲🇽": "flag: Mexico",
        "👹": "ogre",
        "🤡": "clown face",
        "🇳🇮": "flag: Nicaragua",
        "🚣🏼": "person rowing boat: medium-light skin tone",
        "🐂": "ox",
    }
github bsolomon1124 / demoji / tests / test_demoji.py View on Github external
def test_demoji_main():
    assert not demoji.findall("Hi")
    assert demoji.replace("Hi") == "Hi"
    assert not demoji.findall("2 ! $&%((@)# $)@ ")
    assert demoji.findall("The 🌓 shall rise again") == {
        "🌓": "first quarter moon"
    }
    allhands = "Someone actually gets paid to make a %s, a %s, and a %s" % (
        person_tipping_hand,
        man_tipping_hand,
        woman_tipping_hand,
    )
    assert demoji.findall(allhands) == {
        person_tipping_hand: "person tipping hand",
        man_tipping_hand: "man tipping hand",
        woman_tipping_hand: "woman tipping hand",
    }
    assert (
        demoji.replace(allhands)
        == "Someone actually gets paid to make a , a , and a "
    )
github bsolomon1124 / demoji / tests / test_demoji.py View on Github external
"🏴󠁧󠁢󠁳󠁣󠁴󠁿",
        "👩‍👧‍👦",
        "🐷",
        "2️⃣",
        "8️⃣",
        "🆖",
        "🈳",
        "الجزيرة‎",
        "傳騰訊入股Reddit 言論自由不保?",
        "🇩🇯",
        "⬛",
        "🔵",
        "🇨🇫",
        "‼",
    ]
    assert len(demoji.findall(" xxx ".join(batch))) == len(batch) - 2

    tweet = """\
    #startspreadingthenews yankees win great start by 🎅🏾 going 5strong innings with 5k’s🔥 🐂
    solo homerun 🌋🌋 with 2 solo homeruns and👹 3run homerun… 🤡 🚣🏼 👨🏽‍⚖️ with rbi’s … 🔥🔥
    🇲🇽 and 🇳🇮 to close the game🔥🔥!!!….
    WHAT A GAME!!..
    """
    assert demoji.findall(tweet) == {
        "🔥": "fire",
        "🌋": "volcano",
        "👨🏽\u200d⚖️": "man judge: medium skin tone",
        "🎅🏾": "Santa Claus: medium-dark skin tone",
        "🇲🇽": "flag: Mexico",
        "👹": "ogre",
        "🤡": "clown face",
        "🇳🇮": "flag: Nicaragua",
github bsolomon1124 / demoji / tests / test_demoji.py View on Github external
def test_demoji_main():
    assert not demoji.findall("Hi")
    assert demoji.replace("Hi") == "Hi"
    assert not demoji.findall("2 ! $&%((@)# $)@ ")
    assert demoji.findall("The 🌓 shall rise again") == {
        "🌓": "first quarter moon"
    }
    allhands = "Someone actually gets paid to make a %s, a %s, and a %s" % (
        person_tipping_hand,
        man_tipping_hand,
        woman_tipping_hand,
    )
    assert demoji.findall(allhands) == {
        person_tipping_hand: "person tipping hand",
        man_tipping_hand: "man tipping hand",
        woman_tipping_hand: "woman tipping hand",
    }
    assert (
        demoji.replace(allhands)
        == "Someone actually gets paid to make a , a , and a "
github bsolomon1124 / demoji / tests / test_demoji.py View on Github external
def test_demoji_main():
    assert not demoji.findall("Hi")
    assert demoji.replace("Hi") == "Hi"
    assert not demoji.findall("2 ! $&%((@)# $)@ ")
    assert demoji.findall("The 🌓 shall rise again") == {
        "🌓": "first quarter moon"
    }
    allhands = "Someone actually gets paid to make a %s, a %s, and a %s" % (
        person_tipping_hand,
        man_tipping_hand,
        woman_tipping_hand,
    )
    assert demoji.findall(allhands) == {
        person_tipping_hand: "person tipping hand",
        man_tipping_hand: "man tipping hand",
        woman_tipping_hand: "woman tipping hand",
    }
    assert (
github bsolomon1124 / demoji / tests / test_demoji.py View on Github external
def test_demoji_main():
    assert not demoji.findall("Hi")
    assert demoji.replace("Hi") == "Hi"
    assert not demoji.findall("2 ! $&%((@)# $)@ ")
    assert demoji.findall("The 🌓 shall rise again") == {
        "🌓": "first quarter moon"
    }
    allhands = "Someone actually gets paid to make a %s, a %s, and a %s" % (
        person_tipping_hand,
        man_tipping_hand,
        woman_tipping_hand,
    )
    assert demoji.findall(allhands) == {
        person_tipping_hand: "person tipping hand",
        man_tipping_hand: "man tipping hand",
        woman_tipping_hand: "woman tipping hand",
    }
    assert (
        demoji.replace(allhands)
        == "Someone actually gets paid to make a , a , and a "
    )
    assert (
        demoji.replace(allhands, "X")
        == "Someone actually gets paid to make a X, a X, and a X"
    )
    assert isinstance(demoji.last_downloaded_timestamp(), datetime.datetime)

    # Something for everyone...
    batch = [
github DiscordWebsite / discord_logview / api / formatter.py View on Github external
def _process_unicode_emojis(m, emoji_class):
    e = re.sub(r'[\U0000FE00-\U0000FE0F]$', '', m.group())
    title_e = re.sub(r'[\U0001F3FB-\U0001F3FF]$', '', e) or e
    title = UNICODE_LIST.get(title_e, demoji.findall(title_e)[title_e])
    codepoint = "-".join(['%04x' % ord(_c) for _c in e]).lstrip('0')
    return f'<img alt="{e}" title=":{title}:" class="{emoji_class}">'