<commit_before>//
//  UIView+Utility.swift
//  SquidKit
//
//  Created by <NAME> on 2/3/15.
//  Copyright (c) 2015 SquidKit. All rights reserved.
//

import UIKit

public extension UIView {
    
    public func centerInView(_ containingView:UIView) {
        var rect = self.frame
        rect.origin.x = floor(containingView.bounds.origin.x + (containingView.bounds.size.width - rect.size.width) / 2)
        rect.origin.y = floor(containingView.bounds.origin.y + (containingView.bounds.size.height - rect.size.height) / 2)
        
        self.frame = rect
    }
}<commit_msg>add preserveBackgroundColors UIView class method<commit_after>//
//  UIView+Utility.swift
//  SquidKit
//
//  Created by <NAME> on 2/3/15.
//  Copyright (c) 2015 SquidKit. All rights reserved.
//

import UIKit

public extension UIView {
    
    public class func preserveBackgroundColors(views: [UIView], closure: () -> Void) {
        let viewColorPairs = views.map { (view) -> (UIView, UIColor?) in
            return (view, view.backgroundColor)
        }
        closure()
        for (view, color) in viewColorPairs {
            view.backgroundColor = color
        }
    }
    
    public func centerInView(_ containingView:UIView) {
        var rect = self.frame
        rect.origin.x = floor(containingView.bounds.origin.x + (containingView.bounds.size.width - rect.size.width) / 2)
        rect.origin.y = floor(containingView.bounds.origin.y + (containingView.bounds.size.height - rect.size.height) / 2)
        
        self.frame = rect
    }
}


{'fraction_non_alphanumeric': 0.1221572449642625, 'fraction_numerical': 0.01299545159194282, 'mean_word_length': 2.3995584988962473, 'pattern_counts': {'":': 0, '<': 5, '<?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': '6788368', 'n_tokens_mistral': 507, 'n_tokens_neox': 478, 'n_words': 107}