<commit_before>//
//  CALayer.swift
//  MBLibrary
//
//  Created by <NAME> on 27/08/16.
//  Copyright © 2016 <NAME>. All rights reserved.
//

import QuartzCore
import UIKit

extension CALayer {
	
	public func image(transparent: Bool = true) -> UIImage {
		UIGraphicsBeginImageContextWithOptions(self.frame.size, !transparent, 0)
		
		self.render(in: UIGraphicsGetCurrentContext()!)
		let res = UIGraphicsGetImageFromCurrentImageContext()!
		
		UIGraphicsEndImageContext()
		
		return res
	}
	
}<commit_msg>- Handled errors for generating UIImage from CALayer<commit_after>//
//  CALayer.swift
//  MBLibrary
//
//  Created by <NAME> on 27/08/16.
//  Copyright © 2016 <NAME>. All rights reserved.
//

import QuartzCore
import UIKit

extension CALayer {
	
	public func image(transparent: Bool = true) -> UIImage? {
		UIGraphicsBeginImageContextWithOptions(self.frame.size, !transparent, 0)
		
		guard let current = UIGraphicsGetCurrentContext() else {
			return nil
		}
		
		self.render(in: current)
		let res = UIGraphicsGetImageFromCurrentImageContext()
		
		UIGraphicsEndImageContext()
		
		return res
	}
	
}
{'fraction_non_alphanumeric': 0.10740072202166065, 'fraction_numerical': 0.019855595667870037, 'mean_word_length': 3.6401673640167362, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, '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': '469545', 'n_tokens_mistral': 427, 'n_tokens_neox': 354, 'n_words': 90}