<commit_before>import Foundation
import Jay

private typealias JayType = JsonValue

public enum Json: Equatable {
    
    case NullValue
    case BooleanValue(Bool)
    case NumberValue(Double)
    case StringValue(String)
    case ArrayValue([Json])
    case ObjectValue([String:Json])
    
    // MARK: Initialization
    
    public init(_ value: Bool) {
        self = .BooleanValue(value)
    }
    
    public init(_ value: Double) {
        self = .NumberValue(value)
    }
    
    public init(_ value: String) {
        self = .StringValue(value)
    }
    
    public init(_ value: [Json]) {
        self = .ArrayValue(value)
    }
    
    public init(_ value: [String : Json]) {
        self = .ObjectValue(value)
    }
    
    public init<T: SignedIntegerType>(_ value: T) {
        self = .NumberValue(Double(value.toIntMax()))
    }
    
    public init<T: UnsignedIntegerType>(_ value: T) {
        self = .NumberValue(Double(value.toUIntMax()))
    }
}

// MARK: Mapping between Json and Jay types

extension JayType {
    private init(_ json: Json) {
        switch json {
        case .ObjectValue(let dict):
            var newDict = JsonObject()
            for (k,v) in dict {
                newDict[k] = JayType(v)
            }
            self = .Object(newDict)
        case .ArrayValue(let arr):
            var newArray = JsonArray()
            for i in arr {
                newArray.append(JayType(i))
            }
            self = .Array(newArray)<commit_msg>fixing json int initializer #111<commit_after>import Foundation
import Jay

private typealias JayType = JsonValue

public enum Json: Equatable {
    
    case NullValue
    case BooleanValue(Bool)
    case NumberValue(Double)
    case StringValue(String)
    case ArrayValue([Json])
    case ObjectValue([String:Json])
    
    // MARK: Initialization
    
    public init(_ value: Bool) {
        self = .BooleanValue(value)
    }
    
    public init(_ value: Double) {
        self = .NumberValue(value)
    }
    
    public init(_ value: Int) {
        let double = Double(value)
        self.init(double)
    }
    
    public init(_ value: String) {
        self = .StringValue(value)
    }
    
    public init(_ value: [Json]) {
        self = .ArrayValue(value)
    }
    
    public init(_ value: [String : Json]) {
        self = .ObjectValue(value)
    }
}

// MARK: Mapping between Json and Jay types

extension JayType {
    private init(_ json: Json) {
        switch json {
        case .ObjectValue(let dict):
            var newDict = JsonObject()
            for (k,v) in dict {
                newDict[k] = JayType(v)
            }
            self = .Object(newDict)
        case .ArrayValue(let arr):
            var newArray = JsonArray()
            for i in arr {
                newArray.append(JayType(i))
            }
            self = .Array(newArray)
{'fraction_non_alphanumeric': 0.10138888888888889, 'fraction_numerical': 0.0010416666666666667, 'mean_word_length': 1.8581349206349207, 'pattern_counts': {'":': 0, '<': 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': '4611864', 'n_tokens_mistral': 854, 'n_tokens_neox': 838, 'n_words': 223}