<commit_before>import Foundation
import RxSwift
import Keys

class AdminCardTestingViewController: UIViewController {

    lazy var keys = EidolonKeys()
    var cardHandler: CardHandler!

    @IBOutlet weak var logTextView: UITextView!

     override func viewDidLoad() {
        super.viewDidLoad()


        self.logTextView.text = ""

        if AppSetup.sharedState.useStaging {
            cardHandler = CardHandler(apiKey: self.keys.cardflightStagingAPIClientKey(), accountToken: self.keys.cardflightStagingMerchantAccountToken())
        } else {
            cardHandler = CardHandler(apiKey: self.keys.cardflightProductionAPIClientKey(), accountToken: self.keys.cardflightProductionMerchantAccountToken())
        }

        cardHandler.cardStatus
            .subscribe { (event) in
                switch event {
                case .next(let message):
                    self.log("\(message)")
                case .error(let error):
                    self.log("\n====Error====\n\(error)\nThe card reader may have become disconnected.\n\n")
                    if self.cardHandler.card != nil {
                        self.log("==\n\(self.cardHandler.card!)\n\n")
                    }
                case .completed:
                    guard let card = self.cardHandler.card else {
                        // Restarts the card reader
                        self.cardHandler.startSearching()
                        return
                    }

                    let cardDetails = "Card: \(card.name) - \(card.last4) \n \(card.cardToken)"
                    self.log(cardDetails)
                }
            }
            .addDisposableTo(rx_disposeBag)


        cardHandler.startSearching()
    }

    override func viewWillDisappear(_ animated: Bool) {
        super.viewWillDisappear(animated)
        cardHandler.end()
    }

    func log(_ string: String) {
        self.logTextView.text = "\(self.logTextView.text)\n\(string)"

    }

    @IBAction func backTapped(_ sender: AnyObject) {
        _ = navigationController?.popViewController(animated: true)
    }
}<commit_msg>Fixed problem in Admin card testing view.<commit_after>import Foundation
import RxSwift
import Keys

class AdminCardTestingViewController: UIViewController {

    lazy var keys = EidolonKeys()
    var cardHandler: CardHandler!

    @IBOutlet weak var logTextView: UITextView!

     override func viewDidLoad() {
        super.viewDidLoad()


        self.logTextView.text = ""

        if AppSetup.sharedState.useStaging {
            cardHandler = CardHandler(apiKey: self.keys.cardflightStagingAPIClientKey(), accountToken: self.keys.cardflightStagingMerchantAccountToken())
        } else {
            cardHandler = CardHandler(apiKey: self.keys.cardflightProductionAPIClientKey(), accountToken: self.keys.cardflightProductionMerchantAccountToken())
        }

        cardHandler.cardStatus
            .subscribe { (event) in
                switch event {
                case .next(let message):
                    self.log("\(message)")
                case .error(let error):
                    self.log("\n====Error====\n\(error)\nThe card reader may have become disconnected.\n\n")
                    if self.cardHandler.card != nil {
                        self.log("==\n\(self.cardHandler.card!)\n\n")
                    }
                case .completed:
                    guard let card = self.cardHandler.card else {
                        // Restarts the card reader
                        self.cardHandler.startSearching()
                        return
                    }

                    let cardDetails = "Card: \(card.name) - \(card.last4) \n \(card.cardToken)"
                    self.log(cardDetails)
                }
            }
            .addDisposableTo(rx_disposeBag)


        cardHandler.startSearching()
    }

    override func viewWillDisappear(_ animated: Bool) {
        super.viewWillDisappear(animated)
        cardHandler.end()
    }

    func log(_ string: String) {
        self.logTextView.text = "\(self.logTextView.text ?? "")\n\(string)"

    }

    @IBAction func backTapped(_ sender: AnyObject) {
        _ = navigationController?.popViewController(animated: true)
    }
}
{'fraction_non_alphanumeric': 0.10004708097928437, 'fraction_numerical': 0.00047080979284369113, 'mean_word_length': 1.8213811420982735, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7652283', 'n_tokens_mistral': 1163, 'n_tokens_neox': 1069, 'n_words': 219}