<commit_before>(ns compojure.handler
  "Functions to create Ring handlers from routes."
  (:use [ring.middleware params
                         keyword-params
                         nested-params
                         multipart-params
                         cookies
                         session]))

(defn- with-opts
  [routes middleware opts]
  (if opts
    (middleware routes opts)
    (middleware routes)))

(defn api
  "Create a handler suitable for a web API."
  [routes]
  (-> routes
      wrap-keyword-params
      wrap-nested-params
      wrap-params))

(defn site
  "Create a handler suitable for a standard website."
  [routes & [opts]]
  (-> (api routes)
      (wrap-multipart-params)
      (with-opts wrap-session (:session opts))))
<commit_msg>Improved docstrings on compojure.handler functions<commit_after>(ns compojure.handler
  "Functions to create Ring handlers from routes."
  (:use [ring.middleware params
                         keyword-params
                         nested-params
                         multipart-params
                         cookies
                         session]))

(defn- with-opts [routes middleware opts]
  (if opts
    (middleware routes opts)
    (middleware routes)))

(defn api
  "Create a handler suitable for a web API. This adds the following
  middleware to your routes:
    - wrap-params
    - wrap-nested-params
    - wrap-keyword-params"
  [routes]
  (-> routes
      wrap-keyword-params
      wrap-nested-params
      wrap-params))

(defn site
  "Create a handler suitable for a standard website. This adds the
  following middleware to your routes:
    - wrap-session
    - wrap-cookies
    - wrap-multipart-params
    - wrap-params
    - wrap-nested-params
    - wrap-keyword-params

  A map of options may also be provided. These keys are provided:
    :session - a map of session middleware options"
  [routes & [opts]]
  (-> (api routes)
      (wrap-multipart-params)
      (with-opts wrap-session (:session opts))))

{'fraction_non_alphanumeric': 0.0880440220110055, 'fraction_numerical': 0.0, 'mean_word_length': 1.9585798816568047, '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': '5185143', 'n_tokens_mistral': 549, 'n_tokens_neox': 536, 'n_words': 174}