<commit_before>import UIKit

public final class DaySymbolsView: UIView {
  public private(set) var daysInWeek = 7
  private var calendar = Calendar.autoupdatingCurrent
  private var labels = [UILabel]()
  private var style: DaySymbolsStyle = DaySymbolsStyle()

  override public init(frame: CGRect) {
    super.init(frame: frame)
    initializeViews()
  }

  required public init?(coder aDecoder: NSCoder) {
    super.init(coder: aDecoder)
    initializeViews()
  }

  public init(daysInWeek: Int = 7, calendar: Calendar = Calendar.autoupdatingCurrent) {
    self.calendar = calendar
    self.daysInWeek = daysInWeek
    super.init(frame: CGRect.zero)
    initializeViews()
  }

  private func initializeViews() {
    for _ in 1...daysInWeek {
      let label = UILabel()
      label.textAlignment = .center
      labels.append(label)
      addSubview(label)
    }
    configure()
  }

  public func updateStyle(_ newStyle: DaySymbolsStyle) {
    style = newStyle
    configure()
  }

  private func configure() {
    let daySymbols = calendar.veryShortWeekdaySymbols
    let weekendMask = [true] + [Bool](repeating: false, count: 5) + [true]
    var weekDays = Array(zip(daySymbols, weekendMask))

    weekDays.shift(calendar.firstWeekday - 1)<commit_msg>Add RTL support for Day Symbols View<commit_after>import UIKit

public final class DaySymbolsView: UIView {
  public private(set) var daysInWeek = 7
  private var calendar = Calendar.autoupdatingCurrent
  private var labels = [UILabel]()
  private var style: DaySymbolsStyle = DaySymbolsStyle()

  override public init(frame: CGRect) {
    super.init(frame: frame)
    initializeViews()
  }

  required public init?(coder aDecoder: NSCoder) {
    super.init(coder: aDecoder)
    initializeViews()
  }

  public init(daysInWeek: Int = 7, calendar: Calendar = Calendar.autoupdatingCurrent) {
    self.calendar = calendar
    self.daysInWeek = daysInWeek
    super.init(frame: CGRect.zero)
    initializeViews()
  }

  private func initializeViews() {
    for _ in 1...daysInWeek {
      let label = UILabel()
      label.textAlignment = .center
      labels.append(label)
      addSubview(label)
    }
    configure()
  }

  public func updateStyle(_ newStyle: DaySymbolsStyle) {
    style = newStyle
    configure()
  }

  private func configure() {
    let daySymbols = calendar.veryShortWeekdaySymbols
    let weekendMask = [true] + [Bool](repeating: false, count: 5) + [true]
    var weekDays = Array(zip(daySymbols, weekendMask))

    weekDays.shift(calendar.firstWeekday - 1)
    
    let rtl = UIView.userInterfaceLayoutDirection(for: self.semanticContentAttribute) == .rightToLeft
    if rtl { weekDays.reverse() }
{'fraction_non_alphanumeric': 0.09715994020926756, 'fraction_numerical': 0.0037369207772795215, 'mean_word_length': 3.568259385665529, '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': '2344043', 'n_tokens_mistral': 854, 'n_tokens_neox': 811, 'n_words': 205}