<commit_before>//
//  Site.swift
//  Nightscouter
//
//  Created by <NAME> on 6/25/15.
//  Copyright (c) 2015 <NAME>. All rights reserved.
//
import Foundation
import UIKit

class Site: NSObject, NSCoding {
    
    struct PropertyKey {
        static let urlKey = "url"
        static let apiSecretKey = "apiSecret"
        static let siteKey = "site"
        static let allowNotificationsKey = "notifications"
        static let uuidKey = "uuid"
        static let notificationKey = "notification"
        static let notificationCountKey = "notificationCount"
        static let overrideScreenLockKey = "overrideScreenLock"
        
        static let sitesKey = "sites.plist"

    }
    
    // MARK: Archiving Paths
    static let DocumentsDirectory: AnyObject = NSFileManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask).first!
    static let ArchiveURL = DocumentsDirectory.URLByAppendingPathComponent(PropertyKey.sitesKey)
    
    var url: NSURL!
    var apiSecret: String?
    var configuration: ServerConfiguration?
    var watchEntry: WatchEntry?
    var entries: [Entry]?
    var allowNotifications: Bool = true // Fix this at somepoint.
    var overrideScreenLock: Bool

    var notifications: [UILocalNotification]
    
    private(set) var uuid: NSUUID
    
    // MARK: Initialization
    init?(url: NSURL, apiSecret: String?) {
        // Initialize stored properties.
        self.url = url
        self.apiSecret = apiSecret
        
        self.uuid = NSUUID()
        self.notifications = [UILocalNotification]()
        self.overrideScreenLock = false
        
        super.init()
        
        // Initialization should fail if there is no name.
        if url.absoluteString!.isEmpty {
            return nil
        }
    }
    
    // MARK: NSCoding
    func encodeWithCoder(aCoder: NSCoder) {
        aCoder.encodeObject(url, forKey: PropertyKey.urlKey)
        aCoder.encodeObject(apiSecret, forKey: PropertyKey.apiSecretKey)
        aCoder.encodeBool(allowNotifications, forKey: PropertyKey.allowNotificationsKey)
        aCoder.encodeObject(uuid, forKey: PropertyKey.uuidKey)
        aCoder.encodeObject(notifications, forKey: PropertyKey.notificationKey)
        aCoder.encodeBool(overrideScreenLock, forKey: PropertyKey.overrideScreenLockKey)
    }
    
    /*
    convenience required init(coder aDecoder: NSCoder) {
    let url = aDecoder.decodeObjectForKey(PropertyKey.urlKey) as! NSURL
    let apiSecretKey = aDecoder.decodeObjectForKey(PropertyKey.apiSecretKey) as? String
    
    self.init(url: url, apiSecret: apiSecret)
    }
    */
    
    required init(coder aDecoder: NSCoder) {
        let url = aDecoder.decodeObjectForKey(PropertyKey.urlKey) as! NSURL
        let apiSecret = aDecoder.decodeObjectForKey(PropertyKey.apiSecretKey) as? String
        let allowNotif = aDecoder.decodeBoolForKey(PropertyKey.allowNotificationsKey)
        let overrideScreen = aDecoder.decodeBoolForKey(PropertyKey.overrideScreenLockKey)
        
        if let uuid = aDecoder.decodeObjectForKey(PropertyKey.uuidKey) as? NSUUID {
            self.uuid = uuid
        } else {
            self.uuid = NSUUID()
        }
        
        self.url = url
        self.apiSecret = apiSecret
        self.allowNotifications =  allowNotif
        self.overrideScreenLock = overrideScreen
        
        if let notification = aDecoder.decodeObjectForKey(PropertyKey.notificationKey) as? [UILocalNotification] {
            self.notifications = notification
        } else {
            self.notifications = [UILocalNotification]()
        }
        
    }
}
<commit_msg>URL Change clear old stuff out.<commit_after>//
//  Site.swift
//  Nightscouter
//
//  Created by <NAME> on 6/25/15.
//  Copyright (c) 2015 <NAME>. All rights reserved.
//
import Foundation
import UIKit

class Site: NSObject, NSCoding {
    
    struct PropertyKey {
        static let urlKey = "url"
        static let apiSecretKey = "apiSecret"
        static let siteKey = "site"
        static let allowNotificationsKey = "notifications"
        static let uuidKey = "uuid"
        static let notificationKey = "notification"
        static let notificationCountKey = "notificationCount"
        static let overrideScreenLockKey = "overrideScreenLock"
        
        static let sitesKey = "sites.plist"

    }
    
    // MARK: Archiving Paths
    static let DocumentsDirectory: AnyObject = NSFileManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask).first!
    static let ArchiveURL = DocumentsDirectory.URLByAppendingPathComponent(PropertyKey.sitesKey)
    
    var url: NSURL! {
        didSet {
            #if DEBUG
                println("Changed site URL to \(url) from \(oldValue)")
            #endif
            
            configuration = nil
            watchEntry = nil
            entries = nil
        }
    }
    var apiSecret: String?
    var configuration: ServerConfiguration?
    var watchEntry: WatchEntry?
    var entries: [Entry]?
    var allowNotifications: Bool = true // Fix this at somepoint.
    var overrideScreenLock: Bool

    var notifications: [UILocalNotification]
    
    private(set) var uuid: NSUUID
    
    // MARK: Initialization
    init?(url: NSURL, apiSecret: String?) {
        // Initialize stored properties.
        self.url = url
        self.apiSecret = apiSecret
        
        self.uuid = NSUUID()
        self.notifications = [UILocalNotification]()
        self.overrideScreenLock = false
        
        super.init()
        
        // Initialization should fail if there is no name.
        if url.absoluteString!.isEmpty {
            return nil
        }
    }
    
    // MARK: NSCoding
    func encodeWithCoder(aCoder: NSCoder) {
        aCoder.encodeObject(url, forKey: PropertyKey.urlKey)
        aCoder.encodeObject(apiSecret, forKey: PropertyKey.apiSecretKey)
        aCoder.encodeBool(allowNotifications, forKey: PropertyKey.allowNotificationsKey)
        aCoder.encodeObject(uuid, forKey: PropertyKey.uuidKey)
        aCoder.encodeObject(notifications, forKey: PropertyKey.notificationKey)
        aCoder.encodeBool(overrideScreenLock, forKey: PropertyKey.overrideScreenLockKey)
    }
    
    /*
    convenience required init(coder aDecoder: NSCoder) {
    let url = aDecoder.decodeObjectForKey(PropertyKey.urlKey) as! NSURL
    let apiSecretKey = aDecoder.decodeObjectForKey(PropertyKey.apiSecretKey) as? String
    
    self.init(url: url, apiSecret: apiSecret)
    }
    */
    
    required init(coder aDecoder: NSCoder) {
        let url = aDecoder.decodeObjectForKey(PropertyKey.urlKey) as! NSURL
        let apiSecret = aDecoder.decodeObjectForKey(PropertyKey.apiSecretKey) as? String
        let allowNotif = aDecoder.decodeBoolForKey(PropertyKey.allowNotificationsKey)
        let overrideScreen = aDecoder.decodeBoolForKey(PropertyKey.overrideScreenLockKey)
        
        if let uuid = aDecoder.decodeObjectForKey(PropertyKey.uuidKey) as? NSUUID {
            self.uuid = uuid
        } else {
            self.uuid = NSUUID()
        }
        
        self.url = url
        self.apiSecret = apiSecret
        self.allowNotifications =  allowNotif
        self.overrideScreenLock = overrideScreen
        
        if let notification = aDecoder.decodeObjectForKey(PropertyKey.notificationKey) as? [UILocalNotification] {
            self.notifications = notification
        } else {
            self.notifications = [UILocalNotification]()
        }
        
    }
}

{'fraction_non_alphanumeric': 0.08052259698706839, 'fraction_numerical': 0.0023996800426609784, 'mean_word_length': 2.492551210428305, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '1966555', 'n_tokens_mistral': 2114, 'n_tokens_neox': 2077, 'n_words': 486}