<commit_before>import logging
log = logging.getLogger(__name__)

import urllib
import json
import ircbot.plugin
import socket


class WeatherPlugin(ircbot.plugin.Plugin):
	@ircbot.plugin.command('weather')
	def weather(self, cmd):
		api_key = self.bot.config.get('wunderground_api_key')
		if not api_key:
			log.warning('Wunderground API key not set on config.yml!')
			return

		url = 'http://api.wunderground.com/api/{}/geolookup/conditions/q/{}/{}.json'
			.format(api_key, cmd.args[1], cmd.args[0])

		if len(cmd.args) < 2:
			return 'Usage: !weather city state/country'
		try:
			response = urllib.request.urlopen(url, timeout=2).read()
		except (urllib.error.URLError, socket.timeout) as e:
			return 'An HTTP error occured, try again later!'

		data = json.loads(response.decode('utf-8'))

		try:
			city = data['location']['city']
			state = data['location']['state']<commit_msg>that's not valid python<commit_after>import logging
log = logging.getLogger(__name__)

import urllib
import json
import ircbot.plugin
import socket


class WeatherPlugin(ircbot.plugin.Plugin):
	@ircbot.plugin.command('weather')
	def weather(self, cmd):
		api_key = self.bot.config.get('wunderground_api_key')
		if not api_key:
			log.warning('Wunderground API key not set on config.yml!')
			return

		url = 'http://api.wunderground.com/api/{}/geolookup/conditions/q/{}/{}.json'.format(
			api_key, cmd.args[1], cmd.args[0])

		if len(cmd.args) < 2:
			return 'Usage: !weather city state/country'
		try:
			response = urllib.request.urlopen(url, timeout=2).read()
		except (urllib.error.URLError, socket.timeout) as e:
			return 'An HTTP error occured, try again later!'

		data = json.loads(response.decode('utf-8'))

		try:
			city = data['location']['city']
			state = data['location']['state']
{'fraction_non_alphanumeric': 0.1507847533632287, 'fraction_numerical': 0.005605381165919282, 'mean_word_length': 4.475460122699387, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '5067027', 'n_tokens_mistral': 685, 'n_tokens_neox': 611, 'n_words': 138}