<commit_before>import Foundation
import SwiftyJSON
import Dispatch
import Core


let apis = try loadAPIJSONList()
let docs = try loadDocJSONList()

let group = DispatchGroup()

var errorShapeMap: [String: String] = [:]

for index in 0..<apis.count {
    let api = apis[index]
    let doc = docs[index]
    let serviceName = api["metadata"]["endpointPrefix"].stringValue.toSwiftClassCase()
    
    group.enter()
    DispatchQueue.global().async {
        do {
            log("Generating \(serviceName) codes ........")
            
            let service = try AWSService(fromAPIJSON: api, docJSON: doc)
            let basePath = "\(rootPath())/Sources/AWSSDKSwift/Services/\(service.endpointPrefix)/"
            _ = mkdirp(basePath)
            
            try service.generateServiceCode()
                .write(
                    toFile: "\(basePath)/\(service.serviceName)_API.swift",
                    atomically: true,
                    encoding: .utf8
                )
            
            try service.generateShapesCode()
                .write(
                    toFile: "\(basePath)/\(service.serviceName)_Shapes.swift",
                    atomically: true,
                    encoding: .utf8
                )
            
//            try service.generateInitializableFromDictionary()
//                .write(
//                    toFile: "\(basePath)/\(service.serviceName)_ShapesInitializableFromDictionary.swift",
//                    atomically: true,
//                    encoding: .utf8
//                )
            
            if !service.errorShapeNames.isEmpty {
                errorShapeMap[service.endpointPrefix] = service.serviceErrorName
                try service.generateErrorCode()
                    .write(
                        toFile: "\(basePath)/\(service.serviceName)_Error.swift",
                        atomically: true,
                        encoding: .utf8
                )
            }
            
            log("Succesfully Generated \(serviceName) codes!")
            group.leave()
        } catch {
            DispatchQueue.main.sync {
                print(error)
                exit(1)
            }
        }
    }
    //break
}

group.wait()

print("Done.")
<commit_msg>clean up<commit_after>import Foundation
import SwiftyJSON
import Dispatch
import Core


let apis = try loadAPIJSONList()
let docs = try loadDocJSONList()

let group = DispatchGroup()

var errorShapeMap: [String: String] = [:]

for index in 0..<apis.count {
    let api = apis[index]
    let doc = docs[index]
    let serviceName = api["metadata"]["endpointPrefix"].stringValue.toSwiftClassCase()
    
    group.enter()
    DispatchQueue.global().async {
        do {
            log("Generating \(serviceName) codes ........")
            
            let service = try AWSService(fromAPIJSON: api, docJSON: doc)
            let basePath = "\(rootPath())/Sources/AWSSDKSwift/Services/\(service.endpointPrefix)/"
            _ = mkdirp(basePath)
            
            try service.generateServiceCode()
                .write(
                    toFile: "\(basePath)/\(service.serviceName)_API.swift",
                    atomically: true,
                    encoding: .utf8
                )
            
            try service.generateShapesCode()
                .write(
                    toFile: "\(basePath)/\(service.serviceName)_Shapes.swift",
                    atomically: true,
                    encoding: .utf8
                )
            
            if !service.errorShapeNames.isEmpty {
                errorShapeMap[service.endpointPrefix] = service.serviceErrorName
                try service.generateErrorCode()
                    .write(
                        toFile: "\(basePath)/\(service.serviceName)_Error.swift",
                        atomically: true,
                        encoding: .utf8
                )
            }
            
            log("Succesfully Generated \(serviceName) codes!")
            group.leave()
        } catch {
            DispatchQueue.main.sync {
                print(error)
                exit(1)
            }
        }
    }
}

group.wait()

print("Done.")

{'fraction_non_alphanumeric': 0.10637791527843884, 'fraction_numerical': 0.002617801047120419, 'mean_word_length': 1.3718961625282167, 'pattern_counts': {'":': 0, '<': 5, '<?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': '3929351', 'n_tokens_mistral': 1121, 'n_tokens_neox': 1045, 'n_words': 201}