<commit_before>//
//  NSPersistentStoreCoordinator.swift
//  CoreDataKit
//
//  Created by <NAME> on 03-07-14.
//  Copyright (c) 2014 <NAME>. All rights reserved.
//

import CoreData

extension NSPersistentStoreCoordinator
{
    /**
    Creates a `NSPersistentStoreCoordinator` with SQLite added as persistent store.
    
    :discussion: Use `NSPersistentStore.URLForSQLiteStoreName(storeName:)` to create the store URL
    
    :param: automigrating      Whether to enable automigration for the SQLite store
    :param: URL                URL to save the SQLite store at, pass nil to use default
    :param: managedObjectModel Managed object model to initialize the store with, pass nil to use all models in the main bundle
    */
    public convenience init?(automigrating: Bool, URL optionalURL: NSURL? = nil, managedObjectModel optionalManagedObjectModel: NSManagedObjectModel? = nil) {

        // Fallback on the defaults
        let _managedObjectModel = optionalManagedObjectModel ?? NSManagedObjectModel.mergedModelFromBundles(nil)
        let _URL = optionalURL ?? NSPersistentStore.URLForSQLiteStoreName("CoreDataKit")

        // Initialize coordinator if we have all data
        switch ((_managedObjectModel, _URL)) {
        case let (.Some(managedObjectModel), .Some(URL)):
            self.init(managedObjectModel: managedObjectModel)
            self.addSQLitePersistentStoreWithURL(URL, automigrating: automigrating)

        default:
            self.init()
            return nil
        }
    }

    /**
    Creates a `NSPersistentStoreCoordinator` with in memory store as backing store.
<commit_msg>Remove double () around switch input<commit_after>//
//  NSPersistentStoreCoordinator.swift
//  CoreDataKit
//
//  Created by <NAME> on 03-07-14.
//  Copyright (c) 2014 <NAME>. All rights reserved.
//

import CoreData

extension NSPersistentStoreCoordinator
{
    /**
    Creates a `NSPersistentStoreCoordinator` with SQLite added as persistent store.
    
    :discussion: Use `NSPersistentStore.URLForSQLiteStoreName(storeName:)` to create the store URL
    
    :param: automigrating      Whether to enable automigration for the SQLite store
    :param: URL                URL to save the SQLite store at, pass nil to use default
    :param: managedObjectModel Managed object model to initialize the store with, pass nil to use all models in the main bundle
    */
    public convenience init?(automigrating: Bool, URL optionalURL: NSURL? = nil, managedObjectModel optionalManagedObjectModel: NSManagedObjectModel? = nil) {

        // Fallback on the defaults
        let _managedObjectModel = optionalManagedObjectModel ?? NSManagedObjectModel.mergedModelFromBundles(nil)
        let _URL = optionalURL ?? NSPersistentStore.URLForSQLiteStoreName("CoreDataKit")

        // Initialize coordinator if we have all data
        switch (_managedObjectModel, _URL) {
        case let (.Some(managedObjectModel), .Some(URL)):
            self.init(managedObjectModel: managedObjectModel)
            self.addSQLitePersistentStoreWithURL(URL, automigrating: automigrating)

        default:
            self.init()
            return nil
        }
    }

    /**
    Creates a `NSPersistentStoreCoordinator` with in memory store as backing store.

{'fraction_non_alphanumeric': 0.07468625650443832, 'fraction_numerical': 0.006121824303642486, 'mean_word_length': 3.1367088607594935, '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': '4814838', 'n_tokens_mistral': 899, 'n_tokens_neox': 864, 'n_words': 278}