<commit_before>use std::io;
use std::io::{Read, Write};
use std::fs::File;
use std::path::Path;


pub fn write_file<P: AsRef<Path>>(path: P, contents: &Vec<u8>) -> io::Result<()> {
    let mut file = try!(File::create(path));
    Ok(try!(file.write_all(contents)))
}


pub fn read_file_to_string<P: AsRef<Path>>(path: P, buf: &mut String) -> io::Result<usize> {
    let mut file = try!(File::open(path));
    let bytes = try!(file.read_to_string(buf));
    Ok(bytes)
}
<commit_msg>Add a forgotten read_file function to utils<commit_after>use std::io;
use std::io::{Read, Write};
use std::fs::File;
use std::path::Path;


pub fn write_file<P: AsRef<Path>>(path: P, contents: &Vec<u8>) -> io::Result<()> {
    let mut file = try!(File::create(path));
    Ok(try!(file.write_all(contents)))
}


pub fn read_file<P: AsRef<Path>>(path: P, buf: &mut Vec<u8>) -> io::Result<usize> {
    let mut file = try!(File::open(path));
    let bytes = try!(file.read_to_end(buf));
    Ok(bytes)
}


pub fn read_file_to_string<P: AsRef<Path>>(path: P, buf: &mut String) -> io::Result<usize> {
    let mut file = try!(File::open(path));
    let bytes = try!(file.read_to_string(buf));
    Ok(bytes)
}

{'fraction_non_alphanumeric': 0.20642978003384094, 'fraction_numerical': 0.0025380710659898475, 'mean_word_length': 5.00507614213198, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 26, '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': '3042748', 'n_tokens_mistral': 459, 'n_tokens_neox': 456, 'n_words': 101}