Skip to content

Commit

Permalink
Merge pull request #585 from epatters/julia-v1.7
Browse files Browse the repository at this point in the history
Support for Julia v1.7
  • Loading branch information
epatters authored Dec 3, 2021
2 parents 255addd + a769e29 commit 36b2b5e
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
- name: Set up Julia
uses: julia-actions/setup-julia@latest
with:
version: 1.6
version: 1.7
- name: Install dependencies
run: julia -e 'using Pkg; pkg"add PkgBenchmark [email protected]"'
- name: Run benchmarks
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@latest
with:
version: '1.6'
version: '1.7'
- name: "Install system dependencies"
run: |
sudo apt-get update
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
- name: "Set up Julia"
uses: julia-actions/setup-julia@latest
with:
version: '1.6'
version: '1.7'
- name: "Install system dependencies"
run: |
sudo apt-get update
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/downstream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
strategy:
fail-fast: false
matrix:
julia-version: ['1.6']
julia-version: ['1.7']
os: [ubuntu-latest]
package:
- {user: AlgebraicJulia, repo: AlgebraicDynamics.jl}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/experiments.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: "Set up Julia"
uses: julia-actions/setup-julia@latest
with:
version: '1.6'
version: '1.7'
# XXX: Cannot change working directory for "uses" steps.
#- name: "Run tests"
# uses: julia-actions/julia-runtest@master
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
strategy:
fail-fast: false
matrix:
julia_version: ['1.6']
julia_version: ['1.6', '1.7']
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v2
Expand Down
6 changes: 4 additions & 2 deletions src/categorical_algebra/CatElements.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module CatElements
export ThElements, AbstractElements, Elements, elements

using DataStructures: OrderedDict

using ..CSets, ..FinSets
using ...Present, ...Theories
using ...Theories: Category, ob, hom, dom_nums, codom_nums
Expand Down Expand Up @@ -59,7 +61,7 @@ will be mapped to `src_E_1, tgt_E_1`.
"""
function presentation(X::AbstractElements)
P = Presentation(FreeSchema)
obs = Dict{Tuple{Symbol, Int}, Any}()
obs = OrderedDict{Tuple{Symbol, Int}, Any}()
for a in 1:nparts(X, :Ob)
class = X[a, :nameo]
for (i,j) in enumerate(incident(X, a, :πₑ))
Expand All @@ -68,7 +70,7 @@ function presentation(X::AbstractElements)
end
end
add_generators!(P, values(obs))
homs = Dict{Tuple{Symbol, Int}, Any}()
homs = OrderedDict{Tuple{Symbol, Int}, Any}()
for f in 1:nparts(X, :Hom)
class = X[f, :nameh]
for (i,j) in enumerate(incident(X, f, :πₐ))
Expand Down
9 changes: 6 additions & 3 deletions src/wiring_diagrams/Algebras.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ box/junction attributes. The default attributes are those compatible with the
function oapply(composite::UndirectedWiringDiagram, hom_map::AbstractDict,
ob_map::Union{AbstractDict,Nothing}=nothing;
hom_attr::Symbol=:name, ob_attr::Symbol=:variable)
homs = [ hom_map[name] for name in subpart(composite, hom_attr) ]
# XXX: Julia should be inferring these vector eltypes but isn't on v1.7.
homs = valtype(hom_map)[ hom_map[name] for name in composite[hom_attr] ]
obs = isnothing(ob_map) ? nothing :
[ ob_map[name] for name in subpart(composite, ob_attr) ]
valtype(ob_map)[ ob_map[name] for name in composite[ob_attr] ]
oapply(composite, homs, obs)
end

Expand Down Expand Up @@ -99,7 +100,9 @@ function oapply(composite::UndirectedWiringDiagram,
end
end
end
diagram[:ob₁] = map(L, junction_feet)
for (j, foot) in enumerate(junction_feet)
diagram[j, :ob₁] = L(foot)
end

# Find, or if necessary create, an outgoing edge for each junction. The
# existence of such edges is an assumption for colimits of bipartite diagrams.
Expand Down
5 changes: 3 additions & 2 deletions test/categorical_algebra/CatElements.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ b = @acset Graph begin
end

ThBPG, obmap, hommap = CatElements.presentation(elements(b))
@test Symbol.(generators(ThBPG)) == [:E_1, :V_1, :V_2, :tgt_E_1, :src_E_1]
@test Symbol.(generators(ThBPG)) == [:V_1, :V_2, :E_1, :src_E_1, :tgt_E_1]


p₀ = @acset Graph begin
Expand All @@ -43,7 +43,8 @@ p₀ = @acset Graph begin
end

ThPetri, obmap, hommap = CatElements.presentation(elements(p₀))
@test Symbol.(generators(ThPetri)) == [:E_1, :E_2, :V_1, :V_2, :src_E_2, :tgt_E_1, :tgt_E_2, :src_E_1]
@test Symbol.(generators(ThPetri)) ==
[:V_1, :V_2, :E_1, :E_2, :src_E_1, :src_E_2, :tgt_E_1, :tgt_E_2]

@acset_type Petri(ThPetri)

Expand Down

0 comments on commit 36b2b5e

Please sign in to comment.