<commit_before>//
//  NewsViewController.swift
//  TOZ_iOS
//
//  Copyright © 2017 intive. All rights reserved.
//
import UIKit

class NewsViewController: UIViewController {

    @IBOutlet weak var newsTableView: UITableView!
    let newsOperation = NewsOperation()
    var localNewsList = [NewsItem]()

    override func viewDidLoad() {
        super.viewDidLoad()
        self.newsTableView.backgroundColor = Color.Background.primary
        getNews()
    }

}

extension NewsViewController: UITableViewDataSource {

    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {

        return localNewsList.count
    }

    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {

        let cell: NewsTableViewCell = (tableView.dequeueReusableCell(withIdentifier: "news_cell", for: indexPath) as? NewsTableViewCell)!
        cell.configure(with: localNewsList[indexPath.row])
        return cell

    }

    func getNews() {
        newsOperation.resultCompletion = { result in

            switch result {
            case .success(let newsList):
                DispatchQueue.main.async {
                    self.localNewsList = newsList
                    self.newsTableView.reloadData()
                }

            case .failure(let error):
                print ("\(error)")
            }
        }
        newsOperation.start()
    }
}

extension NewsViewController: UITableViewDelegate {

}<commit_msg>Changed architecture of NewsViewController and fixed force unwrapping NewsTableViewCell<commit_after>//
//  NewsViewController.swift
//  TOZ_iOS
//
//  Copyright © 2017 intive. All rights reserved.
//
import UIKit

class NewsViewController: UIViewController, UITableViewDataSource, UITableViewDelegate {

    @IBOutlet weak var newsTableView: UITableView!
    let newsOperation = NewsOperation()
    var localNewsList = [NewsItem]()

    override func viewDidLoad() {
        super.viewDidLoad()
        self.newsTableView.backgroundColor = Color.Background.primary
        getNews()
    }

    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {

        return localNewsList.count
    }

    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: "news_cell", for: indexPath)

        if let cell = cell as? NewsTableViewCell {
            cell.configure(with: localNewsList[indexPath.row])
        }
        return cell
    }

    func getNews() {
        newsOperation.resultCompletion = { result in

            switch result {
            case .success(let newsList):
                DispatchQueue.main.async {
                    self.localNewsList = newsList
                    self.newsTableView.reloadData()
                }
            case .failure(let error):
                print ("\(error)")
            }
        }
        newsOperation.start()
    }

}
{'fraction_non_alphanumeric': 0.08560959360426382, 'fraction_numerical': 0.002664890073284477, 'mean_word_length': 2.359060402684564, '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': '341150', 'n_tokens_mistral': 848, 'n_tokens_neox': 766, 'n_words': 187}