<commit_before>//
//  RxPickerViewDataSourceProxy.swift
//  RxCocoa
//
//  Created by <NAME> on 05/07/2017.
//  Copyright © 2017 <NAME>. All rights reserved.
//

#if os(iOS) || os(tvOS)

    import UIKit
#if !RX_NO_MODULE
    import RxSwift
#endif

let pickerViewDataSourceNotSet = PickerViewDataSourceNotSet()

final class PickerViewDataSourceNotSet: NSObject, UIPickerViewDataSource {
    func numberOfComponents(in pickerView: UIPickerView) -> Int {
        rxAbstractMethod()
    }
    
    func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
        rxAbstractMethod()
    }
}

public class RxPickerViewDataSourceProxy
    : DelegateProxy
    , UIPickerViewDataSource
    , DelegateProxyType {
    public weak fileprivate(set) var pickerView: UIPickerView?
    private weak var _requiredMethodsDataSource: UIPickerViewDataSource? = pickerViewDataSourceNotSet
    
    public required init(parentObject: AnyObject) {
        self.pickerView = castOrFatalError(parentObject)
        super.init(parentObject: parentObject)
    }
    
    
    // MARK: UIPickerViewDataSource
    
    public func numberOfComponents(in pickerView: UIPickerView) -> Int {
        return (_requiredMethodsDataSource ?? pickerViewDataSourceNotSet).numberOfComponents(in: pickerView)
    }
    
    public func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
        return (_requiredMethodsDataSource ?? pickerViewDataSourceNotSet).pickerView(pickerView, numberOfRowsInComponent: component)
    }
    
    // MARK: proxy
    
    /// For more information take a look at `DelegateProxyType`.
    public override class func createProxyForObject(_ object: AnyObject) -> AnyObject {
        let pickerView: UIPickerView = castOrFatalError(object)
        return pickerView.createRxDataSourceProxy()
    }
    
    /// For more information take a look at `DelegateProxyType`.
    public override class func delegateAssociatedObjectTag() -> UnsafeRawPointer {
        return dataSourceAssociatedTag
    }
    
    /// For more information take a look at `DelegateProxyType`.
    public class func setCurrentDelegate(_ delegate: AnyObject?, toObject object: AnyObject) {
        let pickerView: UIPickerView = castOrFatalError(object)
        pickerView.dataSource = castOptionalOrFatalError(delegate)
    }
    
    /// For more information take a look at `DelegateProxyType`.
    public class func currentDelegateFor(_ object: AnyObject) -> AnyObject? {
        let tableView: UITableView = castOrFatalError(object)
        return tableView.dataSource
    }
    
    /// For more information take a look at `DelegateProxyType`.
    public override func setForwardToDelegate(_ forwardToDelegate: AnyObject?, retainDelegate: Bool) {<commit_msg>Default to 0 components and items<commit_after>//
//  RxPickerViewDataSourceProxy.swift
//  RxCocoa
//
//  Created by <NAME> on 05/07/2017.
//  Copyright © 2017 <NAME>. All rights reserved.
//

#if os(iOS) || os(tvOS)

    import UIKit
#if !RX_NO_MODULE
    import RxSwift
#endif

let pickerViewDataSourceNotSet = PickerViewDataSourceNotSet()

final class PickerViewDataSourceNotSet: NSObject, UIPickerViewDataSource {
    func numberOfComponents(in pickerView: UIPickerView) -> Int {
        return 0
    }
    
    func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
        return 0
    }
}

public class RxPickerViewDataSourceProxy
    : DelegateProxy
    , UIPickerViewDataSource
    , DelegateProxyType {
    public weak fileprivate(set) var pickerView: UIPickerView?
    private weak var _requiredMethodsDataSource: UIPickerViewDataSource? = pickerViewDataSourceNotSet
    
    public required init(parentObject: AnyObject) {
        self.pickerView = castOrFatalError(parentObject)
        super.init(parentObject: parentObject)
    }
    
    
    // MARK: UIPickerViewDataSource
    
    public func numberOfComponents(in pickerView: UIPickerView) -> Int {
        return (_requiredMethodsDataSource ?? pickerViewDataSourceNotSet).numberOfComponents(in: pickerView)
    }
    
    public func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
        return (_requiredMethodsDataSource ?? pickerViewDataSourceNotSet).pickerView(pickerView, numberOfRowsInComponent: component)
    }
    
    // MARK: proxy
    
    /// For more information take a look at `DelegateProxyType`.
    public override class func createProxyForObject(_ object: AnyObject) -> AnyObject {
        let pickerView: UIPickerView = castOrFatalError(object)
        return pickerView.createRxDataSourceProxy()
    }
    
    /// For more information take a look at `DelegateProxyType`.
    public override class func delegateAssociatedObjectTag() -> UnsafeRawPointer {
        return dataSourceAssociatedTag
    }
    
    /// For more information take a look at `DelegateProxyType`.
    public class func setCurrentDelegate(_ delegate: AnyObject?, toObject object: AnyObject) {
        let pickerView: UIPickerView = castOrFatalError(object)
        pickerView.dataSource = castOptionalOrFatalError(delegate)
    }
    
    /// For more information take a look at `DelegateProxyType`.
    public class func currentDelegateFor(_ object: AnyObject) -> AnyObject? {
        let pickerView: UIPickerView = castOrFatalError(object)
        return pickerView.dataSource
    }
    
    /// For more information take a look at `DelegateProxyType`.
    public override func setForwardToDelegate(_ forwardToDelegate: AnyObject?, retainDelegate: Bool) {
{'fraction_non_alphanumeric': 0.07570076772005, 'fraction_numerical': 0.0048205677557579, 'mean_word_length': 3.5104669887278583, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 21, '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': '4225084', 'n_tokens_mistral': 1571, 'n_tokens_neox': 1509, 'n_words': 407}