<commit_before>(ns validation-benchmark.lib.annotate
  (:require [annotate.core :as ann]
            [annotate.types :as types]))


(defn nil-allowed-bool [v]
  (ann/check (types/Nilable Boolean) v))


(defn nil-allowed-number [v]
  (ann/check (types/Nilable types/Num) v))


(defn nil-allowed-string [v]
  (ann/check (types/Nilable String) v))


(defn set-of-keywords [v]
  (ann/check #{types/Keyword} v))


(defn three-tuple [v]
  (ann/check [types/Keyword String types/Num] v))


(defn vector-of-two-elements [v]
  (ann/check (types/I [types/Any] (types/Count 2)) v))


(defn vector-of-variable-length [v]
  (ann/check [types/Any] v))


(defn wrapper [f valid?]
  (fn [v]
    (= (nil? (f v)) valid?)))<commit_msg>Fixed annotate three-tuple checker.<commit_after>(ns validation-benchmark.lib.annotate
  (:require [annotate.core :as ann]
            [annotate.types :as types]))


(defn nil-allowed-bool [v]
  (ann/check (types/Nilable Boolean) v))


(defn nil-allowed-number [v]
  (ann/check (types/Nilable types/Num) v))


(defn nil-allowed-string [v]
  (ann/check (types/Nilable String) v))


(defn set-of-keywords [v]
  (ann/check #{types/Keyword} v))


(defn three-tuple [v]
  (ann/check (types/U [types/Keyword String types/Num]
                      (list types/Keyword String types/Num)) v))


(defn vector-of-two-elements [v]
  (ann/check (types/I [types/Any] (types/Count 2)) v))


(defn vector-of-variable-length [v]
  (ann/check [types/Any] v))


(defn wrapper [f valid?]
  (fn [v]
    (= (nil? (f v)) valid?)))
{'fraction_non_alphanumeric': 0.1778215223097113, 'fraction_numerical': 0.0013123359580052493, 'mean_word_length': 3.357142857142857, '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': '3858087', 'n_tokens_mistral': 608, 'n_tokens_neox': 588, 'n_words': 145}