Skip to content
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
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "BackendSelection"
uuid = "680c2d7c-f67a-4cc9-ae9c-da132b1447a5"
version = "0.1.9"
version = "0.1.10"
authors = ["ITensor developers <support@itensor.org> and contributors"]

[compat]
Expand Down
4 changes: 2 additions & 2 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ makedocs(;
format = Documenter.HTML(;
canonical = "https://itensor.github.io/BackendSelection.jl",
edit_link = "main",
assets = ["assets/favicon.ico", "assets/extras.css"],
assets = ["assets/favicon.ico", "assets/extras.css"]
),
pages = ["Home" => "index.md", "Reference" => "reference.md"],
pages = ["Home" => "index.md", "Reference" => "reference.md"]
)

deploydocs(;
Expand Down
4 changes: 2 additions & 2 deletions docs/make_index.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Literate: Literate
using BackendSelection: BackendSelection
using Literate: Literate

function ccq_logo(content)
include_ccq_logo = """
Expand All @@ -17,5 +17,5 @@ Literate.markdown(
joinpath(pkgdir(BackendSelection), "docs", "src");
flavor = Literate.DocumenterFlavor(),
name = "index",
postprocess = ccq_logo,
postprocess = ccq_logo
)
4 changes: 2 additions & 2 deletions docs/make_readme.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Literate: Literate
using BackendSelection: BackendSelection
using Literate: Literate

function ccq_logo(content)
include_ccq_logo = """
Expand All @@ -17,5 +17,5 @@ Literate.markdown(
joinpath(pkgdir(BackendSelection));
flavor = Literate.CommonMarkFlavor(),
name = "README",
postprocess = ccq_logo,
postprocess = ccq_logo
)
10 changes: 7 additions & 3 deletions src/backend_types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ function generate_backend_type_expr(type::Symbol)
kwargs::Kwargs
end

$type{Back}(kwargs::NamedTuple) where {Back} = $type{Back, typeof(kwargs)}(kwargs)
function $type{Back}(kwargs::NamedTuple) where {Back}
return $type{Back, typeof(kwargs)}(kwargs)
end
$type{Back}(; kwargs...) where {Back} = $type{Back}(NamedTuple(kwargs))
$type(s; kwargs...) = $type{Symbol(s)}(NamedTuple(kwargs))

Expand All @@ -40,13 +42,15 @@ function generate_backend_type_expr(type::Symbol)

function Base.show(io::IO, backend::$type)
return print(
io, "$($type) type ", backend_string(backend), ", ", parameters(backend)
io, "$($type) type ", backend_string(backend), ", ", parameters(
backend
)
)
end
function Base.print(io::IO, backend::$type)
return print(io, backend_string(backend), ", ", parameters(backend))
end
end,
end
)
end

Expand Down
15 changes: 10 additions & 5 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,19 @@ const GROUP = uppercase(
get(ENV, "GROUP", "ALL")
else
only(match(pat, ARGS[arg_id]).captures)
end,
end
)

"match files of the form `test_*.jl`, but exclude `*setup*.jl`"
"""
match files of the form `test_*.jl`, but exclude `*setup*.jl`
"""
function istestfile(fn)
return endswith(fn, ".jl") && startswith(basename(fn), "test_") && !contains(fn, "setup")
return endswith(fn, ".jl") && startswith(basename(fn), "test_") &&
!contains(fn, "setup")
end
"match files of the form `*.jl`, but exclude `*_notest.jl` and `*setup*.jl`"
"""
match files of the form `*.jl`, but exclude `*_notest.jl` and `*setup*.jl`
"""
function isexamplefile(fn)
return endswith(fn, ".jl") && !endswith(fn, "_notest.jl") && !contains(fn, "setup")
end
Expand Down Expand Up @@ -57,7 +62,7 @@ end
:macrocall,
GlobalRef(Suppressor, Symbol("@suppress")),
LineNumberNode(@__LINE__, @__FILE__),
:(include($filename)),
:(include($filename))
)
)
end
Expand Down
2 changes: 1 addition & 1 deletion test/test_aqua.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using BackendSelection: BackendSelection
using Aqua: Aqua
using BackendSelection: BackendSelection
using Test: @testset

@testset "Code quality (Aqua.jl)" begin
Expand Down
6 changes: 4 additions & 2 deletions test/test_basics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ using TestExtras: @constinferred
end
end
# Macro syntax.
@test @constinferred(Algorithm"backend"(; x = 2, y = 3)) === Algorithm("backend"; x = 2, y = 3)
@test @constinferred(Backend"backend"(; x = 2, y = 3)) === Backend("backend"; x = 2, y = 3)
@test @constinferred(Algorithm"backend"(; x = 2, y = 3)) ===
Algorithm("backend"; x = 2, y = 3)
@test @constinferred(Backend"backend"(; x = 2, y = 3)) ===
Backend("backend"; x = 2, y = 3)
@test isnothing(show(Algorithm("")))
end
Loading