<commit_before>(ns sparql-to-csv.mustache
  (:require [sparql-to-csv.util :as util]
            [stencil.parser :refer [parse valid-tag-content]]
            [slingshot.slingshot :refer [throw+]]
            [clojure.set :refer [subset?]]
            [clojure.string :as string]))

(defn get-template-variables
  "Get a set of variables used in `template`."
  [template]
  (->> (parse template)
       (filter (complement string?))
       (mapcat :name)
       set))

(defn is-paged?
  "Is the query in `template` paged?"
  [template]
  (subset? #{:limit :offset} (get-template-variables template)))

(defn valid-variable-name?<commit_msg>Paged queries need only LIMIT<commit_after>(ns sparql-to-csv.mustache
  (:require [sparql-to-csv.util :as util]
            [stencil.parser :refer [parse valid-tag-content]]
            [slingshot.slingshot :refer [throw+]]
            [clojure.set :refer [subset?]]
            [clojure.string :as string]))

(defn get-template-variables
  "Get a set of variables used in `template`."
  [template]
  (->> (parse template)
       (filter (complement string?))
       (mapcat :name)
       set))

(defn is-paged?
  "Is the query in `template` paged?"
  [template]
  (subset? #{:limit} (get-template-variables template)))

(defn valid-variable-name?
{'fraction_non_alphanumeric': 0.14852255054432348, 'fraction_numerical': 0.0, 'mean_word_length': 2.9478527607361964, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '2951397', 'n_tokens_mistral': 434, 'n_tokens_neox': 438, 'n_words': 110}