<commit_before>(ns panpan.github.search
  (:require
    [clojure.string    :as str]
    [clj-http.client   :as client]
    [clojure.data.json :as json]))

(def ^:const SEARCH_API
  "https://api.github.com/search/issues")

(defn- parse-json
  [s]
  (json/read-str s :key-fn keyword))

(defn map->query
  [m]
  (->> (keys m)
       (map #(list (name %) (get m %)))
       (map #(str/join ":" %))
       (str/join "+")))

(defn get-assigned-issues
  [username & {:as option}]
  (some->> {:assignee username}
           (merge option)
           map->query
           (str SEARCH_API "?q=")
           client/get
           :body
           parse-json
           :items))<commit_msg>rename constant<commit_after>(ns panpan.github.search
  (:require
    [clojure.string    :as str]
    [clj-http.client   :as client]
    [clojure.data.json :as json]))

(def ^:const SEARCH_ISSUE
  "https://api.github.com/search/issues")

(def ^:const SEARCH_REPOSITORY
  "https://api.github.com/search/repositories")

(defn- parse-json
  [s]
  (json/read-str s :key-fn keyword))

(defn map->query
  [m]
  (->> (keys m)
       (map #(list (name %) (get m %)))
       (map #(str/join ":" %))
       (str/join "+")))

(defn get-assigned-issues
  [username & {:as option}]
  (some->> {:assignee username}
           (merge option)
           map->query
           (str SEARCH_ISSUE "?q=")
           client/get
           :body
           parse-json
           :items))
{'fraction_non_alphanumeric': 0.17659279778393353, 'fraction_numerical': 0.0, 'mean_word_length': 2.1344902386117135, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 3, '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': '4124409', 'n_tokens_mistral': 543, 'n_tokens_neox': 530, 'n_words': 112}