<commit_before>(ns inky.env
  "Shell environment helpers."
  (:require [clojure.string :as str])
  (:refer-clojure :exclude (int str)))

(defn clj->env [sym-or-str]
  (-> sym-or-str
      name
      (str/replace #"-" "_")
      (str/upper-case)))

(defn env
  "Retrieve environment variables by clojure keyword style.
   ex. (env :user) ;=> \"zk\". Called w/o default throws an
  exception."
  [sym & [default]]
  (or (System/getenv (clj->env sym))
      default
      (throw (Exception. (clojure.core/str "Missing env var " (clj->env sym) ".")))))

(defn int
  "Retrieve and parse int env var."
  [sym & [default]]
  (if-let [env-var (env sym default)]
    (Integer/parseInt env-var)
    default))

(defn str<commit_msg>Remove throw exception on missing env<commit_after>(ns inky.env
  "Shell environment helpers."
  (:require [clojure.string :as str])
  (:refer-clojure :exclude (int str)))

(defn clj->env [sym-or-str]
  (-> sym-or-str
      name
      (str/replace #"-" "_")
      (str/upper-case)))

(defn env
  "Retrieve environment variables by clojure keyword style.
   ex. (env :user) ;=> \"zk\". Called w/o default throws an
  exception."
  [sym & [default]]
  (or (System/getenv (clj->env sym))
      default))

(defn int
  "Retrieve and parse int env var."
  [sym & [default]]
  (if-let [env-var (env sym default)]
    (Integer/parseInt env-var)
    default))

(defn str
{'fraction_non_alphanumeric': 0.16642547033285093, 'fraction_numerical': 0.0, 'mean_word_length': 2.9855907780979827, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 12, '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': '5408158', 'n_tokens_mistral': 508, 'n_tokens_neox': 498, 'n_words': 144}