<commit_before>(ns cake
  (:import [java.io File FileInputStream]
           [java.util Properties]))

(def ^{:dynamic true} *current-task* nil)
(def ^{:dynamic true} *project-root* (comment project))
(def ^{:dynamic true} *project*      (comment project))
(def ^{:dynamic true} *context*      (comment context))
(def ^{:dynamic true} *script*       nil)
(def ^{:dynamic true} *opts*         nil)
(def ^{:dynamic true} *args*         nil)
(def ^{:dynamic true} *pwd*          nil)
(def ^{:dynamic true} *env*          nil)
(def ^{:dynamic true} *vars*         nil)
(def ^{:dynamic true} *File*         nil)
(def ^{:dynamic true} *root*        (System/getProperty "cake.project"))
(def ^{:dynamic true} *global-root* (.getPath (File. (System/getProperty "user.home") ".cake")))

(def ^{:dynamic true} *ins*  nil)
(def ^{:dynamic true} *outs* nil)
(def ^{:dynamic true} *errs* nil)

(defn read-config [file]
  (if (.exists file)
    (with-open [f (FileInputStream. file)]
      (into {} (doto (Properties.) (.load f))))
    {}))

(def ^{:dynamic true} *config*
  (apply merge (map read-config [(File. (System/getProperty "user.home") ".cake/config")
                                 (File. "cake-config")
                                 (File. ".cake/config")])))<commit_msg>Simplify read-config impl<commit_after>(ns cake
  (:import [java.io File FileInputStream]
           [java.util Properties]))

(def ^{:dynamic true} *current-task* nil)
(def ^{:dynamic true} *project-root* (comment project))
(def ^{:dynamic true} *project*      (comment project))
(def ^{:dynamic true} *context*      (comment context))
(def ^{:dynamic true} *script*       nil)
(def ^{:dynamic true} *opts*         nil)
(def ^{:dynamic true} *args*         nil)
(def ^{:dynamic true} *pwd*          nil)
(def ^{:dynamic true} *env*          nil)
(def ^{:dynamic true} *vars*         nil)
(def ^{:dynamic true} *File*         nil)
(def ^{:dynamic true} *root*        (System/getProperty "cake.project"))
(def ^{:dynamic true} *global-root* (.getPath (File. (System/getProperty "user.home") ".cake")))

(def ^{:dynamic true} *ins*  nil)
(def ^{:dynamic true} *outs* nil)
(def ^{:dynamic true} *errs* nil)

(defn read-config [file]
  (into {} (when (.exists file)
             (with-open [f (FileInputStream. file)]
               (doto (Properties.) (.load f))))))

(def ^{:dynamic true} *config*
  (apply merge (map read-config [(File. (System/getProperty "user.home") ".cake/config")
                                 (File. "cake-config")
                                 (File. ".cake/config")])))
{'fraction_non_alphanumeric': 0.19005052467936262, 'fraction_numerical': 0.0, 'mean_word_length': 2.7797356828193833, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5058574', 'n_tokens_mistral': 830, 'n_tokens_neox': 813, 'n_words': 255}