<commit_before>(ns clojars.dev.setup
  "Tools to setup a dev db."
  (:require [clojars.config :refer [config]]
            [clojars.db :as db]
            [clojars.search :as search]
            [clojure.java.io :as io]
            [clojure.string :as str]
            [clojars.db.sql :as sql])
  (:import [org.apache.maven.artifact.repository.metadata Metadata Versioning]
           [org.apache.maven.artifact.repository.metadata.io.xpp3
            MetadataXpp3Reader
            MetadataXpp3Writer]))

(defn reset-db! [db]
  (sql/clear-jars! {} {:connection db})
  (sql/clear-groups! {} {:connection db})
  (sql/clear-users! {} {:connection db}))

(defn add-test-users
  "Adds n test users of the form test0/test0."
  [db n]
  (mapv #(let [name (str "test" %)]
           (if (db/find-user db name)
             (println "User" name "already exists")
             (do
               (printf "Adding user %s/%s\n" name name)
               (db/add-user db (str name "@example.com") name name "")))<commit_msg>Fix arity exception when adding test users for dev<commit_after>(ns clojars.dev.setup
  "Tools to setup a dev db."
  (:require [clojars.config :refer [config]]
            [clojars.db :as db]
            [clojars.search :as search]
            [clojure.java.io :as io]
            [clojure.string :as str]
            [clojars.db.sql :as sql])
  (:import [org.apache.maven.artifact.repository.metadata Metadata Versioning]
           [org.apache.maven.artifact.repository.metadata.io.xpp3
            MetadataXpp3Reader
            MetadataXpp3Writer]))

(defn reset-db! [db]
  (sql/clear-jars! {} {:connection db})
  (sql/clear-groups! {} {:connection db})
  (sql/clear-users! {} {:connection db}))

(defn add-test-users
  "Adds n test users of the form test0/test0."
  [db n]
  (mapv #(let [name (str "test" %)]
           (if (db/find-user db name)
             (println "User" name "already exists")
             (do
               (printf "Adding user %s/%s\n" name name)
               (db/add-user db (str name "@example.com") name name)))
{'fraction_non_alphanumeric': 0.14382896015549076, 'fraction_numerical': 0.004859086491739553, 'mean_word_length': 2.2476340694006307, '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': '3069473', 'n_tokens_mistral': 702, 'n_tokens_neox': 676, 'n_words': 180}