<commit_before>//
//  Image.swift
//  X
//
//  Created by <NAME> on 4/28/15.
//  Copyright (c) 2015 <NAME>. All rights reserved.
//

#if os(iOS)
	import UIKit.UIImage
	public typealias ImageType = UIImage
 #else
	import AppKit.NSImage
	public typealias ImageType = NSImage

	extension NSImage {
		public var CGImage: CGImageRef! {
			return CGImageForProposedRect(nil, context: nil, hints: nil)?.takeUnretainedValue()
		}

		// Optional to match UIImage
		public convenience init?(CGImage cgImage: CGImageRef) {
			self.init(CGImage: cgImage, size: CGSizeZero)
		}

		public convenience init?(named name: String, inBundle bundle: NSBundle?) {
			#if os(iOS)
				self.init(named: name, inBundle: bundle, compatibleWithTraitCollection: nil)
			#else
				let b = bundle ?? NSBundle.mainBundle()
				let path = b.pathForImageResource(name) ?? ""
				self.init(contentsOfFile: path)
			#endif
		}
	}
 #endif

public typealias Image = ImageType
<commit_msg>Make `Image.init?(named name: String, inBundle bundle: NSBundle?)` work on iOS<commit_after>//
//  Image.swift
//  X
//
//  Created by <NAME> on 4/28/15.
//  Copyright (c) 2015 <NAME>. All rights reserved.
//

#if os(iOS)
	import UIKit.UIImage
	public typealias ImageType = UIImage
 #else
	import AppKit.NSImage
	public typealias ImageType = NSImage

	extension NSImage {
		public var CGImage: CGImageRef! {
			return CGImageForProposedRect(nil, context: nil, hints: nil)?.takeUnretainedValue()
		}

		// Optional to match UIImage
		public convenience init?(CGImage cgImage: CGImageRef) {
			self.init(CGImage: cgImage, size: CGSizeZero)
		}
	}
 #endif

public typealias Image = ImageType

extension Image {
	public convenience init?(named name: String, inBundle bundle: NSBundle?) {
		#if os(iOS)
			self.init(named: name, inBundle: bundle, compatibleWithTraitCollection: nil)
		#else
			let b = bundle ?? NSBundle.mainBundle()
			let path = b.pathForImageResource(name) ?? ""
			self.init(contentsOfFile: path)
		#endif
	}
}

{'fraction_non_alphanumeric': 0.11627906976744186, 'fraction_numerical': 0.00910010111223458, 'mean_word_length': 3.8268292682926828, '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': '4757512', 'n_tokens_mistral': 741, 'n_tokens_neox': 659, 'n_words': 185}