<commit_before>/// App struct with package or bundle related helpers
///
/// - author: <NAME> <<EMAIL>>
/// - copyright: 2017 <NAME>. All rights reserved.
/// - license: MIT
import Foundation
#if os(iOS)
import UIKit
#endif

// MARK: - App struct
public struct App {

	/// Application bundle identifier
	public static var bundleId: String {
		if let ident = Bundle.main.bundleIdentifier {
			return ident
		} else {
			return "com.example.NoBundle"
		}
	}

	/// Application bundle version
	public static var bundleVersion: String {
		if let version = Bundle.main.object(forInfoDictionaryKey: kCFBundleVersionKey as String) as? String {
			return version
		} else {
			return "0"
		}
	}

	/// Set a key value pair in the application plist
	///
	/// - Parameters:
	///   - value: value as an Any
	///   - key: plist key as a String
	public static func setPlistKey(value: String, key: Any) {
		let path = Bundle.main.path(forResource: "Info", ofType: "plist")
		Log.debug(path)
		if let plist = NSMutableDictionary.init(contentsOfFile: path!) {
			plist[key] = value
			plist.write(toFile: path!, atomically: true)
		}
	}

	/// Change the app icon to the named plist icon, use nil for default icon
	/// http://stackoverflow.com/questions/43097604/alternate-icon-in-ios-10-3
	private static func updateIcon(name: String?) {
		#if os(iOS)
		if #available(iOS 10.3, *) {
			if UIApplication.shared.supportsAlternateIcons {
				UIApplication.shared.setAlternateIconName(name) { (err: Error?) in
					Log.error(err)
				}
			}
		}
		#endif
	}
}<commit_msg>Fix: optional unwrap<commit_after>/// App struct with package or bundle related helpers
///
/// - author: <NAME> <<EMAIL>>
/// - copyright: 2017 <NAME>. All rights reserved.
/// - license: MIT
import Foundation
#if os(iOS)
import UIKit
#endif

// MARK: - App struct
public struct App {

	/// Application bundle identifier
	public static var bundleId: String {
		if let ident = Bundle.main.bundleIdentifier {
			return ident
		} else {
			return "com.example.NoBundle"
		}
	}

	/// Application bundle version
	public static var bundleVersion: String {
		if let version = Bundle.main.object(forInfoDictionaryKey: kCFBundleVersionKey as String) as? String {
			return version
		} else {
			return "0"
		}
	}

	/// Set a key value pair in the application plist
	///
	/// - Parameters:
	///   - value: value as an Any
	///   - key: plist key as a String
	public static func setPlistKey(value: String, key: Any) {
		let path = Bundle.main.path(forResource: "Info", ofType: "plist")
		Log.debug(path)
		if let plist = NSMutableDictionary.init(contentsOfFile: path!) {
			plist[key] = value
			plist.write(toFile: path!, atomically: true)
		}
	}

	/// Change the app icon to the named plist icon, use nil for default icon
	/// http://stackoverflow.com/questions/43097604/alternate-icon-in-ios-10-3
	private static func updateIcon(name: String?) {
		#if os(iOS)
		if #available(iOS 10.3, *) {
			if UIApplication.shared.supportsAlternateIcons {
				UIApplication.shared.setAlternateIconName(name) { (err: Error?) in
					if err != nil {
						Log.error(err!)
					}
				}
			}
		}
		#endif
	}
}
{'fraction_non_alphanumeric': 0.12639642515161187, 'fraction_numerical': 0.012128949888285988, 'mean_word_length': 3.07012987012987, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '4179708', 'n_tokens_mistral': 1152, 'n_tokens_neox': 997, 'n_words': 307}