<commit_before>//
//  ControllerSectionInfo.swift
//  CoreDataTrickerySwift
//
//  Created by <NAME> on 2014-08-20.
//  Copyright (c) 2014 Apps and Wonders. All rights reserved.
//

import CoreData

class ControllerSectionInfo: NSFetchedResultsSectionInfo {
    
    // ========================================
    // MARK: - Internal properties
    // ========================================
    
    let section: ToDoSection
    let fetchedIndex: Int?
    let fetchController: NSFetchedResultsController
    var fetchedInfo: NSFetchedResultsSectionInfo? {
        return fetchedIndex.hasValue ? fetchController.sections![0] as? NSFetchedResultsSectionInfo : nil
    }
    
    // ========================================
    // MARK: - NSFetchedResultsSectionInfo
    // ========================================
    
    var name: String { return section.title() }
    var indexTitle: String { return "" }
    var numberOfObjects: Int { return fetchedInfo?.numberOfObjects ?? 0 }
    var objects: [AnyObject] { return fetchedInfo?.objects ?? [] }
    
    // ========================================
    // MARK: - Internal methods
    // ========================================
    
    init(section: ToDoSection, fetchedIndex: Int?, fetchController: NSFetchedResultsController) {
        self.section = section
        self.fetchedIndex = fetchedIndex
        self.fetchController = fetchController
    }
    
}
<commit_msg>Extracted NSFetchedResultsSectionInfo implementation to own extension<commit_after>//
//  ControllerSectionInfo.swift
//  CoreDataTrickerySwift
//
//  Created by <NAME> on 2014-08-20.
//  Copyright (c) 2014 Apps and Wonders. All rights reserved.
//

import CoreData

class ControllerSectionInfo {
    
    // ========================================
    // MARK: - Internal properties
    // ========================================
    
    let section: ToDoSection
    let fetchedIndex: Int?
    let fetchController: NSFetchedResultsController
    var fetchedInfo: NSFetchedResultsSectionInfo? {
        return fetchedIndex.hasValue ? fetchController.sections![0] as? NSFetchedResultsSectionInfo : nil
    }
    
    // ========================================
    // MARK: - Internal methods
    // ========================================
    
    init(section: ToDoSection, fetchedIndex: Int?, fetchController: NSFetchedResultsController) {
        self.section = section
        self.fetchedIndex = fetchedIndex
        self.fetchController = fetchController
    }
    
}

extension ControllerSectionInfo: NSFetchedResultsSectionInfo {
    var name: String { return section.title() }
    var indexTitle: String { return "" }
    var numberOfObjects: Int { return fetchedInfo?.numberOfObjects ?? 0 }
    var objects: [AnyObject] { return fetchedInfo?.objects ?? [] }
}

{'fraction_non_alphanumeric': 0.2225392296718973, 'fraction_numerical': 0.009985734664764621, 'mean_word_length': 3.4382911392405062, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '2488032', 'n_tokens_mistral': 768, 'n_tokens_neox': 700, 'n_words': 165}