Skip to content

Commit 7ae5265

Browse files
authored
Merge pull request #161 from JuliaAI/descr-warning-tweak
Tweak warning for deprecated use of docstring/descr
2 parents 7cd0ecf + cf5c5e3 commit 7ae5265

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/metadata_utils.jl

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,16 @@ function _extend!(program::Expr, trait::Symbol, value, T)
6565
end
6666
end
6767

68-
const DEPWARN_DOCSTRING =
69-
"`metadata_model` should not be called with the keyword argument "*
70-
"`descr` or `docstring`. Implementers of the MLJ model interface "*
71-
"should instead create an MLJ-compliant docstring in the usual way. "*
72-
"See https://alan-turing-institute.github.io/MLJ.jl/dev/adding_models_for_general_use/#Document-strings for details. "
68+
const depwarn_docstring(T) =
69+
"""
70+
71+
Regarding $T: `metadata_model` should not be called with the keyword argument `descr`
72+
or `docstring`. Implementers of the MLJ model interface should instead create an
73+
MLJ-compliant docstring in the usual way. See
74+
https://alan-turing-institute.github.io/MLJ.jl/dev/adding_models_for_general_use/#Document-strings
75+
for details.
76+
77+
"""
7378

7479
"""
7580
metadata_model(T; args...)
@@ -122,7 +127,7 @@ function metadata_model(
122127
supports_training_losses::Union{Nothing,Bool}=nothing,
123128
reports_feature_importances::Union{Nothing,Bool}=nothing,
124129
)
125-
docstring === nothing || Base.depwarn(DEPWARN_DOCSTRING, :metadata_model)
130+
docstring === nothing || Base.depwarn(depwarn_docstring(T), :metadata_model)
126131

127132
program = quote end
128133

0 commit comments

Comments
 (0)