<commit_before>(ns cctray-clj.parser
  (:require [clojure.xml :as xml]
            [clojure.string :refer [split]]))

(defn to-map [url]
  (xml/parse url))

(defn extract-name [name]
  (let [split-name (split name #"\s::\s")]
    {:name (first split-name) :pipeline (second split-name) :stage (last split-name)}))

(defn get-projects [url]
  (let [content (:content (to-map url))]
    (remove nil? (map
                   #(if (= (:tag %) :Project)
                     (merge (:attrs %) (extract-name (get-in % [:attrs :name]))))
                   content))))<commit_msg>Ste - Refactors anoymous function to seperate function<commit_after>(ns cctray-clj.parser
  (:require [clojure.xml :as xml]
            [clojure.string :refer [split]]))

(defn to-map [url]
  (xml/parse url))

(defn extract-name [name]
  (let [split-name (split name #"\s::\s")]
    {:name (first split-name) :pipeline (second split-name) :stage (last split-name)}))

(defn extract-attributes [data]
  (if (= (:tag data) :Project)
    (merge (:attrs data) (extract-name (get-in data [:attrs :name])))))

(defn get-projects [url]
  (let [content (:content (to-map url))]
    (remove nil? (map
                   #(extract-attributes %)
                   content))))
{'fraction_non_alphanumeric': 0.18174474959612277, 'fraction_numerical': 0.0, 'mean_word_length': 2.8006134969325154, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, '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': '4089333', 'n_tokens_mistral': 441, 'n_tokens_neox': 424, 'n_words': 116}