<commit_before>import UIKit
import Security

let serviceIdentifier = "info.justaway"
let accessGroup = "info.justaway.Justaway"

class KeychainService: NSObject {
    
    class func remove(key: String) -> Bool {
        let keychainQuery = [
            kSecClass       : kSecClassGenericPassword,
            kSecAttrService : serviceIdentifier,
            kSecAttrAccount : key,
            kSecValueData   : NSData() ]
        
        let status: OSStatus = SecItemDelete(keychainQuery as CFDictionaryRef)
        
        return status == noErr
    }
    
    class func save(key: String, data: NSString) -> Bool {
        let dataFromString: NSData = data.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)!
        
        let keychainQuery = [
            kSecClass       : kSecClassGenericPassword,
            kSecAttrService : serviceIdentifier,
            kSecAttrAccount : key,
            kSecValueData   : dataFromString ]
        
        SecItemDelete(keychainQuery as CFDictionaryRef)
        
        let status: OSStatus = SecItemAdd(keychainQuery as CFDictionaryRef, nil)
        
        return status == noErr
    }
    
    class func load(key: String) -> NSString {
        let keychainQuery = [
            kSecClass       : kSecClassGenericPassword,
            kSecAttrService : serviceIdentifier,
            kSecAttrAccount : key,
            kSecReturnData  : kCFBooleanTrue,
            kSecMatchLimit  : kSecMatchLimitOne ]
        
        var dataTypeRef :Unmanaged<AnyObject>?
        
        let status: OSStatus = SecItemCopyMatching(keychainQuery, &dataTypeRef)
        
        let opaque = dataTypeRef?.toOpaque()
        
        if let op = opaque? {
            return NSString(data: Unmanaged<NSData>.fromOpaque(op).takeUnretainedValue(), encoding: NSUTF8StringEncoding)
        } else {
            return ""
        }
    }
    
}<commit_msg>Reformat KeychainService.<commit_after>import UIKit
import Security

let serviceIdentifier = "info.justaway"
let accessGroup = "info.justaway.Justaway"

class KeychainService: NSObject {
    
    class func save(key: String, data: NSString) -> Bool {
        let dataFromString: NSData = data.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)!
        
        let keychainQuery = [
            kSecClass       : kSecClassGenericPassword,
            kSecAttrService : serviceIdentifier,
            kSecAttrAccount : key,
            kSecValueData   : dataFromString ]
        
        SecItemDelete(keychainQuery as CFDictionaryRef)
        
        let status: OSStatus = SecItemAdd(keychainQuery as CFDictionaryRef, nil)
        
        return status == noErr
    }
    
    class func load(key: String) -> NSString {
        let keychainQuery = [
            kSecClass       : kSecClassGenericPassword,
            kSecAttrService : serviceIdentifier,
            kSecAttrAccount : key,
            kSecReturnData  : kCFBooleanTrue,
            kSecMatchLimit  : kSecMatchLimitOne ]
        
        var dataTypeRef :Unmanaged<AnyObject>?
        
        let status: OSStatus = SecItemCopyMatching(keychainQuery, &dataTypeRef)
        
        let opaque = dataTypeRef?.toOpaque()
        
        if let op = opaque? {
            return NSString(data: Unmanaged<NSData>.fromOpaque(op).takeUnretainedValue(), encoding: NSUTF8StringEncoding)
        } else {
            return ""
        }
    }
    
    class func remove(key: String) -> Bool {
        let keychainQuery = [
            kSecClass       : kSecClassGenericPassword,
            kSecAttrService : serviceIdentifier,
            kSecAttrAccount : key,
            kSecValueData   : NSData() ]
        
        let status: OSStatus = SecItemDelete(keychainQuery as CFDictionaryRef)
        
        return status == noErr
    }
    
}
{'fraction_non_alphanumeric': 0.06856100104275287, 'fraction_numerical': 0.0010427528675703858, 'mean_word_length': 2.042823156225218, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, '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': '495007', 'n_tokens_mistral': 1045, 'n_tokens_neox': 1023, 'n_words': 225}