<commit_before>/// Data type to which strongly-typed instances can be mapped.
public protocol OutMap {
    
    /// Blank state of the map.
    static var blank: Self { get }

    /// Sets value to given index path.
    ///
    /// - parameter map:       value to be set.
    /// - parameter indexPath: path to set value to.
    ///
    /// - throws: throw if value cannot be set for some reason.
    mutating func set(_ map: Self, at indexPath: IndexPathValue) throws
    
    /// Sets value to given index path.
    ///
    /// - parameter map:       value to be set.
    /// - parameter indexPath: path to set value to.
    ///
    /// - throws: throw if value cannot be set for some reason.
    mutating func set(_ map: Self, at indexPath: [IndexPathValue]) throws
    
    /// Creates instance from array of instances of the same type.
    ///
    /// - returns: instance of the same type as array element. `nil` if such conversion cannot be done.
    static func fromArray(_ array: [Self]) -> Self?
    
    /// Creates instance from any given type.
    ///
    /// - parameter value: input value.
    ///
    /// - returns: instance from the given value. `nil` if conversion cannot be done.
    static func from<T>(_ value: T) -> Self?
    
    
    /// Creates instance of `Self` from `Int`.
    ///
    /// - parameter int: input value.
    ///
    /// - returns: instance from the given `Int`. `nil` if conversion cannot be done.
    static func from(_ int: Int) -> Self?
    
    /// Creates instance of `Self` from `Double`.
    ///
    /// - parameter int: input value.
    ///
    /// - returns: instance from the given `Double`. `nil` if conversion cannot be done.
    static func from(_ double: Double) -> Self?
    
    /// Creates instance of `Self` from `Bool`.
    ///
    /// - parameter int: input value.
    ///
    /// - returns: instance from the given `Bool`. `nil` if conversion cannot be done.
    static func from(_ bool: Bool) -> Self?
    
    /// Creates instance of `Self` from `String`.
    ///
    /// - parameter int: input value.
    ///
    /// - returns: instance from the given `String`. `nil` if conversion cannot be done.
    static func from(_ string: String) -> Self?

}

public enum OutMapError : Error {
    case deepSetIsNotImplementedYet
}

extension OutMap {
    mutating public func set(_ map: Self, at indexPath: [IndexPathValue]) throws {
        let count = indexPath.count
        switch count {
        case 0:
            self = map
        case 1:
            try set(self, at: indexPath[0])
        default:
            throw OutMapError.deepSetIsNotImplementedYet
        }
    }
}<commit_msg>Fixed critical default out-mapping bug<commit_after>/// Data type to which strongly-typed instances can be mapped.
public protocol OutMap {
    
    /// Blank state of the map.
    static var blank: Self { get }

    /// Sets value to given index path.
    ///
    /// - parameter map:       value to be set.
    /// - parameter indexPath: path to set value to.
    ///
    /// - throws: throw if value cannot be set for some reason.
    mutating func set(_ map: Self, at indexPath: IndexPathValue) throws
    
    /// Sets value to given index path.
    ///
    /// - parameter map:       value to be set.
    /// - parameter indexPath: path to set value to.
    ///
    /// - throws: throw if value cannot be set for some reason.
    mutating func set(_ map: Self, at indexPath: [IndexPathValue]) throws
    
    /// Creates instance from array of instances of the same type.
    ///
    /// - returns: instance of the same type as array element. `nil` if such conversion cannot be done.
    static func fromArray(_ array: [Self]) -> Self?
    
    /// Creates instance from any given type.
    ///
    /// - parameter value: input value.
    ///
    /// - returns: instance from the given value. `nil` if conversion cannot be done.
    static func from<T>(_ value: T) -> Self?
    
    
    /// Creates instance of `Self` from `Int`.
    ///
    /// - parameter int: input value.
    ///
    /// - returns: instance from the given `Int`. `nil` if conversion cannot be done.
    static func from(_ int: Int) -> Self?
    
    /// Creates instance of `Self` from `Double`.
    ///
    /// - parameter int: input value.
    ///
    /// - returns: instance from the given `Double`. `nil` if conversion cannot be done.
    static func from(_ double: Double) -> Self?
    
    /// Creates instance of `Self` from `Bool`.
    ///
    /// - parameter int: input value.
    ///
    /// - returns: instance from the given `Bool`. `nil` if conversion cannot be done.
    static func from(_ bool: Bool) -> Self?
    
    /// Creates instance of `Self` from `String`.
    ///
    /// - parameter int: input value.
    ///
    /// - returns: instance from the given `String`. `nil` if conversion cannot be done.
    static func from(_ string: String) -> Self?

}

public enum OutMapError : Error {
    case deepSetIsNotImplementedYet
}

extension OutMap {
    mutating public func set(_ map: Self, at indexPath: [IndexPathValue]) throws {
        let count = indexPath.count
        switch count {
        case 0:
            self = map
        case 1:
            try set(map, at: indexPath[0])
        default:
            throw OutMapError.deepSetIsNotImplementedYet
        }
    }
}
{'fraction_non_alphanumeric': 0.11993243243243243, 'fraction_numerical': 0.0011261261261261261, 'mean_word_length': 1.8650537634408602, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, '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': '654866', 'n_tokens_mistral': 1467, 'n_tokens_neox': 1451, 'n_words': 634}