<commit_before>//
//  NetworkStatus.swift
//  ELReachability
//
//  Created by <NAME> on 8/13/15.
//  Copyright © 2015 WalmartLabs. All rights reserved.
//

import Foundation
import SystemConfiguration

@asmname("objc_startMonitoring")
internal func objc_startMonitoring(_: SCNetworkReachability, _: dispatch_block_t) -> ObjCBool

@asmname("objc_stopMonitoring")
internal func objc_stopMonitoring(_: SCNetworkReachability) -> ObjCBool

public struct NetworkStatusInterpreter {
    /// The actual flags reported by the system. This is used to compute if the network is reachable.
    public let flags: SCNetworkReachabilityFlags
    
    /// Returns `true` when the network is reachable. `false` otherwise.
    public var isReachable: Bool {
        var isReachable = flags.contains(SCNetworkReachabilityFlags.Reachable)
        
        // Check that this is not an oddity as per https://github.com/tonymillion/Reachability/blob/master/Reachability.m
        if flags.contains(SCNetworkReachabilityFlags.ConnectionRequired) || flags.contains(SCNetworkReachabilityFlags.TransientConnection) {
            isReachable = false
        }
        return isReachable
    }
    
    /// Returns `true` when the network is reachable via a cellular connection. `false` otherwise. Note: This check may give false negatives.
    public var isCellular: Bool {
        return flags.contains(SCNetworkReachabilityFlags.IsWWAN)
    }
    
    /// Returns `true` when the network is reachable via a WiFi connection. `false` otherwise. Note: This check may give false negatives.
    public var isWiFi: Bool {
        return self.isReachable && !self.isCellular
    }<commit_msg>Fix for Xcode 7.3 and Swift 2.2<commit_after>//
//  NetworkStatus.swift
//  ELReachability
//
//  Created by <NAME> on 8/13/15.
//  Copyright © 2015 WalmartLabs. All rights reserved.
//

import Foundation
import SystemConfiguration

@_silgen_name("objc_startMonitoring")
internal func objc_startMonitoring(_: SCNetworkReachability, _: dispatch_block_t) -> ObjCBool

@_silgen_name("objc_stopMonitoring")
internal func objc_stopMonitoring(_: SCNetworkReachability) -> ObjCBool

public struct NetworkStatusInterpreter {
    /// The actual flags reported by the system. This is used to compute if the network is reachable.
    public let flags: SCNetworkReachabilityFlags
    
    /// Returns `true` when the network is reachable. `false` otherwise.
    public var isReachable: Bool {
        var isReachable = flags.contains(SCNetworkReachabilityFlags.Reachable)
        
        // Check that this is not an oddity as per https://github.com/tonymillion/Reachability/blob/master/Reachability.m
        if flags.contains(SCNetworkReachabilityFlags.ConnectionRequired) || flags.contains(SCNetworkReachabilityFlags.TransientConnection) {
            isReachable = false
        }
        return isReachable
    }
    
    /// Returns `true` when the network is reachable via a cellular connection. `false` otherwise. Note: This check may give false negatives.
    public var isCellular: Bool {
        return flags.contains(SCNetworkReachabilityFlags.IsWWAN)
    }
    
    /// Returns `true` when the network is reachable via a WiFi connection. `false` otherwise. Note: This check may give false negatives.
    public var isWiFi: Bool {
        return self.isReachable && !self.isCellular
    }
{'fraction_non_alphanumeric': 0.08059701492537313, 'fraction_numerical': 0.006567164179104477, 'mean_word_length': 3.3918741808650066, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 2, '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': '3609025', 'n_tokens_mistral': 979, 'n_tokens_neox': 948, 'n_words': 290}