diff --git a/Manifest.toml b/Manifest.toml index 0dcfcda..4c436fa 100644 --- a/Manifest.toml +++ b/Manifest.toml @@ -2,7 +2,7 @@ julia_version = "1.11.3" manifest_format = "2.0" -project_hash = "bbb0e5646f1748a2c6f584642f98e12c63222479" +project_hash = "a4cffd073821587487c7160a212a3760a9a98435" [[deps.ASL_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] @@ -30,6 +30,11 @@ version = "1.5.0" ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" +[[deps.AbstractTrees]] +git-tree-sha1 = "2d9c9a55f9c93e8887ad391fbae72f8ef55e1177" +uuid = "1520ce14-60c1-5f80-bbc7-55ef81b5835c" +version = "0.4.5" + [[deps.AlgebraicSolving]] deps = ["LinearAlgebra", "Logging", "Markdown", "Nemo", "Printf", "Random", "StaticArrays", "Test", "msolve_jll"] git-tree-sha1 = "406b5001ff9b0d62440d52b145b303e269e755a6" @@ -71,11 +76,28 @@ git-tree-sha1 = "7fea8f658689fa5062b23f4400eda888b7ae2aaa" uuid = "f01c122e-0ea1-4f85-ad8f-907073ad7a9f" version = "0.1.3" +[[deps.BitFlags]] +git-tree-sha1 = "0691e34b3bb8be9307330f88d1a3c3f25466c24d" +uuid = "d1d4a3ce-64b1-5f1a-9ba4-7e7e69966f35" +version = "0.1.9" + [[deps.Bzip2_jll]] -deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] -git-tree-sha1 = "8873e196c2eb87962a2048b3b8e08946535864a1" +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "1b96ea4a01afe0ea4090c5c8039690672dd13f2e" uuid = "6e34b625-4abd-537c-b88f-471c36dfa7a0" -version = "1.0.8+4" +version = "1.0.9+0" + +[[deps.Cascadia]] +deps = ["AbstractTrees", "Gumbo"] +git-tree-sha1 = "c0769cbd930aea932c0912c4d2749c619a263fc1" +uuid = "54eefc05-d75b-58de-a785-1a3403f0919f" +version = "1.0.2" + +[[deps.CodecZlib]] +deps = ["TranscodingStreams", "Zlib_jll"] +git-tree-sha1 = "545a177179195e442472a1c4dc86982aa7a1bef0" +uuid = "944b1d66-785c-5afd-91f1-9de20f533193" +version = "0.7.7" [[deps.Combinatorics]] git-tree-sha1 = "08c8b6831dc00bfea825826be0bc8336fc369860" @@ -97,6 +119,12 @@ deps = ["Artifacts", "Libdl"] uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae" version = "1.1.1+0" +[[deps.ConcurrentUtilities]] +deps = ["Serialization", "Sockets"] +git-tree-sha1 = "d9d26935a0bcffc87d2613ce14c527c99fc543fd" +uuid = "f0e56b4a-5159-44fe-b623-3e5288b988bb" +version = "2.5.0" + [[deps.CxxWrap]] deps = ["Libdl", "MacroTools", "libcxxwrap_julia_jll"] git-tree-sha1 = "9208ab6d13777dace5981b451171891faf59e6a2" @@ -121,9 +149,9 @@ version = "1.11.0" [[deps.DecFP]] deps = ["DecFP_jll", "Printf", "Random", "SpecialFunctions"] -git-tree-sha1 = "4a10cec664e26d9d63597daf9e62147e79d636e3" +git-tree-sha1 = "88e521a871a1b11488a1f48b8c085b4be8f71be5" uuid = "55939f99-70c6-5e9b-8bb0-5071ed7d61fd" -version = "1.3.2" +version = "1.4.1" [[deps.DecFP_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] @@ -163,11 +191,17 @@ deps = ["ArgTools", "FileWatching", "LibCURL", "NetworkOptions"] uuid = "f43a241f-c20a-4ad4-852c-f6b1247861c6" version = "1.6.0" +[[deps.ExceptionUnwrapping]] +deps = ["Test"] +git-tree-sha1 = "d36f682e590a83d63d1c7dbd287573764682d12a" +uuid = "460bff9d-24e4-43bc-9d9f-a8973cb893f4" +version = "0.1.11" + [[deps.FFTW]] deps = ["AbstractFFTs", "FFTW_jll", "LinearAlgebra", "MKL_jll", "Preferences", "Reexport"] -git-tree-sha1 = "4820348781ae578893311153d69049a93d05f39d" +git-tree-sha1 = "7de7c78d681078f027389e067864a8d53bd7c3c9" uuid = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341" -version = "1.8.0" +version = "1.8.1" [[deps.FFTW_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] @@ -238,6 +272,24 @@ git-tree-sha1 = "1dc470db8b1131cfc7fb4c115de89fe391b9e780" uuid = "86223c79-3864-5bf0-83f7-82e725a168b6" version = "1.12.0" +[[deps.Gumbo]] +deps = ["AbstractTrees", "Gumbo_jll", "Libdl"] +git-tree-sha1 = "eab9e02310eb2c3e618343c859a12b51e7577f5e" +uuid = "708ec375-b3d6-5a57-a7ce-8257bf98657a" +version = "0.8.3" + +[[deps.Gumbo_jll]] +deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] +git-tree-sha1 = "29070dee9df18d9565276d68a596854b1764aa38" +uuid = "528830af-5a63-567c-a44a-034ed33b8444" +version = "0.10.2+0" + +[[deps.HTTP]] +deps = ["Base64", "CodecZlib", "ConcurrentUtilities", "Dates", "ExceptionUnwrapping", "Logging", "LoggingExtras", "MbedTLS", "NetworkOptions", "OpenSSL", "PrecompileTools", "Random", "SimpleBufferStream", "Sockets", "URIs", "UUIDs"] +git-tree-sha1 = "c67b33b085f6e2faf8bf79a61962e7339a81129c" +uuid = "cd3eb016-35fb-5094-929b-558a96fad6f3" +version = "1.10.15" + [[deps.Hecke]] deps = ["AbstractAlgebra", "Dates", "Distributed", "InteractiveUtils", "LazyArtifacts", "Libdl", "LinearAlgebra", "Markdown", "Nemo", "Pkg", "Printf", "Random", "RandomExtensions", "Serialization", "SparseArrays"] git-tree-sha1 = "ee9546ec43de9fa083094a40c999927b9c005b29" @@ -257,9 +309,9 @@ version = "2.11.2+3" [[deps.HypergeometricFunctions]] deps = ["LinearAlgebra", "OpenLibm_jll", "SpecialFunctions"] -git-tree-sha1 = "b1c2585431c382e3fe5805874bda6aea90a95de9" +git-tree-sha1 = "2bd56245074fab4015b9174f24ceba8293209053" uuid = "34004b35-14d8-5ef3-9330-4cdb6864b03a" -version = "0.3.25" +version = "0.3.27" [[deps.Inflate]] git-tree-sha1 = "d1b1b796e47d94588b3757fe84fbf65a5ec4a80d" @@ -268,9 +320,9 @@ version = "0.1.5" [[deps.IntelOpenMP_jll]] deps = ["Artifacts", "JLLWrappers", "LazyArtifacts", "Libdl"] -git-tree-sha1 = "10bd689145d2c3b2a9844005d01087cc1194e79e" +git-tree-sha1 = "0f14a5456bdc6b9731a5682f439a672750a09e48" uuid = "1d5cc7b8-4909-519e-a0f8-d0f5ad9712d0" -version = "2024.2.1+0" +version = "2025.0.4+0" [[deps.InteractiveUtils]] deps = ["Markdown"] @@ -284,9 +336,9 @@ uuid = "9cc047cb-c261-5740-88fc-0cf96f7bdcc7" version = "300.1400.1700+0" [[deps.IrrationalConstants]] -git-tree-sha1 = "630b497eafcc20001bba38a4651b327dcfc491d2" +git-tree-sha1 = "e2222959fbc6c19554dc15174c81bf7bf3aa691c" uuid = "92d709cd-6900-40b7-9082-c6be49f344b6" -version = "0.2.2" +version = "0.2.4" [[deps.JLLWrappers]] deps = ["Artifacts", "Preferences"] @@ -318,12 +370,6 @@ git-tree-sha1 = "78211fb6cbc872f77cad3fc0b6cf647d923f4929" uuid = "1d63c593-3942-5779-bab2-d838dc0a180e" version = "18.1.7+0" -[[deps.LZO_jll]] -deps = ["Artifacts", "JLLWrappers", "Libdl"] -git-tree-sha1 = "1c602b1127f4751facb671441ca72715cc95938a" -uuid = "dd4b983a-f0e5-5f8d-a1b7-129d4a5fb1ac" -version = "2.10.3+0" - [[deps.LazyArtifacts]] deps = ["Artifacts", "Pkg"] uuid = "4af54fe1-eca0-43a8-85a7-787d91b784e3" @@ -383,11 +429,11 @@ version = "0.3.29" uuid = "56ddb016-857b-54e1-b83d-db4d58db5568" version = "1.11.0" -[[deps.Lz4_jll]] -deps = ["Artifacts", "JLLWrappers", "Libdl"] -git-tree-sha1 = "191686b1ac1ea9c89fc52e996ad15d1d241d1e33" -uuid = "5ced341a-0733-55b8-9ab6-a4889d929147" -version = "1.10.1+0" +[[deps.LoggingExtras]] +deps = ["Dates", "Logging"] +git-tree-sha1 = "f02b56007b064fbfddb4c9cd60161b6dd0f40df3" +uuid = "e6f89c97-d47a-5376-807f-9c37f3926c36" +version = "1.1.0" [[deps.METIS_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl"] @@ -397,9 +443,9 @@ version = "5.1.3+0" [[deps.MKL_jll]] deps = ["Artifacts", "IntelOpenMP_jll", "JLLWrappers", "LazyArtifacts", "Libdl", "oneTBB_jll"] -git-tree-sha1 = "f046ccd0c6db2832a9f639e2c669c6fe867e5f4f" +git-tree-sha1 = "5de60bc6cb3899cd318d80d627560fae2e2d99ae" uuid = "856f044c-d86e-5d09-b602-aeab76dc8ba7" -version = "2024.2.0+0" +version = "2025.0.1+1" [[deps.MPFR_jll]] deps = ["Artifacts", "GMP_jll", "Libdl"] @@ -422,6 +468,12 @@ deps = ["Base64"] uuid = "d6f4376e-aef5-505a-96c1-9c027394607a" version = "1.11.0" +[[deps.MbedTLS]] +deps = ["Dates", "MbedTLS_jll", "MozillaCACerts_jll", "NetworkOptions", "Random", "Sockets"] +git-tree-sha1 = "c067a280ddc25f196b5e7df3877c6b226d390aaf" +uuid = "739be429-bea8-5141-9913-cc70e7f3736d" +version = "1.1.9" + [[deps.MbedTLS_jll]] deps = ["Artifacts", "Libdl"] uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1" @@ -455,9 +507,9 @@ version = "2023.12.12" [[deps.Ncurses_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl"] -git-tree-sha1 = "3690e6c58c16ba676bcc9b5654762fe8a05db1c7" +git-tree-sha1 = "b5e7e7ad16adfe5f68530f9f641955b5b0f12bbb" uuid = "68e3532b-a499-55ff-9963-d1c0c0748b3a" -version = "6.5.0+1" +version = "6.5.1+0" [[deps.Nemo]] deps = ["AbstractAlgebra", "FLINT_jll", "Libdl", "LinearAlgebra", "Pkg", "Random", "RandomExtensions", "SHA"] @@ -491,11 +543,17 @@ deps = ["Artifacts", "Libdl"] uuid = "05823500-19ac-5b8b-9628-191a04bc5112" version = "0.8.1+2" +[[deps.OpenSSL]] +deps = ["BitFlags", "Dates", "MozillaCACerts_jll", "OpenSSL_jll", "Sockets"] +git-tree-sha1 = "38cb508d080d21dc1128f7fb04f20387ed4c0af4" +uuid = "4d8831e6-92b7-49fb-bdf8-b643e874388c" +version = "1.4.3" + [[deps.OpenSSL_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl"] -git-tree-sha1 = "7493f61f55a6cce7325f197443aa80d32554ba10" +git-tree-sha1 = "a9697f1d06cc3eb3fb3ad49cc67f2cfabaac31ea" uuid = "458c3c95-2e84-50aa-8efc-19380b2a3a95" -version = "3.0.15+3" +version = "3.0.16+0" [[deps.OpenSpecFun_jll]] deps = ["Artifacts", "CompilerSupportLibraries_jll", "JLLWrappers", "Libdl"] @@ -504,9 +562,9 @@ uuid = "efe28fd5-8261-553b-a9e1-b2916fc3738e" version = "0.5.6+0" [[deps.OrderedCollections]] -git-tree-sha1 = "12f1439c4f986bb868acda6ea33ebc78e19b95ad" +git-tree-sha1 = "cc4054e898b852042d7b503313f7ad03de99c3dd" uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d" -version = "1.7.0" +version = "1.8.0" [[deps.Oscar]] deps = ["AbstractAlgebra", "AlgebraicSolving", "Distributed", "GAP", "Hecke", "JSON", "JSON3", "LazyArtifacts", "Markdown", "Nemo", "Pkg", "Polymake", "Random", "RandomExtensions", "Serialization", "Singular", "TOPCOM_jll", "UUIDs", "cohomCalg_jll"] @@ -555,9 +613,9 @@ weakdeps = ["REPL"] [[deps.Polymake]] deps = ["AbstractAlgebra", "BinaryWrappers", "CxxWrap", "Downloads", "JSON", "Libdl", "Mongoc", "NetworkOptions", "Ninja_jll", "Perl_jll", "Pidfile", "Pkg", "REPL", "Scratch", "SparseArrays", "TOPCOM_jll", "lib4ti2_jll", "libpolymake_julia_jll", "polymake_jll", "polymake_oscarnumber_jll"] -git-tree-sha1 = "0a606d37843442f11b972046610eb94216b6089c" +git-tree-sha1 = "5addbf9d589c4d052ec0aef4bd5cc7e886d12c00" uuid = "d720cf60-89b5-51f5-aff5-213f193123e7" -version = "0.11.24" +version = "0.11.25" [[deps.PrecompileTools]] deps = ["Preferences"] @@ -589,9 +647,9 @@ version = "1.3.0" [[deps.QuadGK]] deps = ["DataStructures", "LinearAlgebra"] -git-tree-sha1 = "cda3b045cf9ef07a08ad46731f5a3165e56cf3da" +git-tree-sha1 = "9da16da70037ba9d701192e27befedefb91ec284" uuid = "1fd47b50-473d-5c70-9696-f719f8f3bcdc" -version = "2.11.1" +version = "2.11.2" [deps.QuadGK.extensions] QuadGKEnzymeExt = "Enzyme" @@ -669,6 +727,11 @@ deps = ["Distributed", "Mmap", "Random", "Serialization"] uuid = "1a1011a3-84de-559e-8e89-a11a2f7dc383" version = "1.11.0" +[[deps.SimpleBufferStream]] +git-tree-sha1 = "f305871d2f381d21527c770d4788c06c097c9bc1" +uuid = "777ac1f9-54b0-4bf8-805c-2214025038e7" +version = "1.2.0" + [[deps.SimpleTraits]] deps = ["InteractiveUtils", "MacroTools"] git-tree-sha1 = "5d7e3f4e11935503d3ecaf7186eac40602e7d231" @@ -716,9 +779,9 @@ version = "2.5.0" [[deps.StaticArrays]] deps = ["LinearAlgebra", "PrecompileTools", "Random", "StaticArraysCore"] -git-tree-sha1 = "47091a0340a675c738b1304b58161f3b0839d454" +git-tree-sha1 = "e3be13f448a43610f978d29b7adf78c76022467a" uuid = "90137ffa-7385-5640-81b9-e52037218182" -version = "1.9.10" +version = "1.9.12" [deps.StaticArrays.extensions] StaticArraysChainRulesCoreExt = "ChainRulesCore" @@ -811,15 +874,25 @@ version = "1.11.0" [[deps.TestItemRunner]] deps = ["Pkg", "TOML", "Test", "TestItems", "UUIDs"] -git-tree-sha1 = "29647c5398be04a1d697265ba385bdf3f623c993" +git-tree-sha1 = "068c8f3e8d2f3b5948a85f11412f047cbab4e6c0" uuid = "f8b46487-2199-4994-9208-9a1283c18c0a" -version = "1.0.5" +version = "1.1.0" [[deps.TestItems]] git-tree-sha1 = "42fd9023fef18b9b78c8343a4e2f3813ffbcefcb" uuid = "1c621080-faea-4a02-84b6-bbd5e436b8fe" version = "1.0.0" +[[deps.TranscodingStreams]] +git-tree-sha1 = "0c45878dcfdcfa8480052b6ab162cdd138781742" +uuid = "3bb67fe8-82b1-5028-8e26-92a6c54297fa" +version = "0.11.3" + +[[deps.URIs]] +git-tree-sha1 = "67db6cc7b3821e19ebe75791a9dd19c9b1188f2b" +uuid = "5c2747f8-b7ea-4ff2-ba2e-563bfd36b1d4" +version = "1.5.1" + [[deps.UUIDs]] deps = ["Random", "SHA"] uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" @@ -877,15 +950,15 @@ version = "5.11.0+0" [[deps.libcxxwrap_julia_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl"] -git-tree-sha1 = "b386562c39065094e2d1e1939ea289dbd448fe3e" +git-tree-sha1 = "70091a11c756455c15bc6380ea000c16f38f2d3e" uuid = "3eaa8342-bff7-56a5-9981-c04077f7cee7" -version = "0.13.3+0" +version = "0.13.4+0" [[deps.libpolymake_julia_jll]] deps = ["Artifacts", "CompilerSupportLibraries_jll", "FLINT_jll", "JLLWrappers", "Libdl", "TOPCOM_jll", "lib4ti2_jll", "libcxxwrap_julia_jll", "polymake_jll"] -git-tree-sha1 = "4885c6d17996ea3fa5492cfe8c68f0f52be82820" +git-tree-sha1 = "d05957bb0eacb2747e6d042d56034b005c220561" uuid = "4d8266f6-2b3b-57e3-ad7a-d431eaaac945" -version = "0.13.0+0" +version = "0.13.1+0" [[deps.libsingular_julia_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl", "Singular_jll", "libcxxwrap_julia_jll"] @@ -941,12 +1014,12 @@ version = "400.1300.2+0" [[deps.polymake_oscarnumber_jll]] deps = ["Artifacts", "CompilerSupportLibraries_jll", "JLLWrappers", "LLVMOpenMP_jll", "Libdl", "libcxxwrap_julia_jll", "libpolymake_julia_jll", "polymake_jll"] -git-tree-sha1 = "0f1f590da4a2323defeecbf50a1d21448e7108fc" +git-tree-sha1 = "14b654205ab1599612521c587f5b11c662ba0ed1" uuid = "10f31823-b687-53e6-9f29-edb9d4da9f9f" -version = "0.3.3+1" +version = "0.3.4+0" [[deps.snappy_jll]] -deps = ["Artifacts", "JLLWrappers", "LZO_jll", "Libdl", "Lz4_jll", "Zlib_jll"] -git-tree-sha1 = "a6c92533edec9755b3c1083b028da19a41f92e25" +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "8bb12ecfc3ffde2ef72a957cf2fab27cc193d251" uuid = "fe1e1685-f7be-5f59-ac9f-4ca204017dfd" -version = "1.2.1+3" +version = "1.2.2+0" diff --git a/Project.toml b/Project.toml index 359b24e..9168f66 100644 --- a/Project.toml +++ b/Project.toml @@ -5,13 +5,16 @@ version = "0.1.0" [deps] AutoHashEquals = "15f4f7f2-30c1-5605-9d31-71845cf9641f" +Cascadia = "54eefc05-d75b-58de-a785-1a3403f0919f" Combinatorics = "861a8166-3701-5b0c-9a16-15d98fcdc6aa" DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8" Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f" DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae" FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341" Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6" +Gumbo = "708ec375-b3d6-5a57-a7ce-8257bf98657a" Hecke = "3e1990a7-5d81-5526-99ce-9ba3ff248f21" +HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" Oscar = "f1435218-dba5-11e9-1e4d-f1a5fab5fc13" ProgressMeter = "92933f4c-e287-5a05-a399-4b506db050ca" @@ -42,6 +45,7 @@ MakieExt = ["Makie"] [compat] AutoHashEquals = "2.2.0" CairoMakie = "0.13.1" +Cascadia = "1.0.2" Colors = "0.13.0" Combinatorics = "1.0.2" DataStructures = "0.18.20" @@ -51,6 +55,8 @@ GLMakie = "0.11.2" GraphMakie = "0.5.13" GraphPlot = "0.6.0" Graphs = "1.12.0" +Gumbo = "0.8.3" +HTTP = "1.10.15" Makie = "0.19.11" NetworkLayout = "0.4.9" Oscar = "1.2.2" diff --git a/src/Quantum/query_grassl_website.jl b/src/Quantum/query_grassl_website.jl new file mode 100644 index 0000000..e69de29 diff --git a/src/Query_codetables.de/BKLC.jl b/src/Query_codetables.de/BKLC.jl new file mode 100644 index 0000000..7b535b4 --- /dev/null +++ b/src/Query_codetables.de/BKLC.jl @@ -0,0 +1,44 @@ +using HTTP +using Gumbo +using Cascadia + +function best_linear_code_in_codetables(n::Int, k::Int, F::String; verbose::Bool=false) + q_match = match(r"GF\((\d+)\)", F) + if q_match === nothing + throw(ArgumentError("Invalid finite field format. Expected format: GF(q), where q is an integer.")) + end + q = parse(Int, q_match.captures[1]) + if !(q in [2, 3, 4, 5, 7, 8, 9]) + throw(ArgumentError("q (= $q) must be in [2, 3, 4, 5, 7, 8, 9]")) + end + base_url = "http://www.codetables.de/BKLC/BKLC.php" + params = "?q=$q&n=$n&k=$k" + url = base_url * params + if verbose + println("Querying URL: $url") + end + response = HTTP.get(url) + if response.status != 200 + throw(IOError("Failed to retrieve data: HTTP status $(response.status)")) + end + html_content = String(response.body) + document = parsehtml(html_content) + pre_tags = eachmatch(sel"pre", document.root) + if isempty(pre_tags) + throw(IOError("Error parsing data:
tags not found in the response.")) + end + pre_content = nodeText(pre_tags[1]) + return pre_content +end + +function nodeText(node) + text = "" + for child in children(node) + if isa(child, HTMLText) + text *= child.text + else + text *= nodeText(child) + end + end + return text +end diff --git a/src/Query_codetables.de/QECC.jl b/src/Query_codetables.de/QECC.jl new file mode 100644 index 0000000..7c4b489 --- /dev/null +++ b/src/Query_codetables.de/QECC.jl @@ -0,0 +1,51 @@ +using HTTP +using Gumbo +using Cascadia + +function query_quantum_code_in_codetables(n::Int, k::Int, q::Int; verbose::Bool=false) + if !(q in [2, 3, 4, 5, 7, 8]) + throw(ArgumentError("q (= $q) must be in [2, 3, 4, 5, 7, 8]")) + end + if !(1 ≤ n ≤ 256) + throw(ArgumentError("n (= $n) must be in the range 1 ≤ n ≤ 256")) + end + if !(0 ≤ k ≤ n) + throw(ArgumentError("k (= $k) must be in the range 0 ≤ k ≤ n")) + end + + # Correct base URL for quantum codes + base_url = "https://codetables.de/QECC.php" + params = "?q=$q&n=$n&k=$k" + url = base_url * params + + if verbose + println("Querying URL: $url") + end + + response = HTTP.get(url) + if response.status != 200 + error("Failed to retrieve data: HTTP status $(response.status)") + end + + html_content = String(response.body) + document = parsehtml(html_content) + pre_tags = eachmatch(sel"pre", document.root) + if isempty(pre_tags) + error("Error parsing data:tags not found in the response.") + end + + pre_content = nodeText(pre_tags[1]) + return pre_content +end + +function nodeText(node) + text = "" + for child in children(node) + if isa(child, HTMLText) + text *= child.text + else + text *= nodeText(child) + end + end + return text +end