-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add serialization upgrade script for type renaming
- Loading branch information
1 parent
2505874
commit aff0a35
Showing
4 changed files
with
65 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
################################################################################ | ||
# Upgrade Summary | ||
# This upgrade currentlz only adapts to type renamings. | ||
|
||
push!(upgrade_scripts_set, UpgradeScript( | ||
v"0.15.0", | ||
function upgrade_0_15_0(s::UpgradeState, dict::Dict) | ||
|
||
upgraded_dict = dict | ||
|
||
renamings = Dict{String,String}([ | ||
("FlintPadicField", "PadicField"), | ||
("padic", "PadicFieldElem"), | ||
("arb", "ArbFieldElem"), | ||
("acb", "AcbFieldElem"), | ||
("AnticNumberField", "AbsSimpleNumField"), | ||
("nf_elem", "AbsSimpleNumFieldElem"), | ||
("NfAbsNS", "AbsNonSimpleNumField"), | ||
("NfAbsNSElem", "AbsNonSimpleNumFieldElem"), | ||
("Hecke.NfRel", "Hecke.RelSimpleNumField"), | ||
("Hecke.NfRelElem", "Hecke.RelSimpleNumFieldElem"), | ||
("Hecke.NfRelNS", "Hecke.RelNonSimpleNumField"), | ||
("Hecke.NfRelNSElem", "Hecke.RelNonSimpleNumFieldElem"), | ||
("Hecke.NumFieldEmbNfAbs", "Hecke.AbsSimpleNumFieldEmbedding"), | ||
("Hecke.NumFieldEmbNfAbsNS", "Hecke.AbsNonSimpleNumFieldEmbedding"), | ||
("Hecke.NumFieldEmbNfRel", "Hecke.RelSimpleNumFieldEmbedding"), | ||
("Hecke.NumFieldEmbNfNS", "Hecke.RelNonSimpleNumFieldEmbedding"), | ||
("GrpAbFinGen", "FinGenAbGroup"), | ||
("GrpAbFinGenElem", "FinGenAbGroupElem"), | ||
("Hecke.EmbeddedField", "EmbeddedNumField"), | ||
("EmbeddedElem", "EmbeddedNumFieldElem"), | ||
]) | ||
|
||
if haskey(dict, :_type) && dict[:_type] isa String && haskey(renamings, dict[:_type]) | ||
upgraded_dict[:_type] = renamings[dict[:_type]] | ||
end | ||
if haskey(dict, :_type) && | ||
dict[:_type] isa Dict && | ||
haskey(dict[:_type], :name) && | ||
dict[:_type][:name] isa String && | ||
haskey(renamings, dict[:_type][:name]) | ||
upgraded_dict[:_type][:name] = renamings[dict[:_type][:name]] | ||
end | ||
|
||
# handle data upgrade (recurse on sub tree) | ||
if haskey(dict, :data) && dict[:data] isa Dict | ||
upgraded_dict[:data] = upgrade_0_15_0(s, dict[:data]) | ||
end | ||
|
||
if haskey(dict, :_refs) | ||
upgraded_refs = Dict() | ||
for (k, v) in dict[:_refs] | ||
upgraded_refs[k] = upgrade_0_15_0(s, v) | ||
end | ||
upgraded_dict[:_refs] = upgraded_refs | ||
end | ||
|
||
return upgraded_dict | ||
end | ||
)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters