<commit_before>class Locky

  Error = Class.new StandardError
  
  attr_reader :name

  def initialize(name, adapter={})
    @name = name
    @adapter = adapter
  end

  def lock(process)
    raise Error, "#{name} already locked by #{locked_by}" if locked?
    adapter[name] = process
    yield
  ensure
    adapter.delete name
  end

  def locked?
    adapter.key? name
  end

  def locked_by
    adapter[name]
  end<commit_msg>Fix unlock<commit_after>class Locky

  Error = Class.new StandardError
  
  attr_reader :name

  def initialize(name, adapter={})
    @name = name
    @adapter = adapter
  end

  def lock(process)
    raise Error, "#{name} already locked by #{locked_by}" if locked?
    adapter[name] = process
    begin
      yield
    ensure
      adapter.delete name
    end
  end

  def locked?
    adapter.key? name
  end

  def locked_by
    adapter[name]
  end
{'fraction_non_alphanumeric': 0.08418657565415244, 'fraction_numerical': 0.0, 'mean_word_length': 2.697478991596639, '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': '7166793', 'n_tokens_mistral': 286, 'n_tokens_neox': 275, 'n_words': 86}