<commit_before># enoding: utf-8

require 'sinatra'

# [Redis To Go | Heroku Dev Center](https://devcenter.heroku.com/articles/redistogo)
configure do
  require 'redis'
  uri = URI.parse(ENV['REDISTOGO_URL'])
  REDIS = Redis.new(:host => uri.host, :port => uri.port, :password => <PASSWORD>.password)
end

error 404 do
  'Status not found'
end

get '/' do; end

get '/ci/:job' do |job|
  begin
    response.headers['Cache-Control'] = 'no-store'
    status = REDIS.get("#{job.upcase}_STATUS")
    raise NameError unless status
    content_type 'image/png'
    send_file "public/images/#{status}.png"
  rescue
    404
  end
end

post '/ci/:job' do |job|
  REDIS.set("#{job.upcase}_STATUS", params[:status])
end
<commit_msg>add error at rescue<commit_after># enoding: utf-8

require 'sinatra'

# [Redis To Go | Heroku Dev Center](https://devcenter.heroku.com/articles/redistogo)
configure do
  require 'redis'
  uri = URI.parse(ENV['REDISTOGO_URL'])
  REDIS = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password)
end

error 404 do
  'Status not found'
end

get '/' do; end

get '/ci/:job' do |job|
  begin
    response.headers['Cache-Control'] = 'no-store'
    status = REDIS.get("#{job.upcase}_STATUS")
    raise NameError unless status
    content_type 'image/png'
    send_file "public/images/#{status}.png"
  rescue NameError
    404
  end
end

post '/ci/:job' do |job|
  REDIS.set("#{job.upcase}_STATUS", params[:status])
end

{'fraction_non_alphanumeric': 0.15734989648033126, 'fraction_numerical': 0.00966183574879227, 'mean_word_length': 3.849498327759197, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 10, 'https://': 2, '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': '1123678', 'n_tokens_mistral': 542, 'n_tokens_neox': 529, 'n_words': 130}