<commit_before>//
//  SYStreamRequest.swift
//  SYNetwork
//
//  Created by <NAME> on 2017/2/9.
//  Copyright © 2017年 <NAME>. All rights reserved.
//

import Foundation
import Alamofire

open class SYStreamRequest: SYRequest {
    
    //MARK: - Properties
    
    /// The hostname of the server to connect to.
    
    var hostName: String {
        return ""
    }
    
    /// The port of the server to connect to.
    
    var port: Int {
        return 0
    }
    
    /// The net service used to identify the endpoint.
    
    var netService: NetService? {
        return nil
    }
    
    /// override current alamofireRequest
    
    override var alamofireRequest: Request {
        if #available(iOS 9.0, *) {
            return self.configStreamRequest()
        }
        return super.alamofireRequest
    }
}

//MARK: - Private SYStreamRequest

private extension SYStreamRequest {
    
    @available(iOS 9.0, *)
    func configStreamRequest() -> Alamofire.StreamRequest {
        if let netService = self.netService {
            return SYSessionManager.sharedInstance.stream(with: netService)
        } else {
            return SYSessionManager.sharedInstance.stream(withHostName: self.hostName, port: self.port)
        }
    }
}<commit_msg>add available<commit_after>//
//  SYStreamRequest.swift
//  SYNetwork
//
//  Created by <NAME> on 2017/2/9.
//  Copyright © 2017年 <NAME>. All rights reserved.
//

import Foundation
import Alamofire

#if !os(watchOS)
    
/// Specific type of `Request` that manages an underlying `URLSessionStreamTask`.
@available(iOS 9.0, macOS 10.11, tvOS 9.0, *)
    
open class SYStreamRequest: SYRequest {
    
    //MARK: - Properties
    
    /// The hostname of the server to connect to.
    
    var hostName: String {
        return ""
    }
    
    /// The port of the server to connect to.
    
    var port: Int {
        return 0
    }
    
    /// The net service used to identify the endpoint.
    
    var netService: NetService? {
        return nil
    }
    
    /// override current alamofireRequest
    
    override var alamofireRequest: Request {
        return self.configStreamRequest()
    }
}
    
#endif

//MARK: - Private SYStreamRequest

#if !os(watchOS)
    
@available(iOS 9.0, macOS 10.11, tvOS 9.0, *)
    
private extension SYStreamRequest {
    
    @available(iOS 9.0, macOS 10.11, tvOS 9.0, *)
    func configStreamRequest() -> Alamofire.StreamRequest {
        if let netService = self.netService {
            return SYSessionManager.sharedInstance.stream(with: netService)
        } else {
            return SYSessionManager.sharedInstance.stream(withHostName: self.hostName, port: self.port)
        }
    }
}
    
#endif
{'fraction_non_alphanumeric': 0.09774990778310587, 'fraction_numerical': 0.018443378827001106, 'mean_word_length': 2.074829931972789, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, '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': '1531830', 'n_tokens_mistral': 853, 'n_tokens_neox': 812, 'n_words': 229}