<commit_before>package com.twitter.util

/**
 * Locals are more flexible thread-locals. They allow for saving &
 * restoring the state of *all* Locals. This is useful for threading
 * Locals through execution contexts. In this manner they are
 * propagated in delayed computations in {@link Promise}.
 */

import collection.mutable.ArrayBuffer

object Locals {
  private[this] val locals = new ArrayBuffer[Local[_]]
  
  def +=(local: Local[_]) = synchronized {
    locals += local
  }

  def save() = synchronized {
    val saved = new SavedLocals
    locals.foreach { saved += _.save() }
    saved
  }
}

class Local[T] {
  Locals += this

  protected[this] val threadLocal =
    new ThreadLocal[Option[T]] {
      override def initialValue: Option[T] = None<commit_msg>brittspace.<commit_after>package com.twitter.util

/**
 * Locals are more flexible thread-locals. They allow for saving &
 * restoring the state of *all* Locals. This is useful for threading
 * Locals through execution contexts. In this manner they are
 * propagated in delayed computations in {@link Promise}.
 */

import collection.mutable.ArrayBuffer

object Locals {
  private[this] val locals = new ArrayBuffer[Local[_]]

  def +=(local: Local[_]) = synchronized {
    locals += local
  }

  def save() = synchronized {
    val saved = new SavedLocals
    locals.foreach { saved += _.save() }
    saved
  }
}

class Local[T] {
  Locals += this

  protected[this] val threadLocal =
    new ThreadLocal[Option[T]] {
      override def initialValue: Option[T] = None
{'fraction_non_alphanumeric': 0.10324675324675325, 'fraction_numerical': 0.0, 'mean_word_length': 3.5323529411764705, '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': '3822499', 'n_tokens_mistral': 450, 'n_tokens_neox': 442, 'n_words': 155}