<commit_before>//
//  HPPManager.swift
//  rxp-ios

import UIKit

/**
 *  The delegate callbacks which allow the host app to receive all possible results form the component.
 */
@objc public protocol HPPManagerDelegate {

    @objc optional func HPPManagerCompletedWithResult(_ result: Dictionary <String, String>);
    @objc optional func HPPManagerFailedWithError(_ error: NSError?);
    @objc optional func HPPManagerCancelled();

}

/**
 *  The delegate callbacks which allow the host app to receive all possible results from the component using a generic decodable type.
 */
public protocol HPPSwiftManagerDelegate: class {
    
    associatedtype PaymentServiceResponse: Decodable
    func HPPSwiftManagerCompletedWithResult(_ result: PaymentServiceResponse)
    func HPPSwiftManagerFailedWithError(_ error: Error?)
    func HPPSwiftManagerCancelled()
    
}

/**
 *  A type-erased
 */
fileprivate class AnyHPPSwiftManagerDelegate<T: Decodable>: HPPSwiftManagerDelegate {
    
    private let completed: (T) -> Void
    private let failed: (Error?) -> Void
    private let cancelled: () -> Void
    
    init<D: HPPSwiftManagerDelegate>(_ delegate: D) where D.PaymentServiceResponse == T {
        self.completed = { [weak delegate] in delegate?.HPPSwiftManagerCompletedWithResult($0) }
        self.failed = { [weak delegate] in delegate?.HPPSwiftManagerFailedWithError($0) }
        self.cancelled = { [weak delegate] in delegate?.HPPSwiftManagerCancelled() }<commit_msg>- comment fix<commit_after>//
//  HPPManager.swift
//  rxp-ios

import UIKit

/**
 *  The delegate callbacks which allow the host app to receive all possible results form the component.
 */
@objc public protocol HPPManagerDelegate {

    @objc optional func HPPManagerCompletedWithResult(_ result: Dictionary <String, String>);
    @objc optional func HPPManagerFailedWithError(_ error: NSError?);
    @objc optional func HPPManagerCancelled();

}

/**
 *  The delegate callbacks which allow the host app to receive all possible results from the component using a generic decodable type.
 */
public protocol HPPSwiftManagerDelegate: class {
    
    associatedtype PaymentServiceResponse: Decodable
    func HPPSwiftManagerCompletedWithResult(_ result: PaymentServiceResponse)
    func HPPSwiftManagerFailedWithError(_ error: Error?)
    func HPPSwiftManagerCancelled()
    
}

/**
 *  A type-erased implementer of the `HPPSwiftManagerDelegate` protocol
 */
fileprivate class AnyHPPSwiftManagerDelegate<T: Decodable>: HPPSwiftManagerDelegate {
    
    private let completed: (T) -> Void
    private let failed: (Error?) -> Void
    private let cancelled: () -> Void
    
    init<D: HPPSwiftManagerDelegate>(_ delegate: D) where D.PaymentServiceResponse == T {
        self.completed = { [weak delegate] in delegate?.HPPSwiftManagerCompletedWithResult($0) }
        self.failed = { [weak delegate] in delegate?.HPPSwiftManagerFailedWithError($0) }
        self.cancelled = { [weak delegate] in delegate?.HPPSwiftManagerCancelled() }
{'fraction_non_alphanumeric': 0.08665338645418327, 'fraction_numerical': 0.0013280212483399733, 'mean_word_length': 4.185886402753873, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 15, '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': '1680429', 'n_tokens_mistral': 856, 'n_tokens_neox': 838, 'n_words': 255}