<commit_before>//
//  UserDefaults.swift
//  P3Foundation
//
//  Created by <NAME> on 6/15/16.
//  Copyright © 2016 Pacific3. All rights reserved.
//

private let userDefaults = UserDefaults.standard()

extension UserDefaults {
    // MARK: - Get Values
    static func p3_getString(key: String) -> String {
        let s = userDefaults.object(forKey: key) as? String
        if let s = s {
            return s
        }
        
        return ""
    }
    
    static func p3_getBool(key: String) -> Bool {
        return userDefaults.bool(forKey: key)
    }
    
    static func p3_getInt(key: String) -> Int {
        return userDefaults.integer(forKey: key)
    }
    
    
    // MARK: - Set Values
    static func p3_setString(key: String, value: String) -> Bool {
        userDefaults.set(value, forKey: key)
        return userDefaults.synchronize()
    }
    
    static func p3_setBool(key: String, value: Bool) -> Bool {
        userDefaults.set(value, forKey: key)
        return userDefaults.synchronize()
    }
    <commit_msg>Add discardableResult attributes to setters for user defaults<commit_after>//
//  UserDefaults.swift
//  P3Foundation
//
//  Created by <NAME> on 6/15/16.
//  Copyright © 2016 Pacific3. All rights reserved.
//

private let userDefaults = UserDefaults.standard()

extension UserDefaults {
    // MARK: - Get Values
    static func p3_getString(key: String) -> String {
        let s = userDefaults.object(forKey: key) as? String
        if let s = s {
            return s
        }
        
        return ""
    }
    
    static func p3_getBool(key: String) -> Bool {
        return userDefaults.bool(forKey: key)
    }
    
    static func p3_getInt(key: String) -> Int {
        return userDefaults.integer(forKey: key)
    }
    
    
    // MARK: - Set Values
    @discardableResult
    static func p3_setString(key: String, value: String) -> Bool {
        userDefaults.set(value, forKey: key)
        return userDefaults.synchronize()
    }
    
    @discardableResult
    static func p3_setBool(key: String, value: Bool) -> Bool {
        userDefaults.set(value, forKey: key)
        return userDefaults.synchronize()
    }
    
    @discardableResult
{'fraction_non_alphanumeric': 0.10394916023604175, 'fraction_numerical': 0.014525646845211076, 'mean_word_length': 2.135135135135135, 'pattern_counts': {'":': 0, '<': 5, '<?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': '4039787', 'n_tokens_mistral': 725, 'n_tokens_neox': 671, 'n_words': 180}