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}">'