<commit_before>(*
 * Copyright (c) 2015-present, Facebook, Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *)

module Cmdliner = Vendored_cmdliner
open Cmdliner

let read_lines file =
  let list = ref [] in
  let chan = open_in_bin file in
  try
    while true do
      list := input_line chan :: !list
    done;
    []
  with End_of_file ->
    close_in chan;
    List.rev !list

let refmt
    interface
    is_recoverable
    explicit_arity
    parse_ast
    print
    print_width
    heuristics_file
    in_place
    input_files
  =
  let refmt_single input_file =
    let (use_stdin, input_file) = match input_file with
      | Some name -> (false, name)
      | None -> (true, "")
    in
    let eol = match use_stdin, input_file with
      | (true, _) -> Eol_detect.default_eol
      | (false, name) -> Eol_detect.get_eol_for_file name
    in
    let parse_ast = match parse_ast, use_stdin with
      | (Some x, _) -> x
      | (None, false) -> `Auto
      | (None, true) -> `Reason (* default *)
    in
    let constructorLists = match heuristics_file with
      | Some f_name -> read_lines f_name<commit_msg>Read heuristic file correctly on windows<commit_after>(*
 * Copyright (c) 2015-present, Facebook, Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *)

module Cmdliner = Vendored_cmdliner
open Cmdliner

let read_text_lines file =
  let list = ref [] in
  let chan = open_in file in
  try
    while true do
      list := input_line chan :: !list
    done;
    []
  with End_of_file ->
    close_in chan;
    List.rev !list

let refmt
    interface
    is_recoverable
    explicit_arity
    parse_ast
    print
    print_width
    heuristics_file
    in_place
    input_files
  =
  let refmt_single input_file =
    let (use_stdin, input_file) = match input_file with
      | Some name -> (false, name)
      | None -> (true, "")
    in
    let eol = match use_stdin, input_file with
      | (true, _) -> Eol_detect.default_eol
      | (false, name) -> Eol_detect.get_eol_for_file name
    in
    let parse_ast = match parse_ast, use_stdin with
      | (Some x, _) -> x
      | (None, false) -> `Auto
      | (None, true) -> `Reason (* default *)
    in
    let constructorLists = match heuristics_file with
      | Some f_name -> read_text_lines f_name
{'fraction_non_alphanumeric': 0.08446084460844608, 'fraction_numerical': 0.003280032800328003, 'mean_word_length': 2.5672514619883042, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2324496', 'n_tokens_mistral': 828, 'n_tokens_neox': 805, 'n_words': 256}