<commit_before>import Foundation

let spamDirectory = ".spam"

private extension Repo {
    var installPath: String {
        get {
            return spamDirectory + "/" + username + "/" + reponame
        }
    }
}

// MARK: subcommands

func install() {
    let fileManager = NSFileManager()

    func install(repo: Repo) {
        mkdir(spamDirectory)
        call("git", "clone", repo.path, repo.installPath)
    }

    let path = "example.swift"
    if let streamReader = StreamReader(path: path) {
        var line: String?
        while let line = streamReader.nextLine() {
            if let repo = Repo(importStatement: line) {
                if !fileManager.fileExistsAtPath(repo.installPath) {
                    install(repo)
                }
            }
        }
    } else {
        error("could not read \(path)")
    }
}

func uninstall() {
    call("rm", "-rf", spamDirectory)
}

func compile() {
    mkdir("\(spamDirectory)/build")
    call("swiftc", "-emit-library", "-emit-object",
         ".spam/aclissold/Module/Module.swift", "-module-name", "Module", "-o",
         ".spam/build/Module.o")
    call("ar", "rcs", "libmodule.a", ".spam/build/Module.o")
    call("mv", "libmodule.a", ".spam/build/")
    call("swiftc", "-emit-module", ".spam/aclissold/Module/Module.swift",
         "-module-name", "Module", "-o", ".spam/build/")
    call("swiftc", "-I", ".spam/build", "-L", ".spam/build", "-lmodule",
         "example.swift")
}

// MARK: entry point

if contains(Process.arguments, "install") || contains(Process.arguments, "i") {
    install()
} else if contains(Process.arguments, "uninstall") || contains(Process.arguments, "u") {
    uninstall()
} else if contains(Process.arguments, "compile") || contains(Process.arguments, "c") {
    compile()
} else {
    usage()
}<commit_msg>Generalize module name in compile function<commit_after>import Foundation

let spamDirectory = ".spam"

private extension Repo {
    var installPath: String {
        get {
            return spamDirectory + "/" + username + "/" + reponame
        }
    }
}

// MARK: subcommands

func install() {
    let fileManager = NSFileManager()

    func install(repo: Repo) {
        mkdir(spamDirectory)
        call("git", "clone", repo.path, repo.installPath)
    }

    let path = "example.swift"
    if let streamReader = StreamReader(path: path) {
        var line: String?
        while let line = streamReader.nextLine() {
            if let repo = Repo(importStatement: line) {
                if !fileManager.fileExistsAtPath(repo.installPath) {
                    install(repo)
                }
            }
        }
    } else {
        error("could not read \(path)")
    }
}

func uninstall() {
    call("rm", "-rf", spamDirectory)
}

func compile(moduleName: String) {
    let M = moduleName
    let m = moduleName.lowercaseString

    mkdir("\(spamDirectory)/build")
    call("swiftc", "-emit-library", "-emit-object",
         ".spam/aclissold/\(M)/\(M).swift", "-module-name", M, "-o",
         ".spam/build/\(M).o")
    call("ar", "rcs", "lib\(m).a", ".spam/build/\(M).o")
    call("mv", "lib\(m).a", ".spam/build/")
    call("swiftc", "-emit-module", ".spam/aclissold/\(M)/\(M).swift",
         "-module-name", "\(M)", "-o", ".spam/build/")
    call("swiftc", "-I", ".spam/build", "-L", ".spam/build", "-l\(m)",
         "example.swift")
}

// MARK: entry point

if contains(Process.arguments, "install") || contains(Process.arguments, "i") {
    install()
} else if contains(Process.arguments, "uninstall") || contains(Process.arguments, "u") {
    uninstall()
} else if contains(Process.arguments, "compile") || contains(Process.arguments, "c") {
    compile("Module")
} else {
    usage()
}
{'fraction_non_alphanumeric': 0.17976925140863967, 'fraction_numerical': 0.0, 'mean_word_length': 2.4939081537019683, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1149862', 'n_tokens_mistral': 1217, 'n_tokens_neox': 1171, 'n_words': 254}