<commit_before>class Tag < ApplicationRecord
  has_many :taggings, :dependent => :destroy
  has_one :classification
  virtual_has_one :category,       :class_name => "Classification"
  virtual_has_one :categorization, :class_name => "Hash"

  has_many :container_label_tag_mappings

  before_destroy :remove_from_managed_filters

  def self.list(object, options = {})
    ns = get_namespace(options)
    if ns[0..7] == "/virtual"
      ns.gsub!('/virtual/','')  # throw away /virtual
      predicate = ns.split("/")
      begin
        predicate.inject(object) { |target, method| target.public_send method }
      rescue NoMethodError
        ""<commit_msg>Escape special characters only for virtual custom attributes<commit_after>class Tag < ApplicationRecord
  has_many :taggings, :dependent => :destroy
  has_one :classification
  virtual_has_one :category,       :class_name => "Classification"
  virtual_has_one :categorization, :class_name => "Hash"

  has_many :container_label_tag_mappings

  before_destroy :remove_from_managed_filters

  def self.list(object, options = {})
    ns = get_namespace(options)
    if ns[0..7] == "/virtual"
      ns.gsub!('/virtual/','')  # throw away /virtual
      ns, virtual_custom_attribute = MiqExpression.escape_virtual_custom_attribute(ns)
      predicate = ns.split("/")
      predicate.map!{ |x| URI::RFC2396_Parser.new.unescape(x) } if virtual_custom_attribute

      begin
        predicate.inject(object) { |target, method| target.public_send method }
      rescue NoMethodError
        ""
{'fraction_non_alphanumeric': 0.11096690460739779, 'fraction_numerical': 0.005191434133679429, 'mean_word_length': 3.926517571884984, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '5128165', 'n_tokens_mistral': 476, 'n_tokens_neox': 471, 'n_words': 101}