<commit_before>require 'mono_logger'
require 'redis/namespace'

require 'resque/version'
require 'resque/config'

require 'resque/errors'

require 'resque/failure/base'
require 'resque/failure'
require 'resque/failure/redis'

require 'resque/stat'
require 'resque/logging'
require 'resque/job'
require 'resque/worker_registry'
require 'resque/process_coordinator'
require 'resque/worker'
require 'resque/plugin'
require 'resque/queue'
require 'resque/multi_queue'
require 'resque/coder'
require 'resque/json_coder'
require 'resque/hook_register'

require 'forwardable'

# Resque is the singleton from which all operations take place.
# TODO: for resque-2.0.0 - break this functionality out into
# something that can be instantiated.
module Resque
  extend self

  # List of class name suffixes which will be considered to indicate
  # a class capable of performing work
  SUFFIXES = %w(Job Worker).freeze unless defined?(SUFFIXES)

  # Serialize an object with the current coder
  # @param object [Object] - the object you with to serialize
  # @return [String] - the serialized object
  def encode(object)
    Resque.coder.encode(object)
  end

  # Deserialize an object with the current coder
  # @param object [String] - the object you with to deserialize
  # @return [Object] - the deserialized object
  def decode(object)
    Resque.coder.decode(object)
  end

  # Set the config by overriding the current config with a hash
  # @param options [Hash] (see Resque::Config#initialize)
  # @return [void]
  def self.config=(options = {})
    @config = Config.new(options)
  end

  # Get the current config
  # @return [Resque::Config]
  def self.config
    @config ||= Config.new
  end

  # Configure Resque with a blcok
  # @yieldparam config [Resque::Config]
  # @yieldreturn [void]
  # @return [void]
  def self.configure
    yield config
  end

  # Get the current backend
  # @return [Redis::Backend]
  def backend
    @backend ||= Backend.new(config.redis, Resque.logger)
  end

  # Set the redis connection by creating a new Redis::Backend
  # @param server (see Redis::Backend::connect)
  # @return [Redis::Namespace,Redis::Distributed]
  def redis=(server)
    config.redis = Backend.connect(server) unless server.nil?

    @queues = Hash.new do |h, name|
      h[name] = Resque::Queue.new(name, config.redis, coder)
    end

    @backend = Backend.new(config.redis, Resque.logger)

    config.redis
  end

  # Returns information about the current Redis connection.
  # @return (see Resque::Config#redis_id)
  def redis_id
    config.redis_id
  end

  # Encapsulation of encode/decode. Overwrite this to use it across Resque.
  # This defaults to JSON for backwards compatibility.
  # @return [Resque::Coder,#encode,#decode]
  def coder
    @coder ||= JsonCoder.new
  end
  attr_writer :coder

  # Set or retrieve the current logger object
  # @return [#warn,#debug,#info,#unknown,#fatal,#error] duck-typed ::Logger
  attr_accessor :logger

  extend ::Forwardable

  @hook_register = HookRegister.new

  def_delegators :@hook_register,
    :before_first_fork,
    :before_first_fork=,
    :before_fork,
    :before_fork=,
    :after_fork,
    :after_fork=,
    :before_pause,
    :before_pause=,
    :after_pause,
    :after_pause=,
    :before_perform,
    :before_perform=,
    :after_perform,
    :after_perform=

  # @return [String]
  def to_s
    "Resque Backend connected to #{redis_id}"
  end

  # If 'inline' is true Resque will call #perform method inline
  # without queuing it into Redis and without any Resque callbacks.
  # The 'inline' is false Resque jobs will be put in queue regularly.<commit_msg>Typo in comment<commit_after>require 'mono_logger'
require 'redis/namespace'

require 'resque/version'
require 'resque/config'

require 'resque/errors'

require 'resque/failure/base'
require 'resque/failure'
require 'resque/failure/redis'

require 'resque/stat'
require 'resque/logging'
require 'resque/job'
require 'resque/worker_registry'
require 'resque/process_coordinator'
require 'resque/worker'
require 'resque/plugin'
require 'resque/queue'
require 'resque/multi_queue'
require 'resque/coder'
require 'resque/json_coder'
require 'resque/hook_register'

require 'forwardable'

# Resque is the singleton from which all operations take place.
# TODO: for resque-2.0.0 - break this functionality out into
# something that can be instantiated.
module Resque
  extend self

  # List of class name suffixes which will be considered to indicate
  # a class capable of performing work
  SUFFIXES = %w(Job Worker).freeze unless defined?(SUFFIXES)

  # Serialize an object with the current coder
  # @param object [Object] - the object you with to serialize
  # @return [String] - the serialized object
  def encode(object)
    Resque.coder.encode(object)
  end

  # Deserialize an object with the current coder
  # @param object [String] - the object you with to deserialize
  # @return [Object] - the deserialized object
  def decode(object)
    Resque.coder.decode(object)
  end

  # Set the config by overriding the current config with a hash
  # @param options [Hash] (see Resque::Config#initialize)
  # @return [void]
  def self.config=(options = {})
    @config = Config.new(options)
  end

  # Get the current config
  # @return [Resque::Config]
  def self.config
    @config ||= Config.new
  end

  # Configure Resque with a blcok
  # @yieldparam config [Resque::Config]
  # @yieldreturn [void]
  # @return [void]
  def self.configure
    yield config
  end

  # Get the current backend
  # @return [Redis::Backend]
  def backend
    @backend ||= Backend.new(config.redis, Resque.logger)
  end

  # Set the redis connection by creating a new Redis::Backend
  # @param server (see Redis::Backend::connect)
  # @return [Redis::Namespace,Redis::Distributed]
  def redis=(server)
    config.redis = Backend.connect(server) unless server.nil?

    @queues = Hash.new do |h, name|
      h[name] = Resque::Queue.new(name, config.redis, coder)
    end

    @backend = Backend.new(config.redis, Resque.logger)

    config.redis
  end

  # Returns information about the current Redis connection.
  # @return (see Resque::Config#redis_id)
  def redis_id
    config.redis_id
  end

  # Encapsulation of encode/decode. Overwrite this to use it across Resque.
  # This defaults to JSON for backwards compatibility.
  # @return [Resque::Coder,#encode,#decode]
  def coder
    @coder ||= JsonCoder.new
  end
  attr_writer :coder

  # Set or retrieve the current logger object
  # @return [#warn,#debug,#info,#unknown,#fatal,#error] duck-typed ::Logger
  attr_accessor :logger

  extend ::Forwardable

  @hook_register = HookRegister.new

  def_delegators :@hook_register,
    :before_first_fork,
    :before_first_fork=,
    :before_fork,
    :before_fork=,
    :after_fork,
    :after_fork=,
    :before_pause,
    :before_pause=,
    :after_pause,
    :after_pause=,
    :before_perform,
    :before_perform=,
    :after_perform,
    :after_perform=

  # @return [String]
  def to_s
    "Resque Backend connected to #{redis_id}"
  end

  # If 'inline' is true Resque will call #perform method inline
  # without queuing it into Redis and without any Resque callbacks.
  # If 'inline' is false Resque jobs will be put in queue regularly.
{'fraction_non_alphanumeric': 0.09951757408683666, 'fraction_numerical': 0.0008270158511371468, 'mean_word_length': 3.9260013577732518, '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': '292282', 'n_tokens_mistral': 2399, 'n_tokens_neox': 2330, 'n_words': 711}