<commit_before>
import UIKit

open class GImageView : UIImageView {
    public func namedImage(_ name: String) -> UIImageView {
        self.image = UIImage(named: name)
        return self
    }
    
    /*
    init() {
        super.init(frame: .zero)

        // Make sure that contentEdgeInsets' values is always initialized properly (i.e. non-zero)
        _ = self.padding(top: 10, left: 20, bottom: 10, right: 20)
    }
    
    required init?(coder: NSCoder) {
        super.init(coder: coder)
        //fatalError("init(coder:) has not been implemented")

    }
    
    func title(_ title : String, icon: Ionicons) -> GButton {
        let callButtonString = NSMutableAttributedString()
        
        let callIcon = String.ionicon(with: icon)
        let callIconAttributed = NSMutableAttributedString(string: callIcon, attributes: [NSFontAttributeName: UIFont.ionicon(of: 20)])
        callButtonString.append(callIconAttributed)
        
        let callStringAttributed = NSMutableAttributedString(string: title, attributes: [NSFontAttributeName: UIFont.systemFont(ofSize: 14)])
        callButtonString.append(callStringAttributed)
        
        self.setAttributedTitle(callButtonString, for: .normal)
        
        self.layer.cornerRadius = 4
        
        return self
    }
    
    func padding(top: CGFloat? = nil, left: CGFloat? = nil, bottom: CGFloat? = nil, right: CGFloat? = nil) -> GButton {
        let orig = self.contentEdgeInsets
        
        NSLog("INSETS: \(orig.top) \(orig.left) \(orig.bottom) \(orig.right)")
        
        let top = top ?? orig.top
        let left = left ?? orig.left
        let bottom = bottom ?? orig.bottom
        let right = right ?? orig.right
        
        self.contentEdgeInsets = UIEdgeInsets(top: top, left: left, bottom: bottom, right: right)
        //self.titleEdgeInsets = UIEdgeInsets(top: 10.0, left: 20.0, bottom: 10.0, right: 20.0)

        return self
    }
    
    /*
    func title(_ title : String) -> GButton {
        setTitle(title,for: .normal)
        return self
    }
    */
    func bgcolor(_ color: UIColor) -> GButton {
        self.backgroundColor = color
        self.titleLabel?.textColor = UIColor.white

        /*
        self.layer.borderColor = UIColor.black.cgColor
        self.layer.borderWidth = 0.5
        self.layer.cornerRadius = 10.0*/
        return self
    }
    
    func click(_ target: Any, action: Selector) -> GButton {
        addTarget(target, action: action, for: .touchUpInside)
        return self
    }
 */
}<commit_msg>add support for adjusting height according to ratio<commit_after>
import UIKit

open class GImageView : UIImageView {
    public func namedImage(_ name: String) -> Self {
        self.image = UIImage(named: name)
        return self
    }
    
    public func adjustHeight() {
        if let i = image {
            layoutIfNeeded();
            
            let ratio = i.size.width / i.size.height;
            let height = self.frame.width / ratio
            
            NSLog("Adjusting to height: \(height)")
            
            self.snp.makeConstraints { (make) -> Void in
                make.height.equalTo(height)
            }
        }
    }
}
{'fraction_non_alphanumeric': 0.10472343070229956, 'fraction_numerical': 0.009322560596643879, 'mean_word_length': 2.0511848341232226, 'pattern_counts': {'":': 0, '<': 3, '<?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': '3297137', 'n_tokens_mistral': 992, 'n_tokens_neox': 941, 'n_words': 237}