<commit_before><?php
  /** 
   * Spyc -- A Simple PHP YAML Class
   * @version 0.2.3 -- 2006-02-04
   * @author <NAME> <<EMAIL>>
   * @link http://spyc.sourceforge.net/
   * @copyright Copyright 2005-2006 <NAME>
   * @license http://www.opensource.org/licenses/mit-license.php MIT License
   * @package Spyc
   */

/** 
 * A node, used by Spyc for parsing YAML.
 * @package Spyc
 */
class YAMLNode
{
  public $parent;
  public $id;
  public $data;
  public $indent;
  public $children = false;

  static protected $lastNodeId = 0;

  /**
   * The constructor assigns the node a unique ID.
   *
   * @return void
   */
  public function __construct()
  {
    $this->id = ++self::$lastNodeId;
  }
}

/**
 * The Simple PHP YAML Class.
 *
 * This class can be used to read a YAML file and convert its contents
 * into a PHP array.  It currently supports a very limited subsection of
 * the YAML spec.
 *
 * Usage:
 * <code>
 *   $parser = new Spyc;
 *   $array  = $parser->load($file);
 * </code>
 * @package Spyc
 */
class Spyc
{
  /**
   * Load YAML into a PHP array statically
   *
   * The load method, when supplied with a YAML stream (string or file), 
   * will do its best to convert YAML in a file into a PHP array.  Pretty 
   * simple.
   *  Usage: 
   *  <code>
   *   $array = Spyc::YAMLLoad('lucky.yml');
   *   print_r($array);
   *  </code>
   *
   * @return array
   * @param string $input Path of YAML file or string containing YAML
   */
  public static function YAMLLoad($input)
  {
    $spyc = new Spyc();

    return $spyc->load($input);
  }

  /**
   * Dump YAML from PHP array statically
   *
   * The dump method, when supplied with an array, will do its best
   * to convert the array into friendly YAML.  Pretty simple.  Feel free to
   * save the returned string as nothing.yml and pass it around.
   *
   * Oh, and you can decide how big the indent is and what the wordwrap
   * for folding is.  Pretty cool -- just pass in 'false' for either if 
   * you want to use the default.
   *
   * Indent's default is 2 spaces, wordwrap's default is 40 characters.  And
   * you can turn off wordwrap by passing in 0.
   *
   * @return string
   * @param array $array PHP array
   * @param int $indent Pass in false to use the default, which is 2 
   * @param int $wordwrap Pass in 0 for no wordwrap, false for default (40)
   */
  public static function YAMLDump($array, $indent = false, $wordwrap = false)
  {
    $spyc = new Spyc();

    return $spyc->dump($array, $indent, $wordwrap);
  }

  /**
   * Load YAML into a PHP array from an instantiated object
   *
   * The load method, when supplied with a YAML stream (string or file path), 
   * will do its best to convert the YAML into a PHP array.  Pretty simple.
   *  Usage: 
   *  <code>
   *   $parser = new Spyc;
   *   $array  = $parser->load('lucky.yml');
   *   print_r($array);
   *  </code>
   *
   * @return array
   * @param string $input Path of YAML file or string containing YAML
   */
  public function load($input)
  {
    // See what type of input we're talking about
    // If it's not a file, assume it's a string
    if (!empty($input) && (strpos($input, "\n") === false) && file_exists($input))
    {
      $file = $input;
      $yaml = file($input);
    }
    else
    {
      $file = null;
      $yaml = explode("\n", $input);
    }

    // Initiate some objects and values
    $base              = new YAMLNode();
    $base->indent      = 0;
    $this->_lastIndent = 0;
    $this->_lastNode   = $base->id;
    $this->_inBlock    = false;
    $this->_isInline   = false;

    foreach ($yaml as $linenum => $line)
    {
      $ifchk = trim($line);

      // If the line starts with a tab (instead of a space), throw a fit.
      if (preg_match('/^ *(\t) *+(\w+)/', $line))
      {
        $error = sprintf('ERROR: %sLine %d in your input YAML begins with a tab. YAML only recognizes spaces. Please reformat.', ($file ? "File $file " : ''), $linenum + 1);

        throw new Exception($error);
      }

      if ($this->_inBlock === false && empty($ifchk))
      {
        continue;
      }
      else if ($this->_inBlock == true && empty($ifchk))
      {
        $last =& $this->_allNodes[$this->_lastNode];
        $last->data[key($last->data)] .= "\n";
      }
      else if ($ifchk{0} != '#' && substr($ifchk, 0, 3) != '---')
      {
        // Create a new node and get its indent
        $node         = new YAMLNode();
        $node->indent = $this->_getIndent($line);

        // Check where the node lies in the hierarchy
        if ($this->_lastIndent == $node->indent)
        {
          // If we're in a block, add the text to the parent's data
          if ($this->_inBlock === true)<commit_msg>deprecated curly braces<commit_after><?php
  /** 
   * Spyc -- A Simple PHP YAML Class
   * @version 0.2.3 -- 2006-02-04
   * @author <NAME> <<EMAIL>>
   * @link http://spyc.sourceforge.net/
   * @copyright Copyright 2005-2006 <NAME>
   * @license http://www.opensource.org/licenses/mit-license.php MIT License
   * @package Spyc
   */

/** 
 * A node, used by Spyc for parsing YAML.
 * @package Spyc
 */
class YAMLNode
{
  public $parent;
  public $id;
  public $data;
  public $indent;
  public $children = false;

  static protected $lastNodeId = 0;

  /**
   * The constructor assigns the node a unique ID.
   *
   * @return void
   */
  public function __construct()
  {
    $this->id = ++self::$lastNodeId;
  }
}

/**
 * The Simple PHP YAML Class.
 *
 * This class can be used to read a YAML file and convert its contents
 * into a PHP array.  It currently supports a very limited subsection of
 * the YAML spec.
 *
 * Usage:
 * <code>
 *   $parser = new Spyc;
 *   $array  = $parser->load($file);
 * </code>
 * @package Spyc
 */
class Spyc
{
  /**
   * Load YAML into a PHP array statically
   *
   * The load method, when supplied with a YAML stream (string or file), 
   * will do its best to convert YAML in a file into a PHP array.  Pretty 
   * simple.
   *  Usage: 
   *  <code>
   *   $array = Spyc::YAMLLoad('lucky.yml');
   *   print_r($array);
   *  </code>
   *
   * @return array
   * @param string $input Path of YAML file or string containing YAML
   */
  public static function YAMLLoad($input)
  {
    $spyc = new Spyc();

    return $spyc->load($input);
  }

  /**
   * Dump YAML from PHP array statically
   *
   * The dump method, when supplied with an array, will do its best
   * to convert the array into friendly YAML.  Pretty simple.  Feel free to
   * save the returned string as nothing.yml and pass it around.
   *
   * Oh, and you can decide how big the indent is and what the wordwrap
   * for folding is.  Pretty cool -- just pass in 'false' for either if 
   * you want to use the default.
   *
   * Indent's default is 2 spaces, wordwrap's default is 40 characters.  And
   * you can turn off wordwrap by passing in 0.
   *
   * @return string
   * @param array $array PHP array
   * @param int $indent Pass in false to use the default, which is 2 
   * @param int $wordwrap Pass in 0 for no wordwrap, false for default (40)
   */
  public static function YAMLDump($array, $indent = false, $wordwrap = false)
  {
    $spyc = new Spyc();

    return $spyc->dump($array, $indent, $wordwrap);
  }

  /**
   * Load YAML into a PHP array from an instantiated object
   *
   * The load method, when supplied with a YAML stream (string or file path), 
   * will do its best to convert the YAML into a PHP array.  Pretty simple.
   *  Usage: 
   *  <code>
   *   $parser = new Spyc;
   *   $array  = $parser->load('lucky.yml');
   *   print_r($array);
   *  </code>
   *
   * @return array
   * @param string $input Path of YAML file or string containing YAML
   */
  public function load($input)
  {
    // See what type of input we're talking about
    // If it's not a file, assume it's a string
    if (!empty($input) && (strpos($input, "\n") === false) && file_exists($input))
    {
      $file = $input;
      $yaml = file($input);
    }
    else
    {
      $file = null;
      $yaml = explode("\n", $input);
    }

    // Initiate some objects and values
    $base              = new YAMLNode();
    $base->indent      = 0;
    $this->_lastIndent = 0;
    $this->_lastNode   = $base->id;
    $this->_inBlock    = false;
    $this->_isInline   = false;

    foreach ($yaml as $linenum => $line)
    {
      $ifchk = trim($line);

      // If the line starts with a tab (instead of a space), throw a fit.
      if (preg_match('/^ *(\t) *+(\w+)/', $line))
      {
        $error = sprintf('ERROR: %sLine %d in your input YAML begins with a tab. YAML only recognizes spaces. Please reformat.', ($file ? "File $file " : ''), $linenum + 1);

        throw new Exception($error);
      }

      if ($this->_inBlock === false && empty($ifchk))
      {
        continue;
      }
      else if ($this->_inBlock == true && empty($ifchk))
      {
        $last =& $this->_allNodes[$this->_lastNode];
        $last->data[key($last->data)] .= "\n";
      }
      else if ($ifchk[0] !== '#' && strpos($ifchk, '---') !== 0)
      {
        // Create a new node and get its indent
        $node         = new YAMLNode();
        $node->indent = $this->_getIndent($line);

        // Check where the node lies in the hierarchy
        if ($this->_lastIndent == $node->indent)
        {
          // If we're in a block, add the text to the parent's data
          if ($this->_inBlock === true)
{'fraction_non_alphanumeric': 0.13557702516190678, 'fraction_numerical': 0.007113281664720247, 'mean_word_length': 2.2937062937062938, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 69, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '4602809', 'n_tokens_mistral': 3193, 'n_tokens_neox': 3028, 'n_words': 1080}