1234567891011121314151617181920212223242526272829303132333435363738394041 |
- #!/usr/bin/env python3
- # -*- coding: utf-8; -*-
- # This is autogenerated python file DO NOT try to edit
- /* [[[cog
- import cog
- import json
- json_package_path = '../../../emoji.json'
- data_dict = json.loads(open(json_package_path).read())
- unicode_replace = {}
- shortcode_replace = {}
- ascii_replace = {}
- for key, value in data_dict.items():
- unicode_hex = value['unicode']
- ascii_list = value['aliases_ascii']
- shortname = value['shortname']
- for ascii in ascii_list:
- ascii_replace[ascii] = unicode_hex
- shortcode_replace[shortname] = unicode_hex
- if '-' not in unicode_hex:
- unicode_char = chr(int(unicode_hex, 16))
- unicode_replace[unicode_char.encode('utf-8')] = shortname
- else:
- parts = unicode_hex.split('-')
- unicode_char = ''.join(chr(int(part, 16)) for part in parts)
- unicode_replace[unicode_char.encode('utf-8')] = shortname
- print(unicode_replace)
- print(shortcode_replace)
- print(ascii_replace)
- cog.out('unicode_replace = %s\n\n' % unicode_replace)
- cog.out('shortcode_replace = %s\n\n' % shortcode_replace)
- cog.out('ascii_replace = %s\n\n' % ascii_replace)
- ]]] */
- //[[[end]]]
|