<commit_before>import sys
import urllib.request
import xml.etree.ElementTree as elm_tree
'''
https://docs.python.org/2/library/xml.etree.elementtree.html
'''

if __name__ == '__main__':

    if len(sys.argv) > 2:
        sys.exit('too many parameters!')

    #get weather situation in dublin
    options = {'location':'EIXX0014', 'unit':'m'}

    if len(sys.argv) > 1: 
        options['location'] = sys.argv[1]

    weather_url = 'http://wxdata.weather.com/wxdata/weather/local/{location}?cc=*&unit={unit}&dayf=2'
    weather_xml = urllib.request.urlopen(weather_url.format(**options))
    #parse xml
    weather_root = elm_tree.fromstring(weather_xml.read())

    #extract relevant data
    temp = weather_root.find('cc/tmp').text
    flik = weather_root.find('cc/flik').text
 
    weather_data = {}
    tomorrow = {}
    weather_data['Location'] = weather_root.find('cc/obst').text
    weather_data['Temperature'] = temp

    if temp != flik:<commit_msg>Aggiunto path per esecuzione script<commit_after>#!/usr/bin/python
import sys
import urllib.request
import xml.etree.ElementTree as elm_tree
'''
https://docs.python.org/2/library/xml.etree.elementtree.html
'''

if __name__ == '__main__':

    if len(sys.argv) > 2:
        sys.exit('too many parameters!')

    #get weather situation in dublin
    options = {'location':'EIXX0014', 'unit':'m'}

    if len(sys.argv) > 1: 
        options['location'] = sys.argv[1]

    weather_url = 'http://wxdata.weather.com/wxdata/weather/local/{location}?cc=*&unit={unit}&dayf=2'
    try:
        weather_xml = urllib.request.urlopen(weather_url.format(**options))
        #parse xml
        weather_root = elm_tree.fromstring(weather_xml.read())
    except urllib.error.URLError:
        print('Connection error')
        sys.exit(-1) 

    #extract relevant data
    temp = weather_root.find('cc/tmp').text
    flik = weather_root.find('cc/flik').text
 
    weather_data = {}
    tomorrow = {}
    weather_data['Location'] = weather_root.find('cc/obst').text
    weather_data['Temperature'] = temp

    if temp != flik:
{'fraction_non_alphanumeric': 0.15447941888619854, 'fraction_numerical': 0.009200968523002421, 'mean_word_length': 3.491304347826087, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 10}, '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': '1631561', 'n_tokens_mistral': 734, 'n_tokens_neox': 689, 'n_words': 120}