<commit_before>//
//  WeatherData.swift
//  weathery
//
//  Created by <NAME> on 1/7/17.
//  Copyright © 2017 <NAME>. All rights reserved.
//

import Foundation
import SwiftyJSON

struct WeatherData {
    
    enum DataError: Error {
        case invalidJSON(String)
    }

    let city: String
    let temperature: Double
    let cloud: Int
    let windSpeed: Double
    let humidity: Int
    
    init(_ data: Data) throws {
        let json = JSON(data: data)
        guard
            let kelvin = json["main"]["temp"].double,
            let city = json["name"].string,
            let cloud = json["clouds"]["all"].int,
            let windSpeed = json["wind"]["speed"].double,
            let humidity = json["main"]["humidity"].int
            
            else {
                
            throw DataError.invalidJSON(json.description)
        }
        
        self.city = city
        self.temperature = kelvin - 273.15 //Kelvin to Celcius
        self.cloud = cloud
        self.windSpeed = windSpeed
        self.humidity = humidity
    }
}<commit_msg>A test commit<commit_after>//
//  WeatherData.swift
//  weathery
//
//  Created by <NAME> on 1/7/17.
//  Copyright © 2017 <NAME>. All rights reserved.
//

import Foundation
import SwiftyJSON

struct WeatherData {
    
    enum DataError: Error {
        case invalidJSON(String)
    }

    let city: String
    let temperature: Double
    let cloud: Int
    let windSpeed: Double
    let humidity: Int
    
    init(_ data: Data) throws {
        let json = JSON(data: data)
        guard
            let kelvin = json["main"]["temp"].double,
            let city = json["name"].string,
            let cloud = json["clouds"]["all"].int,
            let windSpeed = json["wind"]["speed"].double,
            let humidity = json["main"]["humidity"].int
            
            else {
            throw DataError.invalidJSON(json.description)
        }
        
        self.city = city
        self.temperature = kelvin - 273.15 //Kelvin to Celcius
        self.cloud = cloud
        self.windSpeed = windSpeed
        self.humidity = humidity
    }
}
{'fraction_non_alphanumeric': 0.1123171307220387, 'fraction_numerical': 0.012269938650306749, 'mean_word_length': 1.7604166666666667, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '6408144', 'n_tokens_mistral': 631, 'n_tokens_neox': 611, 'n_words': 166}