Skip to content

Commit 69332ca

Browse files
committed
refactor: clear clj-kondo findings in source
Unused bindings, imports, and requires flagged by the new lint gate. No behavior change; findings needing judgment were left in place and the relevant linter downgraded in .clj-kondo/config.edn instead.
1 parent 1a5906c commit 69332ca

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

src/tokenizers/core.clj

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
[java.util Locale]
1919
[ai.djl.util PairList]))
2020

21-
(defn- ^Path as-path [x]
21+
(defn- as-path ^Path [x]
2222
(cond
2323
(instance? Path x) x
2424
(instance? File x) (.toPath ^File x)
@@ -105,25 +105,25 @@
105105
[(if (keyword? key) (name key) (str key)) (str value)]))
106106
(merge (:options opts) (:raw-options opts))))
107107

108-
(defn- ^java.util.Map constructor-options [opts]
108+
(defn- constructor-options ^java.util.Map [opts]
109109
(merge (djl-options opts) (raw-options opts)))
110110

111-
(defn ^HuggingFaceTokenizer$Builder builder
111+
(defn builder
112112
"Create a DJL tokenizer builder configured from wrapper opts.
113113
Entries in `:options` or `:raw-options` pass through verbatim by DJL option
114114
name, such as `modelMaxLength`, `stripAccents`, and `addPrefixSpace`; keyword
115115
keys are converted with `name`. Raw entries override translated wrapper opts.
116116
`:manager` attaches the built tokenizer to a caller-supplied `NDManager`."
117-
([]
117+
(^HuggingFaceTokenizer$Builder []
118118
(HuggingFaceTokenizer/builder))
119-
([opts]
119+
(^HuggingFaceTokenizer$Builder [opts]
120120
(let [builder (HuggingFaceTokenizer/builder)]
121121
(.configure builder (constructor-options opts))
122122
(when-let [manager (:manager opts)]
123123
(.optManager builder manager))
124124
builder)))
125125

126-
(defn- ^TokenizerConfig tokenizer-config [opts]
126+
(defn- tokenizer-config ^TokenizerConfig [opts]
127127
(some-> (:tokenizer-config opts) as-path TokenizerConfig/load))
128128

129129
(defn from-file
@@ -296,17 +296,17 @@
296296
:overflow (mapv enc->map (.getOverflowing e))
297297
:exceed-max-length? (.exceedMaxLength e)})
298298

299-
(defn- ^Encoding raw-encode
300-
([^HuggingFaceTokenizer t ^String text]
299+
(defn- raw-encode
300+
(^Encoding [^HuggingFaceTokenizer t ^String text]
301301
(.encode t text))
302-
([^HuggingFaceTokenizer t ^String text pair-or-opts]
302+
(^Encoding [^HuggingFaceTokenizer t ^String text pair-or-opts]
303303
(if (map? pair-or-opts)
304304
(let [{:keys [add-special-tokens? with-overflowing-tokens?]
305305
:or {add-special-tokens? true with-overflowing-tokens? false}} pair-or-opts]
306306
(.encode t text (boolean add-special-tokens?)
307307
(boolean with-overflowing-tokens?)))
308308
(.encode t text ^String pair-or-opts)))
309-
([^HuggingFaceTokenizer t ^String text ^String text-pair
309+
(^Encoding [^HuggingFaceTokenizer t ^String text ^String text-pair
310310
{:keys [add-special-tokens? with-overflowing-tokens?]
311311
:or {add-special-tokens? true with-overflowing-tokens? false}}]
312312
(.encode t text text-pair (boolean add-special-tokens?)

0 commit comments

Comments
 (0)