<commit_before># encoding: UTF-8

class Carto::Widget < ActiveRecord::Base
  belongs_to :layer, class_name: Carto::Layer
 
  # INFO: disable ActiveRecord inheritance column
  self.inheritance_column = :_type

  def dataview_json
    JSON.parse(dataview).symbolize_keys
  end

  def belongs_to_map?(map_id)
    !layer.nil? && !layer.maps.nil? && layer.maps.map(&:id).include?(map_id)
  end

  def writable_by_user?(user)
    return false unless layer
    return false unless layer.maps

    visualizations = Carto::Visualization.where(map_id: layer.maps(&:id)).all

    !visualizations.select { |v| v.is_writable_by_user(user) }.empty?
  end

end<commit_msg>Removed whitespace<commit_after># encoding: UTF-8

class Carto::Widget < ActiveRecord::Base
  belongs_to :layer, class_name: Carto::Layer

  # INFO: disable ActiveRecord inheritance column
  self.inheritance_column = :_type

  def dataview_json
    JSON.parse(dataview).symbolize_keys
  end

  def belongs_to_map?(map_id)
    !layer.nil? && !layer.maps.nil? && layer.maps.map(&:id).include?(map_id)
  end

  def writable_by_user?(user)
    return false unless layer
    return false unless layer.maps

    visualizations = Carto::Visualization.where(map_id: layer.maps(&:id)).all

    !visualizations.select { |v| v.is_writable_by_user(user) }.empty?
  end

end
{'fraction_non_alphanumeric': 0.11684370257966616, 'fraction_numerical': 0.0015174506828528073, 'mean_word_length': 4.473029045643154, 'pattern_counts': {'":': 0, '<': 5, '<?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': '4500896', 'n_tokens_mistral': 465, 'n_tokens_neox': 453, 'n_words': 92}