<commit_before>;; Copyright © 2016-2017, JUXT LTD.

(ns tick.alpha.api
  (:refer-clojure
   :exclude [+ - * inc dec max min conj
             range time int long complement
             < <= > >= << >>
             extend
             atom swap! swap-vals! compare-and-set!
             reset! reset-vals!
             second
             group-by divide format] )
  (:require
    [tick.core :as core]
    [tick.format :as t.f]
    [tick.protocols :as p]
    [cljc.java-time.duration]
    [cljc.java-time.zone-offset]
    [cljc.java-time.day-of-week]
    [cljc.java-time.month]
    #?(:clj tick.file) ; To ensure protocol extension
    [tick.interval :as interval]
    #?@(:cljs
       [[java.time.format :refer [DateTimeFormatter]]]))
  #?(:cljs
     (:require-macros
       [tick.alpha.api :refer [with-clock]]))
  #?(:clj
     (:import
       [java.time LocalDate]
       [java.time.format DateTimeFormatter])))

;; This API is optimises convenience, API stability and (type) safety
;; over performance. Where performance is critical, use tick.core and
;; friends.

;; Construction

(def new-time core/new-time)
(def new-date core/new-date)
(def new-year-month core/new-year-month)

;; Surfacing some useful constants

(def unit-map core/unit-map)

;; Point-in-time 'demo' functions

(defn now [] (core/now))
(defn today [] (core/today))
(defn tomorrow [] (core/tomorrow))
(defn yesterday [] (core/yesterday))

;; Conversions, with 0-arity defaults

(defn time
  ([] (p/time (now)))
  ([v] (p/time v)))

(defn date
  ([] (today))
  ([v] (p/date v)))

(defn inst
  ([] (p/inst (now)))
  ([v] (p/inst v)))

(defn instant
  ([] (p/instant (now)))
  ([v] (p/instant v)))

(defn date-time
  ([] (p/date-time (now)))
  ([v] (p/date-time v)))

(defn offset-date-time
  ([] (p/offset-date-time (now)))
  ([v] (p/offset-date-time v)))

(defn zoned-date-time
  ([] (p/zoned-date-time (now)))
  ([v] (p/zoned-date-time v)))

;; Extraction

(defn nanosecond [t] (p/nanosecond t))
(defn microsecond [t] (p/microsecond t))
(defn millisecond [t] (p/millisecond t))
(defn second [t] (p/second t))
(defn minute [t] (p/minute t))
(defn hour [t] (p/hour t))

(defn day-of-week
  ([] (p/day-of-week (today)))
  ([v] (p/day-of-week v)))

(defn day-of-month<commit_msg>type hint inst. fixes #132<commit_after>;; Copyright © 2016-2017, JUXT LTD.

(ns tick.alpha.api
  (:refer-clojure
   :exclude [+ - * inc dec max min conj
             range time int long complement
             < <= > >= << >>
             extend
             atom swap! swap-vals! compare-and-set!
             reset! reset-vals!
             second
             group-by divide format] )
  (:require
    [tick.core :as core]
    [tick.format :as t.f]
    [tick.protocols :as p]
    [cljc.java-time.duration]
    [cljc.java-time.zone-offset]
    [cljc.java-time.day-of-week]
    [cljc.java-time.month]
    #?(:clj tick.file) ; To ensure protocol extension
    [tick.interval :as interval]
    #?@(:cljs
       [[java.time.format :refer [DateTimeFormatter]]]))
  #?(:cljs
     (:require-macros
       [tick.alpha.api :refer [with-clock]]))
  #?(:clj
     (:import
       [java.time LocalDate]
       [java.time.format DateTimeFormatter])))

;; This API is optimises convenience, API stability and (type) safety
;; over performance. Where performance is critical, use tick.core and
;; friends.

;; Construction

(def new-time core/new-time)
(def new-date core/new-date)
(def new-year-month core/new-year-month)

;; Surfacing some useful constants

(def unit-map core/unit-map)

;; Point-in-time 'demo' functions

(defn now [] (core/now))
(defn today [] (core/today))
(defn tomorrow [] (core/tomorrow))
(defn yesterday [] (core/yesterday))

;; Conversions, with 0-arity defaults

(defn time
  ([] (p/time (now)))
  ([v] (p/time v)))

(defn date
  ([] (today))
  ([v] (p/date v)))

(defn inst
  (^java.util.Date [] (p/inst (now)))
  (^java.util.Date [v] (p/inst v)))

(defn instant
  ([] (p/instant (now)))
  ([v] (p/instant v)))

(defn date-time
  ([] (p/date-time (now)))
  ([v] (p/date-time v)))

(defn offset-date-time
  ([] (p/offset-date-time (now)))
  ([v] (p/offset-date-time v)))

(defn zoned-date-time
  ([] (p/zoned-date-time (now)))
  ([v] (p/zoned-date-time v)))

;; Extraction

(defn nanosecond [t] (p/nanosecond t))
(defn microsecond [t] (p/microsecond t))
(defn millisecond [t] (p/millisecond t))
(defn second [t] (p/second t))
(defn minute [t] (p/minute t))
(defn hour [t] (p/hour t))

(defn day-of-week
  ([] (p/day-of-week (today)))
  ([v] (p/day-of-week v)))

(defn day-of-month
{'fraction_non_alphanumeric': 0.18921892189218922, 'fraction_numerical': 0.0046204620462046205, 'mean_word_length': 2.852542372881356, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '777740', 'n_tokens_mistral': 1792, 'n_tokens_neox': 1710, 'n_words': 431}