From 314fa388e906d03b8a4281625af1483dfe673eab Mon Sep 17 00:00:00 2001 From: SciML Bot Date: Thu, 31 Jul 2025 16:41:54 -0400 Subject: [PATCH] Apply JuliaFormatter to fix code formatting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Applied JuliaFormatter with SciML style guide - Formatted 4 files 🤖 Generated by OrgMaintenanceScripts.jl --- README.md | 8 +------- docs/src/index.md | 7 +------ src/RuntimeGeneratedFunctions.jl | 18 +++++++++++------- test/runtests.jl | 8 +++++--- 4 files changed, 18 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 2a5b1c2..4ca3f99 100644 --- a/README.md +++ b/README.md @@ -117,15 +117,9 @@ From a constructed RuntimeGeneratedFunction, you can retrieve the expressions us `RuntimeGeneratedFunctions.get_expression` command. For example: ```julia +julia> RuntimeGeneratedFunctions.get_expression(rgf) ex = :((x) -> x^2) rgf = @RuntimeGeneratedFunction(ex) -julia> RuntimeGeneratedFunctions.get_expression(rgf) -#= -quote - #= c:\Users\accou\OneDrive\Computer\Desktop\test.jl:39 =# - x ^ 2 -end -=# ``` This can be used to get the expression even if `drop_expr` has been performed. diff --git a/docs/src/index.md b/docs/src/index.md index 42af531..eae610c 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -108,13 +108,9 @@ From a constructed RuntimeGeneratedFunction, you can retrieve the expressions us `RuntimeGeneratedFunctions.get_expression` command. For example: ```julia +julia> RuntimeGeneratedFunctions.get_expression(rgf) ex = :((x) -> x^2) rgf = @RuntimeGeneratedFunction(ex) -julia> RuntimeGeneratedFunctions.get_expression(rgf) -:((x,)->begin - #= REPL[14]:1 =# - x ^ 2 - end) ``` This can be used to get the expression even if `drop_expr` has been performed. @@ -198,7 +194,6 @@ julia> RuntimeGeneratedFunctions.get_expression(prob.f.f.f_oop) end) ``` - ## Reproducibility ```@raw html diff --git a/src/RuntimeGeneratedFunctions.jl b/src/RuntimeGeneratedFunctions.jl index d8c847c..379b6e7 100644 --- a/src/RuntimeGeneratedFunctions.jl +++ b/src/RuntimeGeneratedFunctions.jl @@ -48,7 +48,9 @@ end ``` """ -"$_rgf_docs" +""" +$_rgf_docs +""" struct RuntimeGeneratedFunction{argnames, cache_tag, context_tag, id, B} <: Function body::B function RuntimeGeneratedFunction(cache_tag, context_tag, ex; opaque_closures = true) @@ -117,7 +119,9 @@ function RuntimeGeneratedFunction(cache_module::Module, context_module::Module, opaque_closures = opaque_closures) end -"$_rgf_docs" +""" +$_rgf_docs +""" macro RuntimeGeneratedFunction(code) quote RuntimeGeneratedFunction(@__MODULE__, @__MODULE__, $(esc(code))) @@ -332,11 +336,11 @@ end function get_expression(rgf::RuntimeGeneratedFunction{argnames, cache_tag, context_tag, id, B}) where { - argnames, - cache_tag, - context_tag, - id, - B + argnames, + cache_tag, + context_tag, + id, + B } func_expr = Expr(:->, Expr(:tuple, argnames...), _lookup_body(cache_tag, id)) end diff --git a/test/runtests.jl b/test/runtests.jl index 3db5a76..833b36b 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -102,7 +102,8 @@ GC.gc() @test f_gc(1, -1) == 100001 # Test that drop_expr works -f_drop1, f_drop2 = let +f_drop1, +f_drop2 = let ex = Base.remove_linenums!(:(x -> x - 1)) # Construct two identical RGFs here to test the cache deduplication code (drop_expr(@RuntimeGeneratedFunction(ex)), @@ -119,8 +120,9 @@ for k in 1:4 t = Threads.@spawn begin r = Bool[] for i in 1:100 - f = @RuntimeGeneratedFunction(Base.remove_linenums!(:((x, y) -> x + y + - $i * $k))) + f = @RuntimeGeneratedFunction(Base.remove_linenums!(:(( + x, y) -> x + y + + $i * $k))) x = 1 y = 2 push!(r, f(x, y) == x + y + i * k)