<commit_before>(ns clj-money.authorization
  (:require [clojure.tools.logging :as log]
            [clojure.pprint :refer [pprint]]
            [slingshot.slingshot :refer [throw+]]
            [environ.core :refer [env]]
            [cemerick.friend :refer [current-authentication]]
            [clj-money.util :refer [pprint-and-return]]))

(defn get-resource-tag
  "Returns a keyword identifying the type of the resource"
  [resource]
  (if-let [result (if (keyword? resource)
                    resource
                    (-> resource meta ::resource-type))]
    result
    (throw (ex-info "Unable to determine the resource type." {:resource resource}))))

(defn tag-resource
  "Adds meta data to identity the type of the specified resource"
  [resource tag]
  (vary-meta resource #(assoc % ::resource-type tag)))

(def ^:private auth-context (atom {}))
<commit_msg>throw exception on null resource<commit_after>(ns clj-money.authorization
  (:require [clojure.tools.logging :as log]
            [clojure.pprint :refer [pprint]]
            [slingshot.slingshot :refer [throw+]]
            [environ.core :refer [env]]
            [cemerick.friend :refer [current-authentication]]
            [clj-money.util :refer [pprint-and-return]]))

(defn get-resource-tag
  "Returns a keyword identifying the type of the resource"
  [resource]
  (if-not resource
    (throw (IllegalArgumentException. "resource cannot be null")))
  (if-let [result (if (keyword? resource)
                    resource
                    (-> resource meta ::resource-type))]
    result
    (throw (ex-info "Unable to determine the resource type." {:resource resource}))))

(defn tag-resource
  "Adds meta data to identity the type of the specified resource"
  [resource tag]
  (vary-meta resource #(assoc % ::resource-type tag)))

(def ^:private auth-context (atom {}))

{'fraction_non_alphanumeric': 0.12641815235008103, 'fraction_numerical': 0.0, 'mean_word_length': 2.8663883089770357, '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': '5198618', 'n_tokens_mistral': 559, 'n_tokens_neox': 555, 'n_words': 167}