<commit_before>using System;
using System.Net;
using System.IO;
using System.Xml.Linq;
using System.Linq;
using System.Collections.Generic;

namespace BestWeatherEver.Core
{
	public class YrNoManager
	{
		private WeatherData lastFetchedWeatherData;

		public YrNoManager ()
		{

		}

		public String FetchCurrentWeather ()
		{
			String xml = fetchXML ();
			if (xml != null)
			{
				lastFetchedWeatherData = mapXMLToWeatherData (xml);
				if (lastFetchedWeatherData != null)
				{
					return String.Format (@"Temp: {0} Wind: {1} Weather: {2}", lastFetchedWeatherData.Temperature, lastFetchedWeatherData.WindDirection, lastFetchedWeatherData.Type);
				}
			}
			return "No data";
		}

		private String fetchXML ()
		{
			var request = HttpWebRequest.Create ("http://www.yr.no/place/Sweden/V%C3%A4stra%20G%C3%B6taland/G%C3%B6teborg/forecast.xml");
			request.ContentType = "application/xml";
			request.Method = "GET";

			using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
			{
				if (response.StatusCode != HttpStatusCode.OK)
					Console.Out.WriteLine ("Error fetching data. Server returned status code: {0}", response.StatusCode);
				using (StreamReader reader = new StreamReader(response.GetResponseStream()))
				{
					var content = reader.ReadToEnd ();
					if (string.IsNullOrWhiteSpace (content))
					{
						Console.Out.WriteLine ("Response contained empty body...");
						return null;
					}
					else
					{
						Console.Out.WriteLine ("Response Body: \r\n {0}", content);
						return content;
					}

				
				}
			}
		}

		private WeatherData mapXMLToWeatherData (string xml)
		{
			XDocument doc = XDocument.Parse (xml);
			var weatherList = doc.Root.Descendants ("time")
				.Select (x => new WeatherData () {
				Type = x.Element ("symbol").Attribute ("number").Value,
				WindDirection = x.Element ("windDirection").Attribute ("code").Value,
				Temperature = x.Element ("temperature").Attribute ("value").Value,
			});

			return weatherList.First ();
		}
	}
}

<commit_msg>small changes in FetchCurrentWeather in Core<commit_after>using System;
using System.Net;
using System.IO;
using System.Xml.Linq;
using System.Linq;
using System.Collections.Generic;

namespace BestWeatherEver.Core
{
	public class YrNoManager
	{
		private WeatherData lastFetchedWeatherData;

		public YrNoManager ()
		{

		}

		public String FetchCurrentWeather ()
		{
			String xml = fetchXML ();
			if (xml == null)
			{
				return null;
			}
			lastFetchedWeatherData = mapXMLToWeatherData (xml);
			if (lastFetchedWeatherData == null)
			{
				return null;
			}

			return String.Format (@"Temp: {0} Wind: {1} Weather: {2}", lastFetchedWeatherData.Temperature, lastFetchedWeatherData.WindDirection, lastFetchedWeatherData.Type);
		}

		private String fetchXML ()
		{
			var request = HttpWebRequest.Create ("http://www.yr.no/place/Sweden/V%C3%A4stra%20G%C3%B6taland/G%C3%B6teborg/forecast.xml");
			request.ContentType = "application/xml";
			request.Method = "GET";

			using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
			{
				if (response.StatusCode != HttpStatusCode.OK)
					Console.Out.WriteLine ("Error fetching data. Server returned status code: {0}", response.StatusCode);
				using (StreamReader reader = new StreamReader(response.GetResponseStream()))
				{
					var content = reader.ReadToEnd ();
					if (string.IsNullOrWhiteSpace (content))
					{
						Console.Out.WriteLine ("Response contained empty body...");
						return null;
					}
					else
					{
						Console.Out.WriteLine ("Response Body: \r\n {0}", content);
						return content;
					}
				}
			}
		}

		private WeatherData mapXMLToWeatherData (string xml)
		{
			XDocument doc = XDocument.Parse (xml);
			var weatherList = doc.Root.Descendants ("time")
				.Select (x => new WeatherData () {
				Type = x.Element ("symbol").Attribute ("number").Value,
				WindDirection = x.Element ("windDirection").Attribute ("code").Value,
				Temperature = x.Element ("temperature").Attribute ("value").Value,
			});

			return weatherList.First ();
		}
	}
}


{'fraction_non_alphanumeric': 0.12698801076584293, 'fraction_numerical': 0.006361634450697333, 'mean_word_length': 3.497249724972497, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 14}, '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': '6798757', 'n_tokens_mistral': 1574, 'n_tokens_neox': 1276, 'n_words': 284}