<commit_before>import Foundation

public class Provider {

    var translations: [String: NSData] = [:]

    public func dataForLocale(locale: String) -> NSData? {
        var translation: NSData?

        if let translationData = translations[locale] {
            translation = translationData
        } else {
            let bundle = NSBundle(forClass: Provider.self)
            if let path = bundle.pathForResource(locale, ofType: Config.pathExtension, inDirectory: Config.dirPath) {
                if let fileURL: NSURL = NSURL(fileURLWithPath: path) {
                    if let data = NSData(contentsOfURL: fileURL) {
                        translation = data
                        translations[locale] = data
                    }
                }
            }
        }

        return translation
    }
}<commit_msg>Use optional bindings<commit_after>import Foundation

public class Provider {

    var translations: [String: NSData] = [:]

    public func dataForLocale(locale: String) -> NSData? {
        var translation: NSData?

        if let translationData = translations[locale] {
            translation = translationData
        } else {
            let bundle = NSBundle(forClass: Provider.self)

            if let path = bundle.pathForResource(locale, ofType: Config.pathExtension, inDirectory: Config.dirPath),
                fileURL: NSURL = NSURL(fileURLWithPath: path),
                data = NSData(contentsOfURL: fileURL){
                    translation = data
                    translations[locale] = data
            }
        }

        return translation
    }
}
{'fraction_non_alphanumeric': 0.07960199004975124, 'fraction_numerical': 0.0, 'mean_word_length': 1.8680926916221035, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '4707861', 'n_tokens_mistral': 414, 'n_tokens_neox': 382, 'n_words': 104}