<commit_before>(ns hbase-region-inspector.core
  (:require [clojure.string :as str]
            [clojure.set :as set]
            [clojure.java.io :as io]
            [cheshire.core :as json]
            [ring.adapter.jetty :refer [run-jetty]]
            [ring.util.response :refer [response content-type resource-response]]
            [ring.middleware.defaults :refer [wrap-defaults api-defaults site-defaults]]
            [ring.middleware.gzip :refer [wrap-gzip]]
            [compojure.core :refer [defroutes GET PUT routes wrap-routes]]
            [compojure.route :as route]
            [hiccup.core :as h]
            [selmer.parser :refer [render-file]]
            [hbase-region-inspector.hbase :as hbase]
            [hbase-region-inspector.util :as util]
            [hbase-region-inspector.config :as config])
  (:gen-class))

(defonce ^{:doc "Application configuration"} config (atom {}))
(defonce ^{:doc "Whether we should allow region relocation or not"} read-only? (atom true))
(defonce ^{:doc "Whether we should include system regions or not"} with-system? (atom true))
(defonce ^{:doc "Cached result of the previous inspection"} cached
  (atom {:updated-at nil :regions [] :response {}}))
(defonce ^{:doc "Inspection interval"} update-interval (atom 10))

(defn long-fmt
  "Returns string representation of the given integer"
  [val]
  (str/replace (str (long val)) #"\B(?=(\d{3})+(?!\d))" ","))

(defn format-val
  "String formatter for region properties"
  [type val & [props]]
  (let [mb #(format "%s MB" (long-fmt %))
        kb #(format "%s KB" (long-fmt %))
        rate #(if (> % 10) (long-fmt %) (format "%.2f" (double %)))
        count-rate #(if %2
                      (format "%s (%s/sec)" (long-fmt %1) (rate %2))<commit_msg>Assign default values to @config atom<commit_after>(ns hbase-region-inspector.core
  (:require [clojure.string :as str]
            [clojure.set :as set]
            [clojure.java.io :as io]
            [cheshire.core :as json]
            [ring.adapter.jetty :refer [run-jetty]]
            [ring.util.response :refer [response content-type resource-response]]
            [ring.middleware.defaults :refer [wrap-defaults api-defaults site-defaults]]
            [ring.middleware.gzip :refer [wrap-gzip]]
            [compojure.core :refer [defroutes GET PUT routes wrap-routes]]
            [compojure.route :as route]
            [hiccup.core :as h]
            [selmer.parser :refer [render-file]]
            [hbase-region-inspector.hbase :as hbase]
            [hbase-region-inspector.util :as util]
            [hbase-region-inspector.config :as config])
  (:gen-class))

(defonce ^{:doc "Application configuration"} config (atom {}))
(defonce ^{:doc "Whether we should allow region relocation or not"} read-only? (atom true))
(defonce ^{:doc "Whether we should include system regions or not"} with-system? (atom true))
(defonce ^{:doc "Cached result of the previous inspection"} cached
  (atom {:updated-at nil
         :has-locality false
         :regions []
         :servers {}
         :tables {}
         :response {}}))
(defonce ^{:doc "Inspection interval"} update-interval (atom 10))

(defn long-fmt
  "Returns string representation of the given integer"
  [val]
  (str/replace (str (long val)) #"\B(?=(\d{3})+(?!\d))" ","))

(defn format-val
  "String formatter for region properties"
  [type val & [props]]
  (let [mb #(format "%s MB" (long-fmt %))
        kb #(format "%s KB" (long-fmt %))
        rate #(if (> % 10) (long-fmt %) (format "%.2f" (double %)))
        count-rate #(if %2
                      (format "%s (%s/sec)" (long-fmt %1) (rate %2))
{'fraction_non_alphanumeric': 0.15721365638766518, 'fraction_numerical': 0.004955947136563877, 'mean_word_length': 2.684584178498986, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '513903', 'n_tokens_mistral': 1191, 'n_tokens_neox': 1159, 'n_words': 334}