<commit_before>require 'query'

module Queries
  module EventQueries
    class EventQuery < Query

      def method_missing(name, *args)
        if Event::FLAGS.include? name.to_s
          args[0].where Squeel::Nodes::KeyPath.new(name).eq(true)
        elsif Event::FLAGS.include? name.to_s.sub(/^not_/, '')
          args[0].where Squeel::Nodes::KeyPath.new(name.to_s.sub(/^not_/, '').to_sym).eq(false)
        elsif name.to_s =~ /^(.*)_or_(.*)/ && Event::FLAGS.include?($1) && Event::FLAGS.include?($2)
          kp1 = Squeel::Nodes::KeyPath.new($1.to_sym).eq(true)
          kp2 = Squeel::Nodes::KeyPath.new($2.to_sym).eq(true)
          args[0].where { kp1 | kp2 }
        end
      end
    end

    class IndexQuery < EventQuery
      def query
        is_active not_sticky not_secure not_hidden initial_query
      end
    end

    class StickyQuery < EventQuery
      def query
        sticky not_secure not_hidden initial_query
      end
    end

    class SecureQuery < EventQuery
      def query
        not_sticky hidden_or_secure initial_query
      end
    end

    class FiltersQuery < EventQuery
      def initialize(query_so_far, filters)
        @filters = filters
        super query_so_far
      end

      def query<commit_msg>SECURE was still showing closed.<commit_after>require 'query'

module Queries
  module EventQueries
    class EventQuery < Query

      def method_missing(name, *args)
        if Event::FLAGS.include? name.to_s
          args[0].where Squeel::Nodes::KeyPath.new(name).eq(true)
        elsif Event::FLAGS.include? name.to_s.sub(/^not_/, '')
          args[0].where Squeel::Nodes::KeyPath.new(name.to_s.sub(/^not_/, '').to_sym).eq(false)
        elsif name.to_s =~ /^(.*)_or_(.*)/ && Event::FLAGS.include?($1) && Event::FLAGS.include?($2)
          kp1 = Squeel::Nodes::KeyPath.new($1.to_sym).eq(true)
          kp2 = Squeel::Nodes::KeyPath.new($2.to_sym).eq(true)
          args[0].where { (kp1 | kp2) }
        end
      end
    end

    class IndexQuery < EventQuery
      def query
        is_active not_sticky not_secure not_hidden initial_query
      end
    end

    class StickyQuery < EventQuery
      def query
        sticky not_secure not_hidden initial_query
      end
    end

    class SecureQuery < EventQuery
      def query
        is_active not_sticky hidden_or_secure initial_query
      end
    end

    class FiltersQuery < EventQuery
      def initialize(query_so_far, filters)
        @filters = filters
        super query_so_far
      end

      def query
{'fraction_non_alphanumeric': 0.111199050257222, 'fraction_numerical': 0.008705975464978234, 'mean_word_length': 2.4488403819918143, 'pattern_counts': {'":': 0, '<': 13, '<?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': '5803464', 'n_tokens_mistral': 839, 'n_tokens_neox': 815, 'n_words': 172}