<commit_before>// NSErrorRepresentable
// Written in 2016 by <NAME> <<EMAIL>>
//
// To the extent possible under law, the author(s) have dedicated all copyright and
// related and neighboring rights to this software to the public domain worldwide.
// This software is distributed without any warranty.
//
// You should have received a copy of the CC0 Public Domain Dedication along with
// this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.

import Foundation

// MARK: - User Info Convertible

/// A protocol for types that can be converted to a user info value.
///
/// All properties of this protocol have default implementations, which return empty values.
public protocol UserInfoConvertible
{
    // MARK: - Text Content

    /// A value for `NSLocalizedDescriptionKey`.
    var localizedDescription: String? { get }

    /// A value for `NSLocalizedRecoveryOptionsErrorKey`.
    var localizedRecoveryOptions: [String]? { get }

    /// A value for `NSLocalizedRecoverySuggestionErrorKey`.
    var localizedRecoverySuggestion: String? { get }

    /// A value for `NSLocalizedFailureReasonErrorKey`.
    var localizedFailureReason: String? { get }

    // MARK: - Underlying Error

    /// A value for `NSUnderlyingErrorKey`.
    var underlyingError: NSError? { get }

    // MARK: - Additional User Info Values

    /// Additional user info keys and values to apply.
    ///
    /// These are applied after the built-in properties, so any repeated keys will be overridden.
    var additionalUserInfoValues: [String:AnyObject] { get }
}

extension UserInfoConvertible
{
    // MARK: - Text Content

    /// This property's default implementation returns `nil`.
    public var localizedDescription: String? { return nil }

    /// This property's default implementation returns `nil`.
    public var localizedRecoveryOptions: [String]? { return nil }

    /// This property's default implementation returns `nil`.
    public var localizedRecoverySuggestion: String? { return nil }

    /// This property's default implementation returns `nil`.
    public var localizedFailureReason: String? { return nil }

    // MARK: - Underlying Error

    /// This property's default implementation returns `nil`.
    public var underlyingError: NSError? { return nil }

    // MARK: - Additional User Info Values

    /// This property's default implementation returns an empty dictionary.
    public var additionalUserInfoValues: [String:AnyObject] { return [:] }
}

extension UserInfoConvertible<commit_msg>Revert "NSErrorConvertible constraint is not necessary for userInfo."<commit_after>// NSErrorRepresentable
// Written in 2016 by <NAME> <<EMAIL>>
//
// To the extent possible under law, the author(s) have dedicated all copyright and
// related and neighboring rights to this software to the public domain worldwide.
// This software is distributed without any warranty.
//
// You should have received a copy of the CC0 Public Domain Dedication along with
// this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.

import Foundation

// MARK: - User Info Convertible

/// A protocol for types that can be converted to a user info value.
///
/// All properties of this protocol have default implementations, which return empty values.
public protocol UserInfoConvertible
{
    // MARK: - Text Content

    /// A value for `NSLocalizedDescriptionKey`.
    var localizedDescription: String? { get }

    /// A value for `NSLocalizedRecoveryOptionsErrorKey`.
    var localizedRecoveryOptions: [String]? { get }

    /// A value for `NSLocalizedRecoverySuggestionErrorKey`.
    var localizedRecoverySuggestion: String? { get }

    /// A value for `NSLocalizedFailureReasonErrorKey`.
    var localizedFailureReason: String? { get }

    // MARK: - Underlying Error

    /// A value for `NSUnderlyingErrorKey`.
    var underlyingError: NSError? { get }

    // MARK: - Additional User Info Values

    /// Additional user info keys and values to apply.
    ///
    /// These are applied after the built-in properties, so any repeated keys will be overridden.
    var additionalUserInfoValues: [String:AnyObject] { get }
}

extension UserInfoConvertible
{
    // MARK: - Text Content

    /// This property's default implementation returns `nil`.
    public var localizedDescription: String? { return nil }

    /// This property's default implementation returns `nil`.
    public var localizedRecoveryOptions: [String]? { return nil }

    /// This property's default implementation returns `nil`.
    public var localizedRecoverySuggestion: String? { return nil }

    /// This property's default implementation returns `nil`.
    public var localizedFailureReason: String? { return nil }

    // MARK: - Underlying Error

    /// This property's default implementation returns `nil`.
    public var underlyingError: NSError? { return nil }

    // MARK: - Additional User Info Values

    /// This property's default implementation returns an empty dictionary.
    public var additionalUserInfoValues: [String:AnyObject] { return [:] }
}

extension NSErrorConvertible where Self: UserInfoConvertible
{'fraction_non_alphanumeric': 0.09085614443797321, 'fraction_numerical': 0.0027179188507086, 'mean_word_length': 3.300500834724541, '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': '7549469', 'n_tokens_mistral': 1371, 'n_tokens_neox': 1250, 'n_words': 527}