<commit_before>package csvutil
/* 
*  File: file.go
*  Author: <NAME> [<EMAIL>] 
*  Created: Sun May 29 23:14:48 PDT 2011
*/
import (
    "os"
)

//  Write CSV data to a named file. Requires file permissions be specified.
//  Recommended permissions are 0600, 0622, and 0666 (6:rw, 4:w, 2:r).
func WriteFile(filename string, perm uint32,rows [][]string) (nbytes int, err os.Error) {
    var (
        out *os.File
        csvw *Writer
    )
    nbytes = 0
    out, err = os.OpenFile(filename, os.O_WRONLY | os.O_CREATE | os.O_TRUNC, perm)
    if err != nil {
        return nbytes, err
    }
    csvw = NewWriter(out)
    nbytes, err = csvw.WriteRows(rows)
    if err != nil {
        return nbytes, err
    }
    err = out.Close()
    return nbytes, err
}

//  Read a named CSV file into a new slice of new string slices.<commit_msg>Improved documentation for WriteFile().<commit_after>package csvutil
/* 
*  File: file.go
*  Author: <NAME> [<EMAIL>] 
*  Created: Sun May 29 23:14:48 PDT 2011
*/
import (
    "os"
)

//  Write CSV data to a named file. If the file does not exist, it is
//  created. If the file exists, it is truncated upon opening. Requires
//  that file permissions be specified. Recommended permissions are 0600,
//  0622, and 0666 (6:rw, 4:w, 2:r). 
func WriteFile(filename string, perm uint32,rows [][]string) (nbytes int, err os.Error) {
    var (
        out *os.File
        csvw *Writer
    )
    nbytes = 0
    out, err = os.OpenFile(filename, os.O_WRONLY | os.O_CREATE | os.O_TRUNC, perm)
    if err != nil {
        return nbytes, err
    }
    csvw = NewWriter(out)
    nbytes, err = csvw.WriteRows(rows)
    if err != nil {
        return nbytes, err
    }
    err = out.Close()
    return nbytes, err
}

//  Read a named CSV file into a new slice of new string slices.
{'fraction_non_alphanumeric': 0.11715713492504164, 'fraction_numerical': 0.03331482509716824, 'mean_word_length': 2.5264187866927594, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '3640794', 'n_tokens_mistral': 693, 'n_tokens_neox': 621, 'n_words': 215}