<commit_before>module DelayedPaperclip
  module Attachment

    def self.included(base)
      base.send :include, InstanceMethods
      base.send :attr_accessor, :job_is_processing
      base.alias_method_chain :post_processing, :delay
      base.alias_method_chain :post_processing=, :delay
      base.alias_method_chain :save, :prepare_enqueueing
      base.alias_method_chain :after_flush_writes, :processing
    end

    module InstanceMethods

      def delayed_options
        @instance.class.paperclip_definitions[@name][:delayed] unless @instance.class.paperclip_definitions[@name].nil?
      end

      # Attr accessor in Paperclip
      def post_processing_with_delay
        !delay_processing?
      end

      def post_processing_with_delay=(value)
        @post_processing_with_delay = value
      end

      # if nil, returns whether it has delayed options
      # if set, then it returns
      def delay_processing?
        if @post_processing_with_delay.nil?
          !!delayed_options
        else
          !@post_processing_with_delay
        end
      end

      def processing?
        @instance.send(:"#{@name}_processing?")
      end
<commit_msg>Allow processing some styles in foreground, some in background<commit_after>module DelayedPaperclip
  module Attachment

    def self.included(base)
      base.send :include, InstanceMethods
      base.send :attr_accessor, :job_is_processing
      base.alias_method_chain :post_processing, :delay
      base.alias_method_chain :post_processing=, :delay
      base.alias_method_chain :save, :prepare_enqueueing
      base.alias_method_chain :after_flush_writes, :processing
    end

    module InstanceMethods

      def delayed_options
        @instance.class.paperclip_definitions[@name][:delayed] unless @instance.class.paperclip_definitions[@name].nil?
      end

      # Attr accessor in Paperclip
      def post_processing_with_delay
        !delay_processing? || split_processing?
      end

      def post_processing_with_delay=(value)
        @post_processing_with_delay = value
      end

      # if nil, returns whether it has delayed options
      # if set, then it returns
      def delay_processing?
        if @post_processing_with_delay.nil?
          !!delayed_options
        else
          !@post_processing_with_delay
        end
      end
      
      def split_processing?
        @instance.class.paperclip_definitions[@name][:only_process] && 
          @instance.class.paperclip_definitions[@name][:only_process] != 
            @instance.class.paperclip_definitions[@name][:delayed][:only_process]
      end

      def processing?
        @instance.send(:"#{@name}_processing?")
      end

{'fraction_non_alphanumeric': 0.07417070443533358, 'fraction_numerical': 0.0, 'mean_word_length': 2.9587020648967552, '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': '4805247', 'n_tokens_mistral': 770, 'n_tokens_neox': 752, 'n_words': 159}