<commit_before>import UIKit

class ViewController: UITableViewController, UITableViewDelegate, UITableViewDataSource {
    let SYNCCellIdentifier = "CellID"
    let SYNCReloadTableNotification = "SYNCReloadTableNotification"

    let dataStack: DATAStack!
    var arrayWithData = [Data]()

    // MARK: Initializers

    required init(dataStack: DATAStack) {
        super.init(nibName: nil, bundle: nil);
        self.dataStack = dataStack
    }

    required init(coder aDecoder: NSCoder) {
        super.init(nibName: nil, bundle: nil);
    }

    // MARK: View Lifecycle

    override func viewDidLoad() {
        super.viewDidLoad()

        self.arrayWithData = Array()

        self.title = "AppNet"

        self.tableView.registerClass(UITableViewCell.classForCoder(), forCellReuseIdentifier: SYNCCellIdentifier)
        self.tableView.allowsSelection = false

        fetchCurrentObjects()

        let notificationCenter = NSNotificationCenter.defaultCenter()
        notificationCenter.addObserver(self, selector: "finishedFetchingPosts", name: SYNCReloadTableNotification, object: nil)
    }

    override func viewDidAppear(animated: Bool) {
        super.viewDidAppear(true)
        fetchNewData()
    }

    // MARK: TableView methods

    override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return arrayWithData.count
    }

    override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        let cell = self.tableView.dequeueReusableCellWithIdentifier(SYNCCellIdentifier) as UITableViewCell
        let data = self.arrayWithData[indexPath.row]

        cell = UITableViewCell(style: UITableViewCellStyle.Subtitle, reuseIdentifier: SYNCCellIdentifier)

        cell.textLabel!.text = data.text
        cell.textLabel!.numberOfLines = 1000
        cell.detailTextLabel!.text = data.user.username

        return cell
    }

    // MARK: Notification

    func finishedFetchingPosts() {
        fetchCurrentObjects()
    }

    // MARK: Networking methods

    func fetchNewData() {
        let networking = Networking(dataStack: dataStack)
        networking.fetchNewContent()
    }

    // MARK: Model methods

    func fetchCurrentObjects() {
        let request = NSFetchRequest(entityName: "Data")
        request.sortDescriptors = [NSSortDescriptor(key: "createdAt", ascending: true)]
        self.arrayWithData = self.dataStack.mainContext.executeFetchRequest(request, error: nil) as Array
        
        self.tableView.reloadData()
    }

}
<commit_msg>Refactor<commit_after>import UIKit

class ViewController: UITableViewController, UITableViewDelegate, UITableViewDataSource {
    let SYNCCellIdentifier = "CellID"
    let SYNCReloadTableNotification = "SYNCReloadTableNotification"

    let dataStack: DATAStack!
    var arrayWithData = [Data]()

    // MARK: Initializers

    required init(dataStack: DATAStack) {
        super.init(nibName: nil, bundle: nil);
        self.dataStack = dataStack
    }

    required init(coder aDecoder: NSCoder) {
        super.init(nibName: nil, bundle: nil);
    }

    // MARK: View Lifecycle

    override func viewDidLoad() {
        super.viewDidLoad()

        self.arrayWithData = Array()

        self.title = "AppNet"

        self.tableView.registerClass(UITableViewCell.classForCoder(), forCellReuseIdentifier: SYNCCellIdentifier)
        self.tableView.allowsSelection = false

        fetchCurrentObjects()

        let notificationCenter = NSNotificationCenter.defaultCenter()
        notificationCenter.addObserver(self, selector: "finishedFetchingPosts", name: SYNCReloadTableNotification, object: nil)
    }

    override func viewDidAppear(animated: Bool) {
        super.viewDidAppear(true)
        fetchNewData()
    }

    // MARK: TableView methods

    override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return arrayWithData.count
    }

    override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        var cell = self.tableView.dequeueReusableCellWithIdentifier(SYNCCellIdentifier) as UITableViewCell
        let data = self.arrayWithData[indexPath.row]

        cell = UITableViewCell(style: UITableViewCellStyle.Subtitle, reuseIdentifier: SYNCCellIdentifier)

        cell.textLabel?.text = data.text
        cell.textLabel?.numberOfLines = 1000
        cell.detailTextLabel?.text = data.user.username

        return cell
    }

    // MARK: Notification

    func finishedFetchingPosts() {
        fetchCurrentObjects()
    }

    // MARK: Networking methods

    func fetchNewData() {
        let networking = Networking(dataStack: dataStack)
        networking.fetchNewContent()
    }

    // MARK: Model methods

    func fetchCurrentObjects() {
        let request = NSFetchRequest(entityName: "Data")
        request.sortDescriptors = [NSSortDescriptor(key: "createdAt", ascending: true)]
        self.arrayWithData = self.dataStack.mainContext.executeFetchRequest(request, error: nil) as Array
        
        tableView.reloadData()
    }
}

{'fraction_non_alphanumeric': 0.08544855648130208, 'fraction_numerical': 0.0015500871924045726, 'mean_word_length': 3.186536901865369, 'pattern_counts': {'":': 0, '<': 3, '<?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': '1213346', 'n_tokens_mistral': 1522, 'n_tokens_neox': 1398, 'n_words': 298}