<commit_before>module Net
  class AsyncTask < Android::Os::AsyncTask
    attr_accessor :callback

    def self.async(&block)
      async_task = new
      async_task.callback = block
      async_task.execute([])
    end

    def doInBackground(params)
      callback.call(params)
    end
  end
end<commit_msg>AsyncTask can now manage background and main thread<commit_after>module Net
  class AsyncTask < Android::Os::AsyncTask
    attr_accessor :background_callback
    attr_accessor :main_callback

    def self.async(&callback)
      async_task = new
      async_task.background_callback = callback
      async_task.execute([])
    end

    def self.main_async(&callback)
      async_task = new
      async_task.main_callback = callback
      async_task.execute([])
    end

    def doInBackground(params)
      background_callback.call(params) if background_callback
    end

    def onPostExecute(result)
      main_callback.call(result) if main_callback
    end
  end
end
{'fraction_non_alphanumeric': 0.07172131147540983, 'fraction_numerical': 0.0, 'mean_word_length': 3.211206896551724, 'pattern_counts': {'":': 0, '<': 5, '<?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': '6694211', 'n_tokens_mistral': 286, 'n_tokens_neox': 279, 'n_words': 66}