<commit_before>//
//  ObservableType+Extensions.swift
//  RxSwift
//
//  Created by <NAME> on 2/21/15.
//  Copyright © 2015 <NAME>. All rights reserved.
//

extension ObservableType {
    /**
    Subscribes an event handler to an observable sequence.

    - parameter on: Action to invoke for each event in the observable sequence.
    - returns: Subscription object used to unsubscribe from the observable sequence.
    */
    public func subscribe(_ on: @escaping (Event<E>) -> Void)
        -> Disposable {
        let observer = AnonymousObserver { e in
            on(e)
        }
        return self.subscribeSafe(observer)
    }

    #if DEBUG
        /**
        Subscribes an element handler, an error handler, a completion handler and disposed handler to an observable sequence.

        - parameter onNext: Action to invoke for each element in the observable sequence.
        - parameter onError: Action to invoke upon errored termination of the observable sequence.
        - parameter onCompleted: Action to invoke upon graceful termination of the observable sequence.
        - parameter onDisposed: Action to invoke upon any type of termination of sequence (if the sequence has
            gracefully completed, errored, or if the generation is canceled by disposing subscription).
        - returns: Subscription object used to unsubscribe from the observable sequence.
        */
        public func subscribe(file: String = #file, line: UInt = #line, function: String = #function, onNext: ((E) -> Void)? = nil, onError: ((Swift.Error) -> Void)? = nil, onCompleted: (() -> Void)? = nil, onDisposed: (() -> Void)? = nil)
            -> Disposable {

            let disposable: Disposable

            if let disposed = onDisposed {
                disposable = Disposables.create(with: disposed)
            }
            else {
                disposable = Disposables.create()
            }

            #if DEBUG
                let _synchronizationTracker = SynchronizationTracker()
            #endif

            let observer = AnonymousObserver<E> { e in
                #if DEBUG
                    _synchronizationTracker.register(synchronizationErrorMessage: .default)
                    defer { _synchronizationTracker.unregister() }
                #endif

                switch e {
                case .next(let value):
                    onNext?(value)
                case .error(let e):
                    if let onError = onError {
                        onError(e)
                    }
                    else {
                        print("Received unhandled error: \(file):\(line):\(function) -> \(e)")
                    }
                    disposable.dispose()
                case .completed:
                    onCompleted?()
                    disposable.dispose()
                }
            }
            return Disposables.create(
                self.subscribeSafe(observer),
                disposable
            )
        }
    #else
        /**
        Subscribes an element handler, an error handler, a completion handler and disposed handler to an observable sequence.

        - parameter onNext: Action to invoke for each element in the observable sequence.
        - parameter onError: Action to invoke upon errored termination of the observable sequence.
        - parameter onCompleted: Action to invoke upon graceful termination of the observable sequence.
        - parameter onDisposed: Action to invoke upon any type of termination of sequence (if the sequence has
            gracefully completed, errored, or if the generation is canceled by disposing subscription).
        - returns: Subscription object used to unsubscribe from the observable sequence.
        */
        public func subscribe(onNext: ((E) -> Void)? = nil, onError: ((Swift.Error) -> Void)? = nil, onCompleted: (() -> Void)? = nil, onDisposed: (() -> Void)? = nil)
            -> Disposable {

            let disposable: Disposable

            if let disposed = onDisposed {
                disposable = Disposables.create(with: disposed)
            }
            else {
                disposable = Disposables.create()
            }

            let observer = AnonymousObserver<E> { e in
                switch e {
                case .next(let value):
                    onNext?(value)
                case .error(let e):
                    onError?(e)
                    disposable.dispose()
                case .completed:
                    onCompleted?()
                    disposable.dispose()
                }
            }
            return Disposables.create(
                self.subscribeSafe(observer),
                disposable
            )
        }
    #endif
}

extension ObservableType {
    /// All internal subscribe calls go through this method.
    fileprivate func subscribeSafe<O: ObserverType>(_ observer: O) -> Disposable where O.E == E {
        return self.asObservable().subscribe(observer)
    }
}<commit_msg>fix remove method signature inconsistence<commit_after>//
//  ObservableType+Extensions.swift
//  RxSwift
//
//  Created by <NAME> on 2/21/15.
//  Copyright © 2015 <NAME>. All rights reserved.
//

extension ObservableType {
    /**
     Subscribes an event handler to an observable sequence.
     
     - parameter on: Action to invoke for each event in the observable sequence.
     - returns: Subscription object used to unsubscribe from the observable sequence.
     */
    public func subscribe(_ on: @escaping (Event<E>) -> Void)
        -> Disposable {
            let observer = AnonymousObserver { e in
                on(e)
            }
            return self.subscribeSafe(observer)
    }
    
    
    /**
     Subscribes an element handler, an error handler, a completion handler and disposed handler to an observable sequence.
     
     - parameter onNext: Action to invoke for each element in the observable sequence.
     - parameter onError: Action to invoke upon errored termination of the observable sequence.
     - parameter onCompleted: Action to invoke upon graceful termination of the observable sequence.
     - parameter onDisposed: Action to invoke upon any type of termination of sequence (if the sequence has
     gracefully completed, errored, or if the generation is canceled by disposing subscription).
     - returns: Subscription object used to unsubscribe from the observable sequence.
     */
    public func subscribe(file: String = #file, line: UInt = #line, function: String = #function, onNext: ((E) -> Void)? = nil, onError: ((Swift.Error) -> Void)? = nil, onCompleted: (() -> Void)? = nil, onDisposed: (() -> Void)? = nil)
        -> Disposable {
            
            #if DEBUG
                
                
                let disposable: Disposable
                
                if let disposed = onDisposed {
                    disposable = Disposables.create(with: disposed)
                }
                else {
                    disposable = Disposables.create()
                }
                
                let _synchronizationTracker = SynchronizationTracker()
                
                let observer = AnonymousObserver<E> { e in
                    
                    _synchronizationTracker.register(synchronizationErrorMessage: .default)
                    defer { _synchronizationTracker.unregister() }
                    
                    
                    switch e {
                    case .next(let value):
                        onNext?(value)
                    case .error(let e):
                        if let onError = onError {
                            onError(e)
                        }
                        else {
                            print("Received unhandled error: \(file):\(line):\(function) -> \(e)")
                        }
                        disposable.dispose()
                    case .completed:
                        onCompleted?()
                        disposable.dispose()
                    }
                }
                return Disposables.create(
                    self.subscribeSafe(observer),
                    disposable
                )
            #else
                
                let disposable: Disposable
                
                if let disposed = onDisposed {
                    disposable = Disposables.create(with: disposed)
                }
                else {
                    disposable = Disposables.create()
                }
                
                let observer = AnonymousObserver<E> { e in
                    switch e {
                    case .next(let value):
                        onNext?(value)
                    case .error(let e):
                        onError?(e)
                        disposable.dispose()
                    case .completed:
                        onCompleted?()
                        disposable.dispose()
                    }
                }
                return Disposables.create(
                    self.subscribeSafe(observer),
                    disposable
                )
            #endif
            
    }
}

extension ObservableType {
    /// All internal subscribe calls go through this method.
    fileprivate func subscribeSafe<O: ObserverType>(_ observer: O) -> Disposable where O.E == E {
        return self.asObservable().subscribe(observer)
    }
}
{'fraction_non_alphanumeric': 0.07680898400254264, 'fraction_numerical': 0.0019069816717872657, 'mean_word_length': 1.438646344613795, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 38, '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': '7472524', 'n_tokens_mistral': 2307, 'n_tokens_neox': 2070, 'n_words': 712}