-
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
9302a8e
commit a103b6c
Showing
4 changed files
with
71 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,66 @@ | ||
################################################################################ | ||
# 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"), | ||
]) | ||
|
||
function upgrade_type(d::String) | ||
return get(renamings, d, d) | ||
end | ||
function upgrade_type(d::Dict) | ||
upg_d = d | ||
upg_d[:name] = get(renamings, d[:name], d[:name]) | ||
if d[:params] isa Dict && haskey(d[:params], :_type) | ||
upg_d[:params][:_type] = upgrade_type(d[:params][:_type]) | ||
elseif d[:params] isa Vector | ||
upg_d[:params] = [upgrade_type(v) for v in d[:params]] | ||
end | ||
return upg_d | ||
end | ||
|
||
if haskey(dict, :_type) | ||
upgraded_dict[:_type] = upgrade_type(dict[:_type]) | ||
end | ||
|
||
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