<commit_before>import plugintypes
import sys

sys.path.append('./plugins')

from py3owm import OpenWeatherMap

OWM_icon_emoji_map = {
    "01d": u'\U0001F31E',
    "02d": u'\U000026C5',
    "03d": u'\U00002601',
    "03d": u'\U00002601',
    "09d": u'\U0001F302',
    "10d": u'\U00002614',
    "11d": u'\U000026A1',
    "13d": u'\U00002744',
    "50d": u'\U0001F301'
}

def __get_emoji(icon):
    if icon in OWM_icon_emoji_map.keys():
        return OWM_icon_emoji_map[icon]
    return u'\U00002610'

class WeatherPlugin(plugintypes.TelegramPlugin):
    """
    Weather
    """

    patterns = [
        "^!weather? ([0-9]{5})"
    ]

    usage = [
        "!weather <zip code>"
    ]

    def activate_plugin(self):
        if not self.has_option("api key"):
            self.write_option("api key", "")
        if not self.has_option("units"):
            self.write_option("units", "metric")
        
        api_key = self.read_option("api key")
        units = self.read_option("units")

        self.owm = OpenWeatherMap(api_key, units)


    def run(self, msg, matches):
        w = self.owm.weather_data(zipcode=matches.group(1))
        if w:
            emoji = __get_emoji(w.icon)
            report = "{} ({}) {}{}\n{} {}".format(w.name, w.country, w.temp, w.unit_symbol, w.description, emoji)
            return report
        return "Error getting weather data"<commit_msg>Adding formatting to allow emoji to be sent<commit_after>import plugintypes
import sys

sys.path.append('./plugins')

from py3owm import OpenWeatherMap

OWM_icon_emoji_map = {
    "01d": u'\U0001F31E',
    "02d": u'\U000026C5',
    "03d": u'\U00002601',
    "03d": u'\U00002601',
    "09d": u'\U0001F302',
    "10d": u'\U00002614',
    "11d": u'\U000026A1',
    "13d": u'\U00002744',
    "50d": u'\U0001F301'
}

class WeatherPlugin(plugintypes.TelegramPlugin):
    """
    Weather
    """

    patterns = [
        "^!weather? ([0-9]{5})"
    ]

    usage = [
        "!weather <zip code>"
    ]

    def activate_plugin(self):
        if not self.has_option("api key"):
            self.write_option("api key", "")
        if not self.has_option("units"):
            self.write_option("units", "metric")

        api_key = self.read_option("api key")
        units = self.read_option("units")

        self.owm = OpenWeatherMap(api_key, units)

    def __get_emoji(self, icon):
        if icon in OWM_icon_emoji_map.keys():
            return OWM_icon_emoji_map[icon]
        return u'\U00002610'


    def run(self, msg, matches):
        w = self.owm.weather_data(zipcode=matches.group(1))
        if w:
            emoji = self.__get_emoji(w.icon)
            report = u"{} ({}) {}{}\n{} {}".format(w.name, w.country, w.temp, w.unit_symbol, w.description, emoji)
            return report
        return "Error getting weather data"
{'fraction_non_alphanumeric': 0.15722379603399433, 'fraction_numerical': 0.06869688385269122, 'mean_word_length': 2.4876543209876543, 'pattern_counts': {'":': 18, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4509320', 'n_tokens_mistral': 1155, 'n_tokens_neox': 1021, 'n_words': 196}