Skip to content

Commit 6f83420

Browse files
committed
add InteractiveUtils as dep, and tweak implemented_methods trait definition
1 parent 120e1a6 commit 6f83420

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ authors = ["Thibaut Lienart and Anthony Blaom"]
44
version = "1.11.1"
55

66
[deps]
7+
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
78
REPL = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
89
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
910
ScientificTypesBase = "30f210dd-8aff-4c5f-94ba-8e64358c1161"

src/MLJModelInterface.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ const ABSTRACT_MODEL_SUBTYPES = [
6363
using ScientificTypesBase
6464
using StatisticalTraits
6565
using Random
66+
using InteractiveUtils
6667
using REPL # apparently needed to get Base.Docs.doc to work
6768

6869
import StatisticalTraits: info

src/model_traits.jl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,10 @@ function StatTraits.target_scitype(::Type{<:DeterministicDetector})
5050
return AbstractVector{<:Union{Missing, OrderedFactor{2}}}
5151
end
5252

53-
# implementation is deferred as it requires methodswith which depends upon
54-
# InteractiveUtils which we don't want to bring here as a dependency
55-
# (even if it's stdlib).
56-
implemented_methods(M::Type) = implemented_methods(get_interface_mode(), M)
53+
implemented_methods(M::Type) = getfield.(methodswith(M), :name) |> unique
5754
implemented_methods(model) = implemented_methods(typeof(model))
55+
56+
# can be removed in MLJModelInterface 2.0:
5857
implemented_methods(::LightInterface, M) = errlight("implemented_methods")
5958

6059
for M in ABSTRACT_MODEL_SUBTYPES

0 commit comments

Comments
 (0)