Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proper numargs for PartialFunctions #531

Merged
merged 1 commit into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "SciMLBase"
uuid = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
authors = ["Chris Rackauckas <[email protected]> and contributors"]
version = "2.4.3"
version = "2.5.0"

[deps]
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
Expand Down Expand Up @@ -33,12 +33,14 @@ TruncatedStacktraces = "781d530d-4396-4725-bb49-402e4bee1e77"
ZygoteRules = "700de1a5-db45-46bc-99cf-38207098b444"

[weakdeps]
PartialFunctions = "570af359-4316-4cb7-8c74-252c00c2016b"
PyCall = "438e738f-606a-5dbb-bf0a-cddfbfd45ab0"
PythonCall = "6099a3de-0909-46bc-b1f4-468b9a2dfc0d"
RCall = "6f49c342-dc21-5d91-9882-a32aef131414"
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"

[extensions]
SciMLBasePartialFunctionsExt = "PartialFunctions"
SciMLBasePyCallExt = "PyCall"
SciMLBasePythonCallExt = "PythonCall"
SciMLBaseRCallExt = "RCall"
Expand All @@ -55,6 +57,7 @@ EnumX = "1"
FillArrays = "1.6"
FunctionWrappersWrappers = "0.1.3"
IteratorInterfaceExtensions = "^0.1, ^1"
PartialFunctions = "1.1"
PrecompileTools = "1"
Preferences = "1.3"
RCall = "0.13.18"
Expand All @@ -76,6 +79,7 @@ Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
DelayDiffEq = "bcd4f6db-9728-5f36-b5f7-82caef46ccdb"
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
PartialFunctions = "570af359-4316-4cb7-8c74-252c00c2016b"
PyCall = "438e738f-606a-5dbb-bf0a-cddfbfd45ab0"
PythonCall = "6099a3de-0909-46bc-b1f4-468b9a2dfc0d"
RCall = "6f49c342-dc21-5d91-9882-a32aef131414"
Expand All @@ -86,4 +90,4 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"

[targets]
test = ["Pkg", "PyCall", "PythonCall", "SafeTestsets", "Test", "StaticArrays", "StochasticDiffEq", "Aqua", "Zygote"]
test = ["Pkg", "PyCall", "PythonCall", "SafeTestsets", "Test", "StaticArrays", "StochasticDiffEq", "Aqua", "Zygote", "PartialFunctions"]
7 changes: 7 additions & 0 deletions ext/SciMLBasePartialFunctionsExt.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module SciMLBasePartialFunctionsExt

using PartialFunctions, SciMLBase

SciMLBase.numargs(::PartialFunctions.PartialFunction{KL, UL}) where {KL, UL} = [length(UL)]

Check warning on line 5 in ext/SciMLBasePartialFunctionsExt.jl

View check run for this annotation

Codecov / codecov/patch

ext/SciMLBasePartialFunctionsExt.jl#L5

Added line #L5 was not covered by tests

end
15 changes: 15 additions & 0 deletions test/downstream/partial_functions.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using SciMLBase, PartialFunctions, Test

partial_add = @$ +(_, _)
partial_add2 = @$ +(_, 2)
partial_add3 = @$ +(3, _)

@test only(SciMLBase.numargs(partial_add)) == 2
@test only(SciMLBase.numargs(partial_add2)) == 1
@test only(SciMLBase.numargs(partial_add3)) == 1

f1(args...) = args

@test only(SciMLBase.numargs(@$ f1(_, _, _))) == 3
@test only(SciMLBase.numargs(@$ f1(_, _, _, _, 4))) == 4
@test only(SciMLBase.numargs(@$ f1(_, _, _, _, _))) == 5
3 changes: 3 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ end
@time @safetestset "Autodiff Remake" begin
include("downstream/remake_autodiff.jl")
end
@time @safetestset "Partial Functions" begin
include("downstream/partial_functions.jl")
end
end

if !is_APPVEYOR && GROUP == "Python"
Expand Down
Loading