<commit_before>open Common
open Io
open Yojson.Safe
open States

module Simulate = 
  functor (C: Protocol.CONSENSUS) -> struct

  let trace_buffer = ref []

  let buffer_many flush jsons = 
    match flush with 
    | true -> pretty_to_channel ~std:true stdout (`List jsons)
    | false -> trace_buffer := jsons @ !trace_buffer

  let buffer flush json = buffer_many flush [json]
  

  let json_to_stdout json = 
    pretty_to_channel ~std:true stdout json

  let flush_buffer general client protocol = 
    json_to_stdout (
      `Assoc [
        ("trace", `List !trace_buffer);
        ("results", `Assoc [<commit_msg>turning off pretty printing except for when debug is enabled<commit_after>open Common
open Io
open Yojson.Safe
open States

module Simulate = 
  functor (C: Protocol.CONSENSUS) -> struct

  let trace_buffer = ref []

  let buffer_many flush jsons = 
    match flush with 
    | true -> pretty_to_channel ~std:true stdout (`List jsons)
    | false -> trace_buffer := jsons @ !trace_buffer

  let buffer flush json = buffer_many flush [json]
  

  let json_to_stdout json = 
    to_channel ~std:true stdout json

  let flush_buffer general client protocol = 
    json_to_stdout (
      `Assoc [
        ("trace", `List !trace_buffer);
        ("results", `Assoc [
{'fraction_non_alphanumeric': 0.0842433697347894, 'fraction_numerical': 0.0, 'mean_word_length': 3.1655844155844157, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '1826101', 'n_tokens_mistral': 413, 'n_tokens_neox': 387, 'n_words': 129}