<commit_before>//
// Xcore
// Copyright © 2019 Xcore
// MIT license, see LICENSE file for details
//

import Foundation

public struct AdaptiveURL: UserInfoContainer, MutableAppliable {
    /// The title of the URL.
    public let title: String
    public let url: URL?
    /// Additional info which may be used to describe the url further.
    public var userInfo: UserInfo

    /// Initialize an instance of adaptive URL.
    ///
    /// - Parameters:
    ///   - title: The title of the URL.
    ///   - url: The url.
    ///   - userInfo: Additional info associated with the url.
    public init(title: String, url: URL?, userInfo: UserInfo = [:]) {
        self.title = title
        self.url = url
        self.userInfo = userInfo
    }
}

// MARK: - UserInfo

extension UserInfoKey where Type == AdaptiveURL {
    /// A boolean property indicating whether the URL content should adapt app
    /// appearance.
    public static var shouldAdaptAppearance: Self { #function }
}

extension AdaptiveURL {
    /// A boolean property indicating whether the URL content should adapt app
    /// appearance.
    public var shouldAdaptAppearance: Bool {
        get { self[userInfoKey: .shouldAdaptAppearance, default: false] }
        set { self[userInfoKey: .shouldAdaptAppearance] = newValue }
    }
}<commit_msg>Equatable conformance to AdaptiveURL.<commit_after>//
// Xcore
// Copyright © 2019 Xcore
// MIT license, see LICENSE file for details
//

import Foundation

public struct AdaptiveURL: UserInfoContainer, MutableAppliable {
    /// The title of the URL.
    public let title: String
    public let url: URL?
    /// Additional info which may be used to describe the url further.
    public var userInfo: UserInfo

    /// Initialize an instance of adaptive URL.
    ///
    /// - Parameters:
    ///   - title: The title of the URL.
    ///   - url: The url.
    ///   - userInfo: Additional info associated with the url.
    public init(title: String, url: URL?, userInfo: UserInfo = [:]) {
        self.title = title
        self.url = url
        self.userInfo = userInfo
    }
}

// MARK: - UserInfo

extension UserInfoKey where Type == AdaptiveURL {
    /// A boolean property indicating whether the URL content should adapt app
    /// appearance.
    public static var shouldAdaptAppearance: Self { #function }
}

extension AdaptiveURL {
    /// A boolean property indicating whether the URL content should adapt app
    /// appearance.
    public var shouldAdaptAppearance: Bool {
        get { self[userInfoKey: .shouldAdaptAppearance, default: false] }
        set { self[userInfoKey: .shouldAdaptAppearance] = newValue }
    }
}

// MARK: - Equatable

extension AdaptiveURL: Equatable {
    public static func == (lhs: Self, rhs: Self) -> Bool {
        String(reflecting: lhs) == String(reflecting: rhs)
    }
}

// MARK: - Hashable

extension AdaptiveURL: Hashable {
    public func hash(into hasher: inout Hasher) {
        hasher.combine(String(reflecting: self))
    }
}
{'fraction_non_alphanumeric': 0.09976643309976643, 'fraction_numerical': 0.002669336002669336, 'mean_word_length': 2.5270588235294116, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '246846', 'n_tokens_mistral': 850, 'n_tokens_neox': 828, 'n_words': 305}