<commit_before>//
//  main.swift
//  partial-md5s
//
//  Created by <NAME> on 5/19/17.
//  Copyright © 2017 <NAME>. All rights reserved.
//

import Foundation
import os

guard let arguments = CommandLine.parseArguments() else {
    Arguments.printUsage()
    exit(EXIT_FAILURE)
}

let inputURL = URL(fileURLWithPath: arguments.inputPath)

if #available(OSX 10.12, *) {
    os_log("Opening file at path %@",
           log: .default,
           type: .info,
           arguments.inputPath)
}

do {
    let data = try Data.init(contentsOf: inputURL, options: .alwaysMapped)
    
    if #available(OSX 10.12, *) {
        os_log("Using chunk size of %{bytes}d",
               log: .default,
               type: .info,
               arguments.chunkSize)
    }
    
    data.withChunks(ofSize: arguments.chunkSize) { subdata in
        print(subdata.md5)
    }
}
catch {
    if #available(OSX 10.12, *) {
        os_log("Error opening file at %@: %@",
               log: .default,
               type: .error,
               arguments.inputPath, error.localizedDescription)
    }
    
    exit(EXIT_FAILURE)
}
<commit_msg>Use “macOS” instead of “OSX.”<commit_after>//
//  main.swift
//  partial-md5s
//
//  Created by <NAME> on 5/19/17.
//  Copyright © 2017 <NAME>. All rights reserved.
//

import Foundation
import os

guard let arguments = CommandLine.parseArguments() else {
    Arguments.printUsage()
    exit(EXIT_FAILURE)
}

let inputURL = URL(fileURLWithPath: arguments.inputPath)

if #available(macOS 10.12, *) {
    os_log("Opening file at path %@",
           log: .default,
           type: .info,
           arguments.inputPath)
}

do {
    let data = try Data.init(contentsOf: inputURL, options: .alwaysMapped)
    
    if #available(macOS 10.12, *) {
        os_log("Using chunk size of %{bytes}d",
               log: .default,
               type: .info,
               arguments.chunkSize)
    }
    
    data.withChunks(ofSize: arguments.chunkSize) { subdata in
        print(subdata.md5)
    }
}
catch {
    if #available(macOS 10.12, *) {
        os_log("Error opening file at %@: %@",
               log: .default,
               type: .error,
               arguments.inputPath, error.localizedDescription)
    }
    
    exit(EXIT_FAILURE)
}

{'fraction_non_alphanumeric': 0.12676678445229683, 'fraction_numerical': 0.020318021201413426, 'mean_word_length': 2.0443548387096775, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '5684550', 'n_tokens_mistral': 763, 'n_tokens_neox': 732, 'n_words': 170}