<commit_before>import Alamofire
import RxSwift
import Unbox

extension DataRequest {
    @discardableResult
    public func responseValue<T: Unboxable>(
        queue: DispatchQueue? = nil,
        completionHandler: @escaping (DataResponse<T>) -> Void)
        -> Self
    {
        return response(
            queue: queue,
            responseSerializer: unboxResponseSerializer(),
            completionHandler: completionHandler
        )
    }

    @discardableResult
    public func responseValue<T: Unboxable>(
        queue: DispatchQueue? = nil,
        completionHandler: @escaping (DataResponse<[T]>) -> Void)
        -> Self
    {
        return response(
            queue: queue,
            responseSerializer: unboxResponseSerializer(),
            completionHandler: completionHandler
        )
    }
}

extension Reactive where Base == DataRequest {
    func value<T: Unboxable>() -> Observable<T> {
        return Observable.create { observer in
            let request = self.base

            request.responseValue { (response: DataResponse<T>) in
                switch response.result {
                case .success(let value):
                    observer.onNext(value)
                    observer.onCompleted()
                case .failure(let error):
                    observer.onError(error)
                }
            }

            return Disposables.create {
                request.cancel()
            }
        }<commit_msg>Model HTTP requests using the Single trait<commit_after>import Alamofire
import RxSwift
import Unbox

extension DataRequest {
    @discardableResult
    public func responseValue<T: Unboxable>(
        queue: DispatchQueue? = nil,
        completionHandler: @escaping (DataResponse<T>) -> Void)
        -> Self
    {
        return response(
            queue: queue,
            responseSerializer: unboxResponseSerializer(),
            completionHandler: completionHandler
        )
    }

    @discardableResult
    public func responseValue<T: Unboxable>(
        queue: DispatchQueue? = nil,
        completionHandler: @escaping (DataResponse<[T]>) -> Void)
        -> Self
    {
        return response(
            queue: queue,
            responseSerializer: unboxResponseSerializer(),
            completionHandler: completionHandler
        )
    }
}

extension Reactive where Base == DataRequest {
    func value<T: Unboxable>() -> Single<T> {
        return .create { commit in
            let request = self.base

            request.responseValue { (response: DataResponse<T>) in
                switch response.result {
                case .success(let value):
                    commit(.success(value))
                case .failure(let error):
                    commit(.error(error))
                }
            }

            return Disposables.create {
                request.cancel()
            }
        }
{'fraction_non_alphanumeric': 0.08370651050637272, 'fraction_numerical': 0.0, 'mean_word_length': 1.75260663507109, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 27, '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': '7551957', 'n_tokens_mistral': 726, 'n_tokens_neox': 689, 'n_words': 173}