<commit_before>//
//  JSONProtocols.swift
//  StreetSmart
//
//  Created by Oleksii on 14/09/16.
//  Copyright © 2016 <NAME>. All rights reserved.
//

import Foundation
import SwiftyJSON

public enum JSONModelError: Error {
    case invalidJSON
    case jsonIsNotAnObject
    case unexpectedElement
    case elementAbsent
    case invalidElement
    case invalidUUIDString
}

public protocol PropertiesContaining {
    associatedtype PropertyKey: RawRepresentable, Hashable
}

public protocol JSONObjectInitializable: PropertiesContaining, JSONInitializable {
    init(object: JSONObject<PropertyKey>) throws
}

public protocol JSONObjectRepresentable: PropertiesContaining, JSONRepresentable {
    var dictValue: [PropertyKey: JSONRepresentable] { get }
}

public protocol JSONModelType: JSONObjectInitializable, JSONObjectRepresentable {}

public extension JSONObjectInitializable where PropertyKey.RawValue == String {
    init(json: JSON) throws {
        let jsonObject = try JSONObject<PropertyKey>(json: json)
        try self.init(object: jsonObject)
    }
}

public extension JSONObjectRepresentable where PropertyKey.RawValue == String {
    var jsonValue: JSON {
        return JSONObject<PropertyKey>(dictValue).jsonValue
    }
}

<commit_msg>Fix project name<commit_after>//
//  JSONProtocols.swift
//  SwiftyJSONModel
//
//  Created by Oleksii on 14/09/16.
//  Copyright © 2016 <NAME>. All rights reserved.
//

import Foundation
import SwiftyJSON

public enum JSONModelError: Error {
    case invalidJSON
    case jsonIsNotAnObject
    case unexpectedElement
    case elementAbsent
    case invalidElement
    case invalidUUIDString
}

public protocol PropertiesContaining {
    associatedtype PropertyKey: RawRepresentable, Hashable
}

public protocol JSONObjectInitializable: PropertiesContaining, JSONInitializable {
    init(object: JSONObject<PropertyKey>) throws
}

public protocol JSONObjectRepresentable: PropertiesContaining, JSONRepresentable {
    var dictValue: [PropertyKey: JSONRepresentable] { get }
}

public protocol JSONModelType: JSONObjectInitializable, JSONObjectRepresentable {}

public extension JSONObjectInitializable where PropertyKey.RawValue == String {
    init(json: JSON) throws {
        let jsonObject = try JSONObject<PropertyKey>(json: json)
        try self.init(object: jsonObject)
    }
}

public extension JSONObjectRepresentable where PropertyKey.RawValue == String {
    var jsonValue: JSON {
        return JSONObject<PropertyKey>(dictValue).jsonValue
    }
}


{'fraction_non_alphanumeric': 0.07071911005164878, 'fraction_numerical': 0.007945967421533572, 'mean_word_length': 4.346072186836518, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '4016284', 'n_tokens_mistral': 693, 'n_tokens_neox': 660, 'n_words': 188}