15
0
forked from pool/python-emoji
Files
python-emoji/fix-python2.patch
Matej Cepl 12435d22a2 Accepting request 910366 from home:theMarix:branches:devel:languages:python
- Update to 1.4.2
  * Added support for German naming of emojis.
  * Added support for French naming of emojis.
  * Added new function `replace_emoji` which strips emojis from
    output.
- Add patch `fix-python2.patch`: Fixes unicode emoji names on Python
  2.

OBS-URL: https://build.opensuse.org/request/show/910366
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-emoji?expand=0&rev=22
2021-08-06 05:46:13 +00:00

23 lines
934 B
Diff
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
From: Matthias Bach <marix@marix.org>
Date: 2021-07-31 11:57:53 2021 +0200
Subject: Fix matching of non-ASCII emoji names on Python 2
References: https://github.com/carpedm20/emoji/pull/181
Upstream: merged
A fix to get the tests passing for the French language in 1.4.1 sadly was incomplete and only worked for Python 3. This extends the patch to also work on Python 2.
diff --git a/emoji/core.py b/emoji/core.py
index 7221937..ade232e 100644
--- a/emoji/core.py
+++ b/emoji/core.py
@@ -55,7 +55,7 @@ def emojize(
Python is fun ❤️ #red heart, not black heart
"""
EMOJI_UNICODE = unicode_codes.EMOJI_UNICODE[language]
- pattern = re.compile(u'(%s[\\w\\-&.’”“()!#*+?,/]+%s)' % delimiters)
+ pattern = re.compile(u'(%s[\\w\\-&.’”“()!#*+?,/]+%s)' % delimiters, flags=re.UNICODE)
def replace(match):
mg = match.group(1).replace(delimiters[0], _DEFAULT_DELIMITER).replace(