<commit_before>package io.mediachain

import com.orientechnologies.orient.core.Orient

// See http://stackoverflow.com/a/9901616
// These classes run setup / cleanup code when instantiated
// Used in Tests.setup and Tests.cleanup hooks in build.sbt

class SBTSetupHook {
  // Set the classloader to the JVM default, instead of the restricted sbt classloader
  Thread.currentThread().setContextClassLoader(this.getClass.getClassLoader)

  // The default Orient shutdown hook runs on JVM shutdown, but we want it
  // to run after each test run, otherwise Orient will complain that its
  // beans are already registered
  // (or something... see https://github.com/orientechnologies/orientdb/issues/4967)
  Orient.instance().removeShutdownHook()
}

class SBTCleanupHook {
  // Manually shutdown orient after testing, since we removed the shutdown hook above
  Orient.instance().shutdown()
}<commit_msg>Don't change contextClassLoader in SBTSetupHook<commit_after>package io.mediachain

import com.orientechnologies.orient.core.Orient

// See http://stackoverflow.com/a/9901616
// These classes run setup / cleanup code when instantiated
// Used in Tests.setup and Tests.cleanup hooks in build.sbt

class SBTSetupHook {
  // The default Orient shutdown hook runs on JVM shutdown, but we want it
  // to run after each test run, otherwise Orient will complain that its
  // beans are already registered

  // Accessing the Orient.instance here also prevents a NoClassDefFound error
  // during test execution.
  Orient.instance().removeShutdownHook()
}

class SBTCleanupHook {
  // Manually shutdown orient after testing, since we removed the shutdown hook above
  Orient.instance().shutdown()
}
{'fraction_non_alphanumeric': 0.07983441750443525, 'fraction_numerical': 0.010644589000591367, 'mean_word_length': 4.111782477341389, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, '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': '7552699', 'n_tokens_mistral': 481, 'n_tokens_neox': 457, 'n_words': 172}