<commit_before>import UIKit

class GeneralController: UIViewController {

  lazy var imageView: UIImageView = {
    let imageView = UIImageView()
    imageView.contentMode = .ScaleAspectFit
    imageView.image = UIImage(named: "chef")

    return imageView
  }()

  lazy var titleLabel: UILabel = {
    let label = UILabel()
    label.numberOfLines = 0
    label.font = UIFont.boldSystemFontOfSize(18)
    label.textColor = UIColor.lightGrayColor()
    label.textAlignment = .Center

    return label
  }()

  override func viewDidLoad() {
    super.viewDidLoad()

    view.backgroundColor = UIColor.whiteColor()

    [imageView, titleLabel].forEach {
      $0.translatesAutoresizingMaskIntoConstraints = false
      view.addSubview($0)
    }

    setupConstraints()
  }

  // MARK: - Constraint methods

  func setupConstraints() {
    constraint(titleLabel, attributes: [.CenterX, .CenterY])
    constraint(imageView, attributes: [.CenterX])

    view.addConstraints([
      NSLayoutConstraint(
        item: imageView, attribute: .Bottom,
        relatedBy: .Equal, toItem: titleLabel,
        attribute: .Top, multiplier: 1, constant: -10),

      NSLayoutConstraint(
        item: imageView, attribute: .Width,
        relatedBy: .Equal, toItem: nil,
        attribute: .NotAnAttribute, multiplier: 1, constant: 100),

      NSLayoutConstraint(
        item: imageView, attribute: .Height,
        relatedBy: .Equal, toItem: nil,
        attribute: .Height, multiplier: 1, constant: 100),

      NSLayoutConstraint(
        item: titleLabel, attribute: .Width,
        relatedBy: .Equal, toItem: view,
        attribute: .Width, multiplier: 1, constant: -200)
    ])
  }

  // MARK: - Helper methods

  func constraint(subview: UIView, attributes: [NSLayoutAttribute]) {
    for attribute in attributes {
      view.addConstraint(NSLayoutConstraint(
        item: subview, attribute: attribute,
        relatedBy: .Equal, toItem: view,
        attribute: attribute, multiplier: 1, constant: 0)
      )
    }
  }
}<commit_msg>Adds a better general controller<commit_after>import UIKit

class GeneralController: UIViewController {

  lazy var imageView: UIImageView = {
    let imageView = UIImageView()
    imageView.contentMode = .ScaleAspectFit
    imageView.image = UIImage(named: "chef")

    return imageView
  }()

  lazy var titleLabel: UILabel = {
    let label = UILabel()
    label.numberOfLines = 0
    label.font = UIFont.boldSystemFontOfSize(18)
    label.textColor = UIColor.lightGrayColor()
    label.textAlignment = .Center

    return label
  }()

  override func viewDidLoad() {
    super.viewDidLoad()

    view.backgroundColor = UIColor.whiteColor()

    [imageView, titleLabel].forEach {
      $0.translatesAutoresizingMaskIntoConstraints = false
      view.addSubview($0)
    }

    setupConstraints()
  }

  // MARK: - Constraint methods

  func setupConstraints() {
    constraint(titleLabel, attributes: [.CenterX, .CenterY])
    constraint(imageView, attributes: [.CenterX])

    view.addConstraints([
      NSLayoutConstraint(
        item: imageView, attribute: .Bottom,
        relatedBy: .Equal, toItem: titleLabel,
        attribute: .Top, multiplier: 1, constant: -20),

      NSLayoutConstraint(
        item: imageView, attribute: .Width,
        relatedBy: .Equal, toItem: nil,
        attribute: .NotAnAttribute, multiplier: 1, constant: 100),

      NSLayoutConstraint(
        item: imageView, attribute: .Height,
        relatedBy: .Equal, toItem: nil,
        attribute: .Height, multiplier: 1, constant: 100),

      NSLayoutConstraint(
        item: titleLabel, attribute: .Width,
        relatedBy: .Equal, toItem: view,
        attribute: .Width, multiplier: 1, constant: -200)
    ])
  }

  // MARK: - Helper methods

  func constraint(subview: UIView, attributes: [NSLayoutAttribute]) {
    for attribute in attributes {
      view.addConstraint(NSLayoutConstraint(
        item: subview, attribute: attribute,
        relatedBy: .Equal, toItem: view,
        attribute: attribute, multiplier: 1, constant: 0)
      )
    }
  }
}
{'fraction_non_alphanumeric': 0.10590831086050502, 'fraction_numerical': 0.01078695758764403, 'mean_word_length': 2.9344262295081966, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '675982', 'n_tokens_mistral': 1254, 'n_tokens_neox': 1174, 'n_words': 300}