1
0
mirror of https://github.com/kalmarek/SmallHyperbolic synced 2024-11-23 23:40:28 +01:00

fix paths in create_json scripts

This commit is contained in:
Marek Kaluba 2022-02-12 15:29:18 +01:00
parent 8555393004
commit 080032356b
No known key found for this signature in database
GPG Key ID: 8BF1A3855328FC15
2 changed files with 15 additions and 12 deletions

View File

@ -6,19 +6,22 @@ using JSON
include(joinpath(@__DIR__, "parse_presentations.jl")) include(joinpath(@__DIR__, "parse_presentations.jl"))
include(joinpath(@__DIR__, "smallhyperbolicgrp.jl")) include(joinpath(@__DIR__, "smallhyperbolicgrp.jl"))
all_grps_presentations = const DATA_DIR = joinpath(@__DIR__, "..", "..", "data")
let tables = [
joinpath(@__DIR__, f) for f in readdir(@__DIR__) if function _files_with_extension(dir::AbstractString, ext::AbstractString)
isfile(joinpath(@__DIR__, f)) && endswith(f, ".txt") return [
joinpath(dir, f) for f in readdir(dir) if
isfile(joinpath(dir, f)) && endswith(f, '.'*ext)
] ]
end
all_grps_presentations =
let tables = _files_with_extension(DATA_DIR, "txt")
mapreduce(parse_grouppresentations_abstract, union, tables) |> Dict mapreduce(parse_grouppresentations_abstract, union, tables) |> Dict
end end
tr_grps = grps =
let csvs = [ let csvs = _files_with_extension(DATA_DIR, "csv")
joinpath(@__DIR__, f) for f in readdir(@__DIR__) if
isfile(joinpath(@__DIR__, f)) && endswith(f, ".csv")
]
trGrps = mapreduce(union, csvs) do file trGrps = mapreduce(union, csvs) do file
m = match(r".*_(\d)_(\d)_(\d).csv", basename(file)) m = match(r".*_(\d)_(\d)_(\d).csv", basename(file))
@ -37,9 +40,9 @@ tr_grps =
end end
end end
open(joinpath(@__DIR__, "triangle_groups.json"), "w") do io open(joinpath(DATA_DIR, "triangle_groups.json"), "w") do io
f(args...) = show_json(args...; indent = 4) f(args...) = show_json(args...; indent = 4)
s = sprint(f, TriangleGrpSerialization(), tr_grps) s = sprint(f, TriangleGrpSerialization(), grps)
# JSON.print(io, , 4) # JSON.print(io, , 4)
print(io, s) print(io, s)
end end

View File

@ -1,4 +1,4 @@
include("../src/groupparse.jl") include(joinpath(@__DIR__, "..", "..", "src", "groupparse.jl"))
function parse_grouppresentations_abstract(filename::AbstractString) function parse_grouppresentations_abstract(filename::AbstractString)
lines = strip.(readlines(filename)) lines = strip.(readlines(filename))