From 5b2abe52aa623bed255bc38e59b560ebaea65264 Mon Sep 17 00:00:00 2001 From: "Anthony D. Blaom" Date: Thu, 30 May 2024 13:36:25 +1200 Subject: [PATCH 1/7] add constructor trait --- src/StatisticalTraits.jl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/StatisticalTraits.jl b/src/StatisticalTraits.jl index f6df0e7..72a39a2 100644 --- a/src/StatisticalTraits.jl +++ b/src/StatisticalTraits.jl @@ -42,6 +42,7 @@ const TRAITS = [ :supports_training_losses, :deep_properties, :reporting_operations, + :constructor, ] @@ -184,6 +185,7 @@ iteration_parameter(::Type) = nothing supports_training_losses(::Type) = false deep_properties(::Type) = () reporting_operations(::Type) = () +constructor(::Type) = nothing # Returns a tuple, with one entry per field of `T` (the type of some # statistical model, for example). Each entry is `nothing` or defines From a5331b4fdb394aae2a11c0428088cebbd56a5a9c Mon Sep 17 00:00:00 2001 From: "Anthony D. Blaom" Date: Thu, 30 May 2024 13:36:54 +1200 Subject: [PATCH 2/7] bump 3.3.0 --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 5f05d50..51650b2 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "StatisticalTraits" uuid = "64bff920-2084-43da-a3e6-9bb72801c0c9" authors = ["Anthony D. Blaom "] -version = "3.2.0" +version = "3.3.0" [deps] ScientificTypesBase = "30f210dd-8aff-4c5f-94ba-8e64358c1161" From f0d0685ef074d3ba7938fcb24d25fd826cc8e7e9 Mon Sep 17 00:00:00 2001 From: "Anthony D. Blaom" Date: Fri, 31 May 2024 09:08:34 +1200 Subject: [PATCH 3/7] bump 3.4 --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 51650b2..afebf49 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "StatisticalTraits" uuid = "64bff920-2084-43da-a3e6-9bb72801c0c9" authors = ["Anthony D. Blaom "] -version = "3.3.0" +version = "3.4.0" [deps] ScientificTypesBase = "30f210dd-8aff-4c5f-94ba-8e64358c1161" From f2a602b85c8524c7cddfcc55e892ea3c4538aaa4 Mon Sep 17 00:00:00 2001 From: "Anthony D. Blaom" Date: Mon, 3 Jun 2024 16:04:43 +1200 Subject: [PATCH 4/7] add fallback for `docstring(::Function)` --- src/StatisticalTraits.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/src/StatisticalTraits.jl b/src/StatisticalTraits.jl index 72a39a2..2f0676d 100644 --- a/src/StatisticalTraits.jl +++ b/src/StatisticalTraits.jl @@ -173,6 +173,7 @@ abstract_type(::Type) = Any is_wrapper(::Type) = false # or `true` supports_online(::Type) = false # or `true` docstring(M::Type) = string(M) # some `String` +docstring(Contructor::Function) = Base.Docs.doc(Constructor) |> string is_supervised(::Type) = false # or `true` human_name(M::Type) = snakecase(name(M), delim=' ') # `name` defined below orientation(::Type) = :loss # or `:score`, `:other` From bf32e3b6b6525a870e42e76be693f52e20e177a6 Mon Sep 17 00:00:00 2001 From: "Anthony D. Blaom" Date: Mon, 3 Jun 2024 16:09:48 +1200 Subject: [PATCH 5/7] rever version to 3.3.0 --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index afebf49..51650b2 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "StatisticalTraits" uuid = "64bff920-2084-43da-a3e6-9bb72801c0c9" authors = ["Anthony D. Blaom "] -version = "3.4.0" +version = "3.3.0" [deps] ScientificTypesBase = "30f210dd-8aff-4c5f-94ba-8e64358c1161" From e13b3c1623b395235d3d134700d11188e41486d2 Mon Sep 17 00:00:00 2001 From: "Anthony D. Blaom" Date: Mon, 3 Jun 2024 16:16:10 +1200 Subject: [PATCH 6/7] add test to fix coverage --- test/runtests.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/test/runtests.jl b/test/runtests.jl index aee1d51..da7c87b 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -46,6 +46,7 @@ end @testset "docstring" begin @test docstring(Foo(1,'x')) == "Foo" @test docstring(Fruit.RedApple(4)) == "Main.Fruit.RedApple{Int64}" + @test docstring(sin) = Base.Docs.doc(sin) |> string end @testset "hyperparameter_ranges" begin From 978ad65a19dec10bcd5cf959b19c9ad2929a24c7 Mon Sep 17 00:00:00 2001 From: "Anthony D. Blaom" Date: Mon, 3 Jun 2024 16:19:10 +1200 Subject: [PATCH 7/7] fix failing test --- src/StatisticalTraits.jl | 2 +- test/runtests.jl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/StatisticalTraits.jl b/src/StatisticalTraits.jl index 2f0676d..1d0e960 100644 --- a/src/StatisticalTraits.jl +++ b/src/StatisticalTraits.jl @@ -173,7 +173,7 @@ abstract_type(::Type) = Any is_wrapper(::Type) = false # or `true` supports_online(::Type) = false # or `true` docstring(M::Type) = string(M) # some `String` -docstring(Contructor::Function) = Base.Docs.doc(Constructor) |> string +docstring(Constructor::Function) = Base.Docs.doc(Constructor) |> string is_supervised(::Type) = false # or `true` human_name(M::Type) = snakecase(name(M), delim=' ') # `name` defined below orientation(::Type) = :loss # or `:score`, `:other` diff --git a/test/runtests.jl b/test/runtests.jl index da7c87b..99afdf1 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -46,7 +46,7 @@ end @testset "docstring" begin @test docstring(Foo(1,'x')) == "Foo" @test docstring(Fruit.RedApple(4)) == "Main.Fruit.RedApple{Int64}" - @test docstring(sin) = Base.Docs.doc(sin) |> string + @test docstring(sin) == Base.Docs.doc(sin) |> string end @testset "hyperparameter_ranges" begin