<commit_before># Monkey patch
class XLFormAction

  attr_accessor :cells
  attr_accessor :required

  alias :old_copyWithZone :copyWithZone

  def copyWithZone(zone)
    action_copy = old_copyWithZone(zone)

    action_copy.cells = self.cells.copy
    action_copy.required = self.required
    action_copy
  end
end

class XLFormRowDescriptor

  attr_accessor :cell_data

  alias :old_copyWithZone :copyWithZone

  def copyWithZone(zone)
    row_copy = old_copyWithZone(zone)
    row_copy.cell_data = cell_data
    row_copy
  end

  def enabled=(value)
    self.disabled = !value
  end

  def options=(options)
    self.selectorOptions = parse_options(options)
  end

  def parse_options(options)
    return nil if options.nil? || options.empty?

    options.map do |key, text|
      val = key
      if val.is_a? Symbol
        val = val.to_s
      end
      XLFormOptionsObject.formOptionsObjectWithValue(val, displayText: text)
    end
  end

  def cellForFormController(form_controller)
    unless self.cell
      cell_class = self.cellClass ? self.cellClass : XLFormViewController.cellClassesForRowDescriptorTypes[self.rowType]
      if cell_class.is_a?(String)
        bundle = NSBundle.bundleForClass(cell_class.to_s)
        if bundle.pathForResource(cell_class, ofType: "nib")
          self.cell = bundle.loadNibNamed(cell_class, owner: nil, options: nil).first
        end
      else
        self.cell = cell_class.alloc.initWithStyle(self.cellStyle, reuseIdentifier: nil)
      end

      if self.cell && self.cell.respond_to?(:setup)
        self.cell.setup(cell_data, form_controller)
      end
      if self.cell.respond_to?(:accessibilityLabel) && cell_data && cell_data[:title]
        self.cell.accessibilityLabel = cell_data[:title]
      end
      if self.cell.respond_to?(:keyboard_type) && cell_data[:keyboard_type]
        self.cell.keyboard_type = keyboard_type(cell_data[:keyboard_type])
      end

      self.configureCellAtCreationTime
    end

    self.cell
  end

  def keyboard_type(symbol)
    {
      default: UIKeyboardTypeDefault,
      ascii: UIKeyboardTypeASCIICapable,
      numbers_punctuation: UIKeyboardTypeNumbersAndPunctuation,
      url: UIKeyboardTypeURL,
      number_pad: UIKeyboardTypeNumberPad,
      phone_pad: UIKeyboardTypePhonePad,
      name_phone_pad: UIKeyboardTypeNamePhonePad,
      email: UIKeyboardTypeEmailAddress,
      decimal_pad: UIKeyboardTypeDecimalPad,
      twitter: UIKeyboardTypeTwitter,
      web_search: UIKeyboardTypeWebSearch,
      alphabet: UIKeyboardTypeASCIICapable
    }[symbol] || symbol || UIKeyboardTypeDefault<commit_msg>correct changes in XLForm 3.1.1<commit_after># Monkey patch
class XLFormAction

  attr_accessor :cells
  attr_accessor :required

  alias :old_copyWithZone :copyWithZone

  def copyWithZone(zone)
    action_copy = old_copyWithZone(zone)

    action_copy.cells = self.cells.copy
    action_copy.required = self.required
    action_copy
  end
end

class XLFormRowDescriptor

  attr_accessor :cell_data

  alias :old_copyWithZone :copyWithZone

  def copyWithZone(zone)
    row_copy = old_copyWithZone(zone)
    row_copy.cell_data = cell_data
    row_copy
  end

  def enabled=(value)
    self.disabled = !value
  end

  def options=(options)
    self.selectorOptions = parse_options(options)
  end

  def parse_options(options)
    return nil if options.nil? || options.empty?

    options.map do |key, text|
      val = key
      if val.is_a? Symbol
        val = val.to_s
      end
      XLFormOptionsObject.formOptionsObjectWithValue(val, displayText: text)
    end
  end

  def cellForFormController(form_controller)
    unless self.cell
      cell_class = self.cellClass ? self.cellClass : XLFormViewController.cellClassesForRowDescriptorTypes[self.rowType]
      if cell_class.is_a?(String)
        bundle = NSBundle.bundleForClass(cell_class.to_s)
        if bundle.pathForResource(cell_class, ofType: "nib")
          self.cell = bundle.loadNibNamed(cell_class, owner: nil, options: nil).first
        end
      else
        self.cell = cell_class.alloc.initWithStyle(self.cellStyle, reuseIdentifier: nil)
      end

      if self.cell && self.cell.respond_to?(:setup)
        self.cell.setup(cell_data, form_controller)
      end
      if self.cell.respond_to?(:accessibilityLabel) && cell_data && cell_data[:title]
        self.cell.accessibilityLabel = cell_data[:title]
      end
      if self.cell.respond_to?(:keyboard_type) && cell_data[:keyboard_type]
        self.cell.keyboard_type = keyboard_type(cell_data[:keyboard_type])
      end

      self.cell.rowDescriptor = self

      self.configureCellAtCreationTime
    end

    self.cell
  end

  def keyboard_type(symbol)
    {
      default: UIKeyboardTypeDefault,
      ascii: UIKeyboardTypeASCIICapable,
      numbers_punctuation: UIKeyboardTypeNumbersAndPunctuation,
      url: UIKeyboardTypeURL,
      number_pad: UIKeyboardTypeNumberPad,
      phone_pad: UIKeyboardTypePhonePad,
      name_phone_pad: UIKeyboardTypeNamePhonePad,
      email: UIKeyboardTypeEmailAddress,
      decimal_pad: UIKeyboardTypeDecimalPad,
      twitter: UIKeyboardTypeTwitter,
      web_search: UIKeyboardTypeWebSearch,
      alphabet: UIKeyboardTypeASCIICapable
    }[symbol] || symbol || UIKeyboardTypeDefault
{'fraction_non_alphanumeric': 0.07661596958174904, 'fraction_numerical': 0.0005703422053231939, 'mean_word_length': 3.469838572642311, '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': '6871956', 'n_tokens_mistral': 1669, 'n_tokens_neox': 1633, 'n_words': 311}