<commit_before>(ns lazytest.watch
  (:gen-class)
  (:use	[lazytest.reload :only (reload)]
	[lazytest.tracker :only (tracker)]
	[clojure.java.io :only (file)]
	[clojure.string :only (join)])
  (:require lazytest.runner.console
	    lazytest.report.nested)
  (:import (java.util.concurrent ScheduledThreadPoolExecutor TimeUnit)
	   (java.util.regex Pattern)
	   (java.io File)))

(defn reload-and-run [tracker run-fn report-fn]
  (try 
    (let [new-names (seq (tracker))]
      (when new-names
	(println)
	(println "======================================================================")
	(println "At " (java.util.Date.))
	(println "Reloading" (join ", " new-names))
	(apply reload new-names)
	(report-fn (apply run-fn new-names))
	(println "\nDone.")))
    (catch Throwable t
      (println "ERROR:" t)
      (.printStackTrace t))))

(defn reloading-runner [dirs run-fn report-fn]
  (let [dirs (map file dirs)
	track (tracker dirs 0)]
    (fn [] (reload-and-run track run-fn report-fn))))

(defn start [dirs & options]
  (let [{:keys [run-fn report-fn delay]
	 :or {run-fn lazytest.runner.console/run-tests
	      report-fn lazytest.report.nested/report<commit_msg>Watcher: print summary of load-time exception below stacktrace<commit_after>(ns lazytest.watch
  (:gen-class)
  (:use	[lazytest.reload :only (reload)]
	[lazytest.tracker :only (tracker)]
	[lazytest.color :only (colorize)]
	[clojure.java.io :only (file)]
	[clojure.string :only (join)])
  (:require lazytest.runner.console
	    lazytest.report.nested)
  (:import (java.util.concurrent ScheduledThreadPoolExecutor TimeUnit)
	   (java.util.regex Pattern)
	   (java.io File)))

(defn reload-and-run [tracker run-fn report-fn]
  (try 
    (let [new-names (seq (tracker))]
      (when new-names
	(println)
	(println "======================================================================")
	(println "At " (java.util.Date.))
	(println "Reloading" (join ", " new-names))
	(apply reload new-names)
	(report-fn (apply run-fn new-names))
	(println "\nDone.")))
    (catch Throwable t
      (println "ERROR:" t)
      (.printStackTrace t)
      (newline)
      (println (colorize "ERROR while loading:" :red))
      (println t))))

(defn reloading-runner [dirs run-fn report-fn]
  (let [dirs (map file dirs)
	track (tracker dirs 0)]
    (fn [] (reload-and-run track run-fn report-fn))))

(defn start [dirs & options]
  (let [{:keys [run-fn report-fn delay]
	 :or {run-fn lazytest.runner.console/run-tests
	      report-fn lazytest.report.nested/report
{'fraction_non_alphanumeric': 0.20741922616673314, 'fraction_numerical': 0.0007977662544874351, 'mean_word_length': 3.908023483365949, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1063296', 'n_tokens_mistral': 890, 'n_tokens_neox': 878, 'n_words': 214}