Giter VIP home page Giter VIP logo

demoji's People

Contributors

bsolomon1124 avatar jap avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

demoji's Issues

demji returns local datetime as utc datetime

when calling demoji.last_downloaded_timestamp() it returns a timeaware object of system localtime zone instead utc time
which is incorrect in UTC time.

To Reproduce

>>> demoji.last_downloaded_timestamp()
datetime.datetime(2020, 10, 26, 11, 21, 57, 347238, tzinfo=<demoji.UTC object at 0x7fab3f849eb0>)
>>> datetime.utcnow()
datetime.datetime(2020, 10, 26, 7, 58, 53, 767124)
>>> datetime.now()
datetime.datetime(2020, 10, 26, 11, 28, 54, 955153)

Desktop

  • OS: Ubuntu 20.04
  • Version: '0.3.0'
  • Python: 3.8.5
  • My local timezone: ('Asia/Tehran') UTC+3:30

Add a default timeout in demoji.download_codes()

Describe the bug
demoji.download_codes() has no inbuilt timeout and it gets stuck for a very long time if something is wrong.
I had this line at start of my app with a try except but it does not raises exception rather just gets stuck resulting in nginx timeout of my web app and the loop continues.

To Reproduce
Steps to reproduce the behavior:

    import demoji
    try:
        demoji.download_codes()
    except Exception:
        pass

Expected behavior
It should download or timeout and raise Exception but since requests default timeout is None it keeps stuck

Fix colors in Windows console

Windows cmd not support escape sequences by default. But it can be fixed:

import sys
import demoji

if ('win' in sys.platform):
    import ctypes
    kernel32 = ctypes.windll.kernel32
    kernel32.SetConsoleMode(kernel32.GetStdHandle(-11), 7)

demoji.download_codes()

Output before:
image

Output after:
image

Replace endpoint for static URL

Hello. Thanks for your app.

Good idea to replace download endpoint's url with a permanent one. You are working with 12.0, but 13.1 is available. So, let's use "unicode.org/Public/emoji/latest/emoji-test.txt" ?)

Add ujson support

$ python3 -m timeit 'import json; json.load(open("/Users/brad/.demoji/codes.json"))' 
100 loops, best of 5: 2.1 msec per loop

$ python3 -m timeit 'import ujson; ujson.load(open("/Users/brad/.demoji/codes.json"))' 
200 loops, best of 5: 1.31 msec per loop

Bundle emojis in package

It is difficult for me to provided reusable software if the emjois are not already bundled in the demoji package. I understand and acknowledge that the list of emjois could be routinely updated, but this is not a reason to routinely not bundle the list in the package itself. For instance, I believe Python comes bundled with unicode data. You can still offer users a way to update the emoji list, and otherwise fallback to what's in the package.

Ability to cache emoji data in a user defined directory

Is your feature request related to a problem? Please describe.
Yes. AWS Lambda provides the application ephermal storage space only on /tmp directory. When implementing demoji on AWS Lambda, we get a permission issue when caching the emoji data

Describe the solution you'd like
Ability to specify a directory when caching the emoji data. Possibly in the download codes function

Describe alternatives you've considered
I do not see any other alternative

Can you add tags for the releases?

I want to upload this library to the Arch user repository, and to do so it would be practical to have git tags for the releases, or at least for the most current release and future releases. Could you add that?

I.e. run these git commands

git tag -a -m 'Release v0.1.5' v0.1.5 f28ffba
git push --follow-tags

Remove all emojis

Useful library.
How can I remove all emojis from text?
Is there any solution for counting emojis in a given text?

Documentation mistype

Describe the bug
There is a little mistype:

>>> pprint(seq.encode('unicode-escape'))  # Python 3
(b"I bet you didn't know that \\U0001f64b, \\U0001f64b\\u200d\\u2642\\ufe0f,"
 b' and \\U0001f64b\\u200d\\u2640\\ufe0f are three different emojis.\\n')

I suppose it must be print

replace() leaves unicode variation selector-16

Describe the bug
replace() function leaves unicode variation selector-16 (\xef\xb8\x8f) when replacing Repeat Button emoji (๐Ÿ”๏ธ).

To Reproduce

import demoji

sample_var = '๐Ÿ”๏ธ sample text'
print(sample_var.encode('utf-8'))
>>> b'\xf0\x9f\x94\x81\xef\xb8\x8f sample text'

sample_var = demoji.replace(sample_var)
print(sample_var.encode('utf-8'))
>>> b'\xef\xb8\x8f sample text'

Expected behavior
String without \xef\xb8\x8f sequence:

>>> b' sample text'

Replace emoji with description

Is your feature request related to a problem? Please describe.
I am trying to replace the emoji found with description given in the 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",
}
Describe the solution you'd like
I have a string with emoji :
Rooney ! Oh dear, oh dear ! Fucking dreadful ๐Ÿ™ˆโšฝ๏ธโšฝ๏ธ

I want to make it like this:
Rooney ! Oh dear, oh dear ! Fucking dreadful 'see-no-evil monkey' 'soccer ball' 'soccer ball'

Describe alternatives you have considered

emo_dict=demoji.findall(emoticonString)
for key in emo_dict.keys():
    emoticonString=emoticonString.replace(key, emo_dict[key])

Does not work with the following string

using the replace_with_desc function on this string: "๐Ÿง‘๐Ÿปโ€โค๏ธโ€๐Ÿ’‹โ€๐Ÿง‘๐Ÿผ ๐Ÿง‘๐Ÿปโ€โค๏ธโ€๐Ÿ’‹โ€๐Ÿง‘๐Ÿฝ ๐Ÿง‘๐Ÿปโ€โค๏ธโ€๐Ÿ’‹โ€๐Ÿง‘๐Ÿพ ๐Ÿง‘๐Ÿปโ€โค๏ธโ€๐Ÿ’‹โ€๐Ÿง‘๐Ÿฟ ๐Ÿง‘๐Ÿผโ€โค๏ธโ€๐Ÿ’‹โ€๐Ÿง‘๐Ÿป ๐Ÿง‘๐Ÿผโ€โค๏ธโ€๐Ÿ’‹โ€๐Ÿง‘๐Ÿฝ ๐Ÿง‘๐Ÿผโ€โค๏ธโ€๐Ÿ’‹โ€๐Ÿง‘๐Ÿพ ๐Ÿง‘๐Ÿผโ€โค๏ธโ€๐Ÿ’‹โ€๐Ÿง‘๐Ÿฟ ๐Ÿง‘๐Ÿฝโ€โค๏ธโ€๐Ÿ’‹โ€๐Ÿง‘๐Ÿป ๐Ÿง‘๐Ÿฝโ€โค๏ธโ€๐Ÿ’‹โ€๐Ÿง‘๐Ÿผ ๐Ÿง‘๐Ÿฝโ€โค๏ธโ€๐Ÿ’‹โ€๐Ÿง‘๐Ÿพ ๐Ÿง‘๐Ÿฝโ€โค๏ธโ€๐Ÿ’‹โ€๐Ÿง‘๐Ÿฟ ๐Ÿง‘๐Ÿพโ€โค๏ธโ€๐Ÿ’‹โ€๐Ÿง‘๐Ÿป ๐Ÿง‘๐Ÿพโ€โค๏ธโ€๐Ÿ’‹โ€๐Ÿง‘๐Ÿผ ๐Ÿง‘๐Ÿพโ€โค๏ธโ€๐Ÿ’‹โ€๐Ÿง‘๐Ÿฝ ๐Ÿง‘๐Ÿพโ€โค๏ธโ€๐Ÿ’‹โ€๐Ÿง‘๐Ÿฟ ๐Ÿง‘๐Ÿฟโ€โค๏ธโ€๐Ÿ’‹โ€๐Ÿง‘๐Ÿป ๐Ÿง‘๐Ÿฟโ€โค๏ธโ€๐Ÿ’‹โ€๐Ÿง‘๐Ÿผ ๐Ÿง‘๐Ÿฟโ€โค๏ธโ€๐Ÿ’‹โ€"

produces:
"๐Ÿง‘๐Ÿป\u200d:red heart:\u200d:kiss mark:\u200d๐Ÿง‘๐Ÿผ ๐Ÿ’‹ person, person, light skin tone, medium skin tone: ๐Ÿ’‹ person, person, light skin tone, medium-dark skin tone: ๐Ÿง‘๐Ÿป\u200d:red heart:\u200d:kiss mark:\u200d:person: dark skin tone: ๐Ÿง‘๐Ÿผ\u200d:red heart:\u200d:kiss mark:\u200d๐Ÿง‘๐Ÿป ๐Ÿง‘๐Ÿผ\u200d:red heart:\u200d:kiss mark:\u200d๐Ÿง‘๐Ÿฝ ๐Ÿง‘๐Ÿผ\u200d:red heart:\u200d:kiss mark:\u200d๐Ÿง‘๐Ÿพ ๐Ÿง‘๐Ÿผ\u200d:red heart:\u200d:kiss mark:\u200d:person: dark skin tone: ๐Ÿง‘๐Ÿฝ\u200d:red heart:\u200d:kiss mark:\u200d๐Ÿง‘๐Ÿป ๐Ÿ’‹ person, person, medium skin tone, medium-light skin tone: ๐Ÿง‘๐Ÿฝ\u200d:red heart:\u200d:kiss mark:\u200d๐Ÿง‘๐Ÿพ ๐Ÿง‘๐Ÿฝ\u200d:red heart:\u200d:kiss mark:\u200d:person: dark skin tone: ๐Ÿง‘๐Ÿพ\u200d:red heart:\u200d:kiss mark:\u200d๐Ÿง‘๐Ÿป ๐Ÿง‘๐Ÿพ\u200d:red heart:\u200d:kiss mark:\u200d๐Ÿง‘๐Ÿผ ๐Ÿ’‹ person, person, medium-dark skin tone, medium skin tone: ๐Ÿง‘๐Ÿพ\u200d:red heart:\u200d:kiss mark:\u200d:person: dark skin tone: :person: dark skin tone:\u200d:red heart:\u200d:kiss mark:\u200d๐Ÿง‘๐Ÿป :person: dark skin tone:\u200d:red heart:\u200d:kiss mark:\u200d๐Ÿง‘๐Ÿผ :person: dark skin tone:\u200d:red heart:\u200d:kiss mark:\u200d"

emojis remain in the string

Provide a remove function

This package is advertised as being able to remove emjois, yet it lacks a basic remove function. I understand that there is a replace function, but that's not the same. It is misleading to advertise a package as being capable of removing emjois, but not providing a basic function to do so!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.