<commit_before>import RxSwift
import RxBluetoothKit
import UIKit

/* Generic UITableViewDataSource. I - represents model type, S - represents SectionModelItem, which stores
   information about given section's itemsCount, sectionName, cells' class and provides collection of model data
   check: DataSource.SectionModelItem.swift
*/

final class TableViewDataSource<S: SectionModelItem>: NSObject, UITableViewDataSource {

    // MARK: - Typealiases

    // Block set by given UIViewController, meant to be called for reloading data
    typealias RefreshDataBlock = () -> Void

    // Block set by given UIViewController, meant to be called inside at any OnError
    typealias OnErrorBlock = (_ error: Error) -> Void

    // MARK: - Fields
    private var refreshDataBlock: RefreshDataBlock = {
    }

    private var onErrorBlock: OnErrorBlock = { _ in
    }

    private let itemsSubject = PublishSubject<S.ModelDataType>()

    private let dataItem: S

    private let disposeBag = DisposeBag()

    // MARK: - Initialization
    init(dataItem: S) {
        self.dataItem = dataItem
        super.init()
        bindData()
    }


    // MARK: - Methods
    func bindData() {
        itemsSubject.subscribe(onNext: { [weak self] item in
            self?.dataItem.append(item)
            self?.refreshData()
        }, onError: { [unowned self] (error) in
            self.onErrorBlock(error)
        }).disposed(by: disposeBag)
    }
<commit_msg>Changed weakified self in TableViewDataSource to unowned<commit_after>import RxSwift
import RxBluetoothKit
import UIKit

/* Generic UITableViewDataSource. I - represents model type, S - represents SectionModelItem, which stores
   information about given section's itemsCount, sectionName, cells' class and provides collection of model data
   check: DataSource.SectionModelItem.swift
*/

final class TableViewDataSource<S: SectionModelItem>: NSObject, UITableViewDataSource {

    // MARK: - Typealiases

    // Block set by given UIViewController, meant to be called for reloading data
    typealias RefreshDataBlock = () -> Void

    // Block set by given UIViewController, meant to be called inside at any OnError
    typealias OnErrorBlock = (_ error: Error) -> Void

    // MARK: - Fields
    private var refreshDataBlock: RefreshDataBlock = {
    }

    private var onErrorBlock: OnErrorBlock = { _ in
    }

    private let itemsSubject = PublishSubject<S.ModelDataType>()

    private let dataItem: S

    private let disposeBag = DisposeBag()

    // MARK: - Initialization
    init(dataItem: S) {
        self.dataItem = dataItem
        super.init()
        bindData()
    }


    // MARK: - Methods
    func bindData() {
        itemsSubject.subscribe(onNext: { [unowned self] item in
            self.dataItem.append(item)
            self.refreshData()
        }, onError: { [unowned self] (error) in
            self.onErrorBlock(error)
        }).disposed(by: disposeBag)
    }

{'fraction_non_alphanumeric': 0.0835030549898167, 'fraction_numerical': 0.0, 'mean_word_length': 2.892998678996037, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, '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': '3871983', 'n_tokens_mistral': 838, 'n_tokens_neox': 777, 'n_words': 254}