# -*- coding: utf-8 -*- """change emoji shortcodes to characters Revision ID: 232e68a03aa2 Revises: af3f5579c84d Create Date: 2018-02-28 21:31:35.260704 """ from __future__ import unicode_literals from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '232e68a03aa2' down_revision = 'af3f5579c84d' branch_labels = () depends_on = None _emoji_replacement_mapping = { # bowtie: not in Unicode # neckbeard: not in Unicode # shipit, squirrel: GitHub inside joke? either way, not in Unicode # trollface: ancient meme, not in Unicode # octocat: that's a brand logo, of course it's not in Unicode # flaskbb: that's our logo! sadly not in Unicode though # feelsgood: doom reference, not in Unicode # finnadie: doom reference, not in Unicode # goberserk: doom reference, not in Unicode # godmode: doom reference, not in Unicode # hurtrealbad: doom reference, not in Unicode # rage1: doom reference, not in Unicode # rage2: doom reference, not in Unicode # rage3: doom reference, not in Unicode # rage4: doom reference, not in Unicode # suspect: doom reference, not in Unicode '+1': '๐', '-1': '๐', '100': '๐ฏ', '1234': '๐ข', '8ball': '๐ฑ', 'a': '๐ ฐ๏ธ', 'ab': '๐', 'abc': '๐ค', 'abcd': '๐ก', 'accept': '๐', 'aerial_tramway': '๐ก', 'airplane': 'โ๏ธ', 'alarm_clock': 'โฐ', 'alien': '๐ฝ', 'ambulance': '๐', 'anchor': 'โ๏ธ', 'angel': '๐ผ', 'anger': '๐ข', 'angry': '๐ ', 'anguished': '๐ง', 'ant': '๐', 'apple': '๐', 'aquarius': 'โ๏ธ', 'aries': 'โ๏ธ', 'arrow_backward': 'โ๏ธ', 'arrow_double_down': 'โฌ', 'arrow_double_up': 'โซ', 'arrow_down': 'โฌ๏ธ', 'arrow_down_small': '๐ฝ', 'arrow_forward': 'โถ๏ธ', 'arrow_heading_down': 'โคต๏ธ', 'arrow_heading_up': 'โคด๏ธ', 'arrow_left': 'โฌ ๏ธ', 'arrow_lower_left': 'โ๏ธ', 'arrow_lower_right': 'โ๏ธ', 'arrow_right': 'โก๏ธ', 'arrow_right_hook': 'โช๏ธ', 'arrow_up': 'โฌ๏ธ', 'arrow_up_down': 'โ๏ธ', 'arrow_up_small': '๐ผ', 'arrow_upper_left': 'โ๏ธ', 'arrow_upper_right': 'โ๏ธ', 'arrows_clockwise': '๐', 'arrows_counterclockwise': '๐', 'art': '๐จ', 'articulated_lorry': '๐', 'astonished': '๐ฒ', 'atm': '๐ง', 'b': '๐ ฑ๏ธ', 'baby': '๐ถ', 'baby_bottle': '๐ผ', 'baby_chick': '๐ค', 'baby_symbol': '๐ผ', 'back': '๐', 'baggage_claim': '๐', 'balloon': '๐', 'ballot_box_with_check': 'โ๏ธ', 'bamboo': '๐', 'banana': '๐', 'bangbang': 'โผ๏ธ', 'bank': '๐ฆ', 'bar_chart': '๐', 'barber': '๐', 'baseball': 'โพ๏ธ', 'basketball': '๐', 'bath': '๐', 'bathtub': '๐', 'battery': '๐', 'bear': '๐ป', 'bee': '๐', 'beer': '๐บ', 'beers': '๐ป', 'beetle': '๐', 'beginner': '๐ฐ', 'bell': '๐', 'bento': '๐ฑ', 'bicyclist': '๐ด', 'bike': '๐ฒ', 'bikini': '๐', 'bird': '๐ฆ', 'birthday': '๐', 'black_circle': 'โซ๏ธ', 'black_joker': '๐', 'black_medium_small_square': 'โพ๏ธ', 'black_medium_square': 'โผ๏ธ', 'black_nib': 'โ๏ธ', 'black_small_square': 'โช๏ธ', 'black_square': 'โฌ', # i assume that's black large square 'black_square_button': '๐ฒ', 'blossom': '๐ผ', 'blowfish': '๐ก', 'blue_book': '๐', 'blue_car': '๐', 'blue_heart': '๐', 'blush': '๐', 'boar': '๐', 'boat': 'โต๏ธ', 'bomb': '๐ฃ', 'book': '๐', 'bookmark': '๐', 'bookmark_tabs': '๐', 'books': '๐', 'boom': '๐ฅ', 'boot': '๐ข', 'bouquet': '๐', 'bow': '๐', 'bowling': '๐ณ', 'boy': '๐ฆ', 'bread': '๐', 'bride_with_veil': '๐ฐ', 'bridge_at_night': '๐', 'briefcase': '๐ผ', 'broken_heart': '๐', 'bug': '๐', 'bulb': '๐ก', 'bullettrain_front': '๐ ', 'bullettrain_side': '๐', 'bus': '๐', 'busstop': '๐', 'bust_in_silhouette': '๐ค', 'busts_in_silhouette': '๐ฅ', 'cactus': '๐ต', 'cake': '๐ฐ', 'calendar': '๐', 'calling': '๐ฒ', 'camel': '๐ซ', 'camera': '๐ท', 'cancer': 'โ๏ธ', 'candy': '๐ฌ', 'capital_abcd': '๐ ', 'capricorn': 'โ๏ธ', 'car': '๐', 'card_index': '๐', 'carousel_horse': '๐ ', 'cat': '๐ฑ', 'cat2': '๐', 'cd': '๐ฟ', 'chart': '๐น', 'chart_with_downwards_trend': '๐', 'chart_with_upwards_trend': '๐', 'checkered_flag': '๐', 'cherries': '๐', 'cherry_blossom': '๐ธ', 'chestnut': '๐ฐ', 'chicken': '๐', 'children_crossing': '๐ธ', 'chocolate_bar': '๐ซ', 'christmas_tree': '๐', 'church': 'โช๏ธ', 'cinema': '๐ฆ', 'circus_tent': '๐ช', 'city_sunrise': '๐', 'city_sunset': '๐', 'cl': '๐', 'clap': '๐', 'clapper': '๐ฌ', 'clipboard': '๐', 'clock1': '๐', 'clock10': '๐', 'clock1030': '๐ฅ', 'clock11': '๐', 'clock1130': '๐ฆ', 'clock12': '๐', 'clock1230': '๐ง', 'clock130': '๐', 'clock2': '๐', 'clock230': '๐', 'clock3': '๐', 'clock330': '๐', 'clock4': '๐', 'clock430': '๐', 'clock5': '๐', 'clock530': '๐ ', 'clock6': '๐', 'clock630': '๐ก', 'clock7': '๐', 'clock730': '๐ข', 'clock8': '๐', 'clock830': '๐ฃ', 'clock9': '๐', 'clock930': '๐ค', 'closed_book': '๐', 'closed_lock_with_key': '๐', 'closed_umbrella': '๐', 'cloud': 'โ๏ธ', 'clubs': 'โฃ๏ธ', 'cn': '๐จ๐ณ', 'cocktail': '๐ธ', 'coffee': 'โ๏ธ', 'cold_sweat': '๐ฐ', 'collision': '๐ฅ', 'computer': '๐ป', 'confetti_ball': '๐', 'confounded': '๐', 'confused': '๐', 'congratulations': 'ใ', 'construction': '๐ง', 'construction_worker': '๐ท', 'convenience_store': '๐ช', 'cookie': '๐ช', 'cool': '๐', 'cop': '๐ฎ', 'copyright': 'ยฉ๏ธ', 'corn': '๐ฝ', 'couple': '๐ซ', 'couple_with_heart': '๐', 'couplekiss': '๐', # kiss 'cow': '๐ฎ', 'cow2': '๐', 'credit_card': '๐ณ', 'crescent_moon': '๐', 'crocodile': '๐', 'crossed_flags': '๐', 'crown': '๐', 'cry': '๐ข', 'crying_cat_face': '๐ฟ', 'crystal_ball': '๐ฎ', 'cupid': '๐', 'curly_loop': 'โฐ', 'currency_exchange': '๐ฑ', 'curry': '๐', 'custard': '๐ฎ', 'customs': '๐', 'cyclone': '๐', 'dancer': '๐', 'dancers': '๐ฏ', 'dango': '๐ก', 'dart': '๐ฏ', 'dash': '๐จ', 'date': '๐ ', 'de': '๐ฉ๐ช', 'deciduous_tree': '๐ณ', 'department_store': '๐ฌ', 'diamond_shape_with_a_dot_inside': '๐ ', 'diamonds': 'โฆ๏ธ', 'disappointed': '๐', 'disappointed_relieved': '๐ฅ', 'dizzy': '๐ซ', 'dizzy_face': '๐ต', 'do_not_litter': '๐ฏ', 'dog': '๐ถ', 'dog2': '๐', 'dollar': '๐ต', 'dolls': '๐', 'dolphin': '๐ฌ', 'donut': '๐ฉ', # it's doughnut, you 'muricans 'door': '๐ช', 'doughnut': '๐ฉ', 'dragon': '๐', 'dragon_face': '๐ฒ', 'dress': '๐', 'dromedary_camel': '๐ช', 'droplet': '๐ง', 'dvd': '๐', 'e-mail': '๐ง', 'ear': '๐', 'ear_of_rice': '๐พ', 'earth_africa': '๐', 'earth_americas': '๐', 'earth_asia': '๐', 'egg': '๐ฅ', 'eggplant': '๐', 'eight': '8๏ธโฃ', 'eight_pointed_black_star': 'โด๏ธ', 'eight_spoked_asterisk': 'โณ๏ธ', 'electric_plug': '๐', 'elephant': '๐', 'email': 'โ๏ธ', 'end': '๐', 'envelope': 'โ๏ธ', 'es': '๐ช๐ธ', 'euro': '๐ถ', 'european_castle': '๐ฐ', 'european_post_office': '๐ค', 'evergreen_tree': '๐ฒ', 'exclamation': 'โ๏ธ', 'expressionless': '๐', 'eyeglasses': '๐', 'eyes': '๐', 'facepunch': '๐', 'factory': '๐ญ', 'fallen_leaf': '๐', 'family': '๐ช', 'fast_forward': 'โฉ', 'fax': '๐ ', 'fearful': '๐จ', 'feet': '๐พ', 'ferris_wheel': '๐ก', 'file_folder': '๐', 'fire': '๐ฅ', 'fire_engine': '๐', 'fireworks': '๐', 'first_quarter_moon': '๐', 'first_quarter_moon_with_face': '๐', 'fish': '๐', 'fish_cake': '๐ฅ', 'fishing_pole_and_fish': '๐ฃ', 'fist': 'โ', 'five': '5๏ธโฃ', 'flags': '๐', 'flashlight': '๐ฆ', 'floppy_disk': '๐พ', 'flower_playing_cards': '๐ด', 'flushed': '๐ณ', 'foggy': '๐', 'football': '๐', 'fork_and_knife': '๐ด', 'fountain': 'โฒ๏ธ', 'four': '4๏ธโฃ', 'four_leaf_clover': '๐', 'fr': '๐ซ๐ท', 'free': '๐', 'fried_shrimp': '๐ค', 'fries': '๐', 'frog': '๐ธ', 'frowning': '๐ฆ', 'fu': '๐', 'fuelpump': 'โฝ๏ธ', 'full_moon': '๐', 'full_moon_with_face': '๐', 'game_die': '๐ฒ', 'gb': '๐ฌ๐ง', 'gem': '๐', 'gemini': 'โ๏ธ', 'ghost': '๐ป', 'gift': '๐', 'gift_heart': '๐', 'girl': '๐ง', 'globe_with_meridians': '๐', 'goat': '๐', 'golf': 'โณ๏ธ', 'grapes': '๐', 'green_apple': '๐', 'green_book': '๐', 'green_heart': '๐', 'grey_exclamation': 'โ', 'grey_question': 'โ', 'grimacing': '๐ฌ', 'grin': '๐', 'grinning': '๐', 'guardsman': '๐', 'guitar': '๐ธ', 'gun': '๐ซ', 'haircut': '๐', 'hamburger': '๐', 'hammer': '๐จ', 'hamster': '๐น', 'hand': 'โ', 'handbag': '๐', 'hankey': '๐ฉ', 'hash': '#๏ธโฃ', 'hatched_chick': '๐ฅ', 'hatching_chick': '๐ฃ', 'headphones': '๐ง', 'hear_no_evil': '๐', 'heart': 'โค๏ธ', 'heart_decoration': '๐', 'heart_eyes': '๐', 'heart_eyes_cat': '๐ป', 'heartbeat': '๐', 'heartpulse': '๐', 'hearts': 'โฅ๏ธ', 'heavy_check_mark': 'โ๏ธ', 'heavy_division_sign': 'โ', 'heavy_dollar_sign': '๐ฒ', 'heavy_exclamation_mark': 'โ๏ธ', 'heavy_minus_sign': 'โ', 'heavy_multiplication_x': 'โ๏ธ', 'heavy_plus_sign': 'โ', 'helicopter': '๐', 'herb': '๐ฟ', 'hibiscus': '๐บ', 'high_brightness': '๐', 'high_heel': '๐ ', 'hocho': '๐ช', 'honey_pot': '๐ฏ', 'honeybee': '๐', 'horse': '๐ด', 'horse_racing': '๐', 'hospital': '๐ฅ', 'hotel': '๐จ', 'hotsprings': 'โจ๏ธ', 'hourglass': 'โ๏ธ', 'hourglass_flowing_sand': 'โณ', 'house': '๐ ', 'house_with_garden': '๐ก', 'hushed': '๐ฏ', 'ice_cream': '๐จ', 'icecream': '๐ฆ', 'id': '๐', 'ideograph_advantage': '๐', 'imp': '๐ฟ', 'inbox_tray': '๐ฅ', 'incoming_envelope': '๐จ', 'information_desk_person': '๐', 'information_source': 'โน๏ธ', 'innocent': '๐', 'interrobang': 'โ๏ธ', 'iphone': '๐ฑ', 'it': '๐ฎ๐น', 'izakaya_lantern': '๐ฎ', 'jack_o_lantern': '๐', 'japan': '๐พ', 'japanese_castle': '๐ฏ', 'japanese_goblin': '๐บ', 'japanese_ogre': '๐น', 'jeans': '๐', 'joy': '๐', 'joy_cat': '๐น', 'jp': '๐ฏ๐ต', 'key': '๐', 'keycap_ten': '๐', 'kimono': '๐', 'kiss': '๐', 'kissing': '๐', 'kissing_cat': '๐ฝ', 'kissing_closed_eyes': '๐', 'kissing_face': '๐', # aparently, the shortcode is just 'kissing' 'kissing_heart': '๐', 'kissing_smiling_eyes': '๐', 'koala': '๐จ', 'koko': '๐', 'kr': '๐ฐ๐ท', 'large_blue_circle': '๐ต', 'large_blue_diamond': '๐ท', 'large_orange_diamond': '๐ถ', 'last_quarter_moon': '๐', 'last_quarter_moon_with_face': '๐', 'laughing': '๐', 'leaves': '๐', 'ledger': '๐', 'left_luggage': '๐ ', 'left_right_arrow': 'โ๏ธ', 'leftwards_arrow_with_hook': 'โฉ๏ธ', 'lemon': '๐', 'leo': 'โ๏ธ', 'leopard': '๐', 'libra': 'โ๏ธ', 'light_rail': '๐', 'link': '๐', 'lips': '๐', 'lipstick': '๐', 'lock': '๐', 'lock_with_ink_pen': '๐', 'lollipop': '๐ญ', 'loop': 'โฟ', 'loudspeaker': '๐ข', 'love_hotel': '๐ฉ', 'love_letter': '๐', 'low_brightness': '๐ ', 'm': 'โ๏ธ', 'mag': '๐', 'mag_right': '๐', 'mahjong': '๐๏ธ', 'mailbox': '๐ซ', 'mailbox_closed': '๐ช', 'mailbox_with_mail': '๐ฌ', 'mailbox_with_no_mail': '๐ญ', 'man': '๐จ', 'man_with_gua_pi_mao': '๐ฒ', 'man_with_turban': '๐ณ', 'mans_shoe': '๐', 'maple_leaf': '๐', 'mask': '๐ท', 'massage': '๐', 'meat_on_bone': '๐', 'mega': '๐ฃ', 'melon': '๐', 'memo': '๐', 'mens': '๐น', 'metal': '๐ค', 'metro': '๐', 'microphone': '๐ค', 'microscope': '๐ฌ', 'milky_way': '๐', 'minibus': '๐', 'minidisc': '๐ฝ', 'mobile_phone_off': '๐ด', 'money_with_wings': '๐ธ', 'moneybag': '๐ฐ', 'monkey': '๐', 'monkey_face': '๐ต', 'monorail': '๐', 'mortar_board': '๐', 'mount_fuji': '๐ป', 'mountain_bicyclist': '๐ต', 'mountain_cableway': '๐ ', 'mountain_railway': '๐', 'mouse': '๐ญ', 'mouse2': '๐', 'movie_camera': '๐ฅ', 'moyai': '๐ฟ', 'muscle': '๐ช', 'mushroom': '๐', 'musical_keyboard': '๐น', 'musical_note': '๐ต', 'musical_score': '๐ผ', 'mute': '๐', 'nail_care': '๐ ', 'name_badge': '๐', 'necktie': '๐', 'negative_squared_cross_mark': 'โ', 'neutral_face': '๐', 'new': '๐', 'new_moon': '๐', 'new_moon_with_face': '๐', 'newspaper': '๐ฐ', 'ng': '๐', 'nine': '9๏ธโฃ', 'no_bell': '๐', 'no_bicycles': '๐ณ', 'no_entry': 'โ๏ธ', 'no_entry_sign': '๐ซ', 'no_good': '๐ ', 'no_mobile_phones': '๐ต', 'no_mouth': '๐ถ', 'no_pedestrians': '๐ท', 'no_smoking': '๐ญ', 'non-potable_water': '๐ฑ', 'nose': '๐', 'notebook': '๐', 'notebook_with_decorative_cover': '๐', 'notes': '๐ถ', 'nut_and_bolt': '๐ฉ', 'o': 'โญ๏ธ', 'o2': '๐ พ๏ธ', 'ocean': '๐', 'octopus': '๐', 'oden': '๐ข', 'office': '๐ข', 'ok': '๐', 'ok_hand': '๐', 'ok_woman': '๐', 'older_man': '๐ด', 'older_woman': '๐ต', 'on': '๐', 'oncoming_automobile': '๐', 'oncoming_bus': '๐', 'oncoming_police_car': '๐', 'oncoming_taxi': '๐', 'one': '1๏ธโฃ', 'open_file_folder': '๐', 'open_hands': '๐', 'open_mouth': '๐ฎ', 'ophiuchus': 'โ', 'orange_book': '๐', 'outbox_tray': '๐ค', 'ox': '๐', 'package': '๐ฆ', 'page_facing_up': '๐', 'page_with_curl': '๐', 'pager': '๐', 'palm_tree': '๐ด', 'panda_face': '๐ผ', 'paperclip': '๐', 'parking': '๐ ฟ๏ธ', 'part_alternation_mark': 'ใฝ', 'partly_sunny': 'โ ๏ธ', 'passport_control': '๐', 'paw_prints': '๐พ', 'peach': '๐', 'pear': '๐', 'pencil': '๐', 'pencil2': 'โ๏ธ', 'penguin': '๐ง', 'pensive': '๐', 'performing_arts': '๐ญ', 'persevere': '๐ฃ', 'person_frowning': '๐', 'person_with_blond_hair': '๐ฑ', 'person_with_pouting_face': '๐', 'phone': 'โ๏ธ', 'pig': '๐ท', 'pig2': '๐', 'pig_nose': '๐ฝ', 'pill': '๐', 'pineapple': '๐', 'pisces': 'โ๏ธ', 'pizza': '๐', 'plus1': '๐', # an alias to +1 'point_down': '๐', 'point_left': '๐', 'point_right': '๐', 'point_up': 'โ๏ธ', 'point_up_2': '๐', 'police_car': '๐', 'poodle': '๐ฉ', 'poop': '๐ฉ', 'post_office': '๐ฃ', 'postal_horn': '๐ฏ', 'postbox': '๐ฎ', 'potable_water': '๐ฐ', 'pouch': '๐', 'poultry_leg': '๐', 'pound': '๐ท', 'pouting_cat': '๐พ', 'pray': '๐', 'princess': '๐ธ', 'punch': '๐', 'purple_heart': '๐', 'purse': '๐', 'pushpin': '๐', 'put_litter_in_its_place': '๐ฎ', 'question': 'โ', 'rabbit': '๐ฐ', 'rabbit2': '๐', 'racehorse': '๐', 'radio': '๐ป', 'radio_button': '๐', 'rage': '๐ก', 'railway_car': '๐', 'rainbow': '๐', 'raised_hand': 'โ', 'raised_hands': '๐', 'raising_hand': '๐', 'ram': '๐', 'ramen': '๐', 'rat': '๐', 'recycle': 'โป๏ธ', 'red_car': '๐', 'red_circle': '๐ด', 'registered': 'ยฎ๏ธ', 'relaxed': 'โบ๏ธ', 'relieved': '๐', 'repeat': '๐', 'repeat_one': '๐', 'restroom': '๐ป', 'revolving_hearts': '๐', 'rewind': 'โช', 'ribbon': '๐', 'rice': '๐', 'rice_ball': '๐', 'rice_cracker': '๐', 'rice_scene': '๐', 'ring': '๐', 'rocket': '๐', 'roller_coaster': '๐ข', 'rooster': '๐', 'rose': '๐น', 'rotating_light': '๐จ', 'round_pushpin': '๐', 'rowboat': '๐ฃ', 'ru': '๐ท๐บ', 'rugby_football': '๐', 'runner': '๐', 'running': '๐', 'running_shirt_with_sash': '๐ฝ', 'sa': '๐', 'sagittarius': 'โ๏ธ', 'sailboat': 'โต๏ธ', 'sake': '๐ถ', 'sandal': '๐ก', 'santa': '๐ ', 'satellite': '๐ก', 'satisfied': '๐', 'saxophone': '๐ท', 'school': '๐ซ', 'school_satchel': '๐', 'scissors': 'โ๏ธ', 'scorpius': 'โ๏ธ', 'scream': '๐ฑ', 'scream_cat': '๐', 'scroll': '๐', 'seat': '๐บ', 'secret': 'ใ', 'see_no_evil': '๐', 'seedling': '๐ฑ', 'seven': '7๏ธโฃ', 'shaved_ice': '๐ง', 'sheep': '๐', 'shell': '๐', 'ship': '๐ข', 'shirt': '๐', 'shit': '๐ฉ', 'shoe': '๐', 'shower': '๐ฟ', 'signal_strength': '๐ถ', 'simple_smile': '๐', # slightly smiling face 'six': '6๏ธโฃ', 'six_pointed_star': '๐ฏ', 'ski': '๐ฟ', 'skull': '๐', 'sleeping': '๐ด', 'sleepy': '๐ช', 'slot_machine': '๐ฐ', 'small_blue_diamond': '๐น', 'small_orange_diamond': '๐ธ', 'small_red_triangle': '๐บ', 'small_red_triangle_down': '๐ป', 'smile': '๐', 'smile_cat': '๐ธ', 'smiley': '๐', 'smiley_cat': '๐บ', 'smiling_imp': '๐', 'smirk': '๐', 'smirk_cat': '๐ผ', 'smoking': '๐ฌ', 'snail': '๐', 'snake': '๐', 'snowboarder': '๐', 'snowflake': 'โ๏ธ', 'snowman': 'โ๏ธ', 'sob': '๐ญ', 'soccer': 'โฝ๏ธ', 'soon': '๐', 'sos': '๐', 'sound': '๐', 'space_invader': '๐พ', 'spades': 'โ ๏ธ', 'spaghetti': '๐', 'sparkle': 'โ๏ธ', 'sparkler': '๐', 'sparkles': 'โจ', 'sparkling_heart': '๐', 'speak_no_evil': '๐', 'speaker': '๐', 'speech_balloon': '๐ฌ', 'speedboat': '๐ค', 'star': 'โญ๏ธ', 'star2': '๐', 'stars': '๐ ', 'station': '๐', 'statue_of_liberty': '๐ฝ', 'steam_locomotive': '๐', 'stew': '๐ฒ', 'straight_ruler': '๐', 'strawberry': '๐', 'stuck_out_tongue': '๐', 'stuck_out_tongue_closed_eyes': '๐', 'stuck_out_tongue_winking_eye': '๐', 'sun_with_face': '๐', 'sunflower': '๐ป', 'sunglasses': '๐', 'sunny': 'โ๏ธ', 'sunrise': '๐ ', 'sunrise_over_mountains': '๐', 'surfer': '๐', 'sushi': '๐ฃ', 'suspension_railway': '๐', 'sweat': '๐', 'sweat_drops': '๐ฆ', 'sweat_smile': '๐ ', 'sweet_potato': '๐ ', 'swimmer': '๐', 'symbols': '๐ฃ', 'syringe': '๐', 'tada': '๐', 'tanabata_tree': '๐', 'tangerine': '๐', 'taurus': 'โ๏ธ', 'taxi': '๐', 'tea': '๐ต', 'telephone': 'โ๏ธ', 'telephone_receiver': '๐', 'telescope': '๐ญ', 'tennis': '๐พ', 'tent': 'โบ๏ธ', 'thought_balloon': '๐ญ', 'three': '3๏ธโฃ', 'thumbsdown': '๐', 'thumbsup': '๐', 'ticket': '๐ซ', 'tiger': '๐ฏ', 'tiger2': '๐ ', 'tired_face': '๐ซ', 'tm': 'โข๏ธ', 'toilet': '๐ฝ', 'tokyo_tower': '๐ผ', 'tomato': '๐ ', 'tongue': '๐ ', 'top': '๐', 'tophat': '๐ฉ', 'tractor': '๐', 'traffic_light': '๐ฅ', 'train': '๐', 'train2': '๐', 'tram': '๐', 'triangular_flag_on_post': '๐ฉ', 'triangular_ruler': '๐', 'trident': '๐ฑ', 'triumph': '๐ค', 'trolleybus': '๐', 'trophy': '๐', 'tropical_drink': '๐น', 'tropical_fish': '๐ ', 'truck': '๐', 'trumpet': '๐บ', 'tshirt': '๐', 'tulip': '๐ท', 'turtle': '๐ข', 'tv': '๐บ', 'twisted_rightwards_arrows': '๐', 'two': '2๏ธโฃ', 'two_hearts': '๐', 'two_men_holding_hands': '๐ฌ', 'two_women_holding_hands': '๐ญ', 'u5272': '๐น', 'u5408': '๐ด', 'u55b6': '๐บ', 'u6307': '๐ฏ', 'u6708': '๐ท', 'u6709': '๐ถ', 'u6e80': '๐ต', 'u7121': '๐', 'u7533': '๐ธ', 'u7981': '๐ฒ', 'u7a7a': '๐ณ', 'uk': '๐ฌ๐ง', 'umbrella': 'โ๏ธ', 'unamused': '๐', 'underage': '๐', 'unlock': '๐', 'up': '๐', 'us': '๐บ๐ธ', 'v': 'โ๏ธ', 'vertical_traffic_light': '๐ฆ', 'vhs': '๐ผ', 'vibration_mode': '๐ณ', 'video_camera': '๐น', 'video_game': '๐ฎ', 'violin': '๐ป', 'virgo': 'โ๏ธ', 'volcano': '๐', 'vs': '๐', 'walking': '๐ถ', 'waning_crescent_moon': '๐', 'waning_gibbous_moon': '๐', 'warning': 'โ ๏ธ', 'watch': 'โ๏ธ', 'water_buffalo': '๐', 'watermelon': '๐', 'wave': '๐', 'wavy_dash': 'ใฐ๏ธ', 'waxing_crescent_moon': '๐', 'waxing_gibbous_moon': '๐', 'wc': '๐พ', 'weary': '๐ฉ', 'wedding': '๐', 'whale': '๐ณ', 'whale2': '๐', 'wheelchair': 'โฟ๏ธ', 'white_check_mark': 'โ ', 'white_circle': 'โช๏ธ', 'white_flower': '๐ฎ', 'white_large_square': 'โฌ๏ธ', 'white_medium_small_square': 'โฝ๏ธ', 'white_medium_square': 'โป๏ธ', 'white_small_square': 'โซ๏ธ', 'white_square_button': '๐ณ', 'wind_chime': '๐', 'wine_glass': '๐ท', 'wink': '๐', 'wolf': '๐บ', 'woman': '๐ฉ', 'womans_clothes': '๐', 'womans_hat': '๐', 'womens': '๐บ', 'worried': '๐', 'wrench': '๐ง', 'x': 'โ', 'yellow_heart': '๐', 'yen': '๐ด', 'yum': '๐', 'zap': 'โก๏ธ', 'zero': '0๏ธโฃ', 'zzz': '๐ค', } def _replace_emoji(line): for shortcode, characters in _emoji_replacement_mapping.items(): line = line.replace(':{}:'.format(shortcode), characters) return line def _unreplace_emoji(line): # replace sequences before single characters for shortcode, character in sorted( _emoji_replacement_mapping.items(), key=lambda t: len(t[1]), reverse=True ): line = line.replace(character, ':{}:'.format(shortcode)) return line def do_the_thing(func): conn = op.get_bind() for table_name, column_name in (('posts', 'content'), ('messages', 'message')): table = sa.Table( table_name, sa.MetaData(), sa.Column('id', sa.Integer, primary_key=True), sa.Column(column_name, sa.String) ) for row in conn.execute(table.select()): content = getattr(row, column_name) new_content = func(content) if not new_content == content: conn.execute( table.update().where( table.c.id == row.id ).values(**{column_name: new_content}) ) def upgrade(): do_the_thing(_replace_emoji) def downgrade(): do_the_thing(_unreplace_emoji)