<commit_before>//
//  NetworkAsyncStream.swift
//  iAsync_network
//
//  Created by <NAME> on 26.09.14.
//  Copyright © 2014 EmbeddedSources. All rights reserved.
//

import Foundation

import protocol iAsync_reactiveKit.AsyncStreamInterface
import iAsync_utils

internal typealias JNetworkErrorTransformer = (_ error: NSError) -> NSError

public enum NetworkProgress {

    case download(NetworkResponseDataCallback)
    case upload(NetworkUploadProgressCallback)
}

final class NetworkAsyncStream : AsyncStreamInterface {

    typealias ValueT = HTTPURLResponse
    typealias NextT  = NetworkProgress
    typealias ErrorT = ErrorWithContext

    fileprivate let params          : URLConnectionParams
    fileprivate let errorTransformer: JNetworkErrorTransformer?

    fileprivate var connection: NSURLSessionConnection?

    init(params: URLConnectionParams, errorTransformer: JNetworkErrorTransformer?) {

        self.params           = params
        self.errorTransformer = errorTransformer
    }

    public func asyncWithCallbacks(_ success: @escaping (ValueT) -> Void, next: @escaping (NextT) -> Void, error: @escaping (ErrorT) -> Void) {
<commit_msg>move to swift 3<commit_after>//
//  NetworkAsyncStream.swift
//  iAsync_network
//
//  Created by <NAME> on 26.09.14.
//  Copyright © 2014 EmbeddedSources. All rights reserved.
//

import Foundation

import protocol iAsync_reactiveKit.AsyncStreamInterface
import iAsync_utils

internal typealias JNetworkErrorTransformer = (_ error: NSError) -> NSError

public enum NetworkProgress {

    case download(NetworkResponseDataCallback)
    case upload(NetworkUploadProgressCallback)
}

final class NetworkAsyncStream : AsyncStreamInterface {

    typealias ValueT = HTTPURLResponse
    typealias NextT  = NetworkProgress
    typealias ErrorT = ErrorWithContext

    fileprivate let params          : URLConnectionParams
    fileprivate let errorTransformer: JNetworkErrorTransformer?

    fileprivate var connection: NSURLSessionConnection?

    init(params: URLConnectionParams, errorTransformer: JNetworkErrorTransformer?) {

        self.params           = params
        self.errorTransformer = errorTransformer
    }

    public func asyncWithCallbacks(
        success: @escaping (ValueT) -> Void,
        next   : @escaping (NextT)  -> Void,
        error  : @escaping (ErrorT) -> Void) {

{'fraction_non_alphanumeric': 0.07139821504462389, 'fraction_numerical': 0.008924776880577986, 'mean_word_length': 3.745967741935484, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6701787', 'n_tokens_mistral': 668, 'n_tokens_neox': 618, 'n_words': 169}