Archipelago icon indicating copy to clipboard operation
Archipelago copied to clipboard

Yaml: Support weighted lists

Open SWCreeperKing opened this issue 4 months ago • 1 comments

What feature would you like to see?

Currently Yaml doesn't support weighting lists for example:

enabled_levels:
  ["All"]: 50
  ["level a", "level b"] : 20
  ["level b", "level c"] : 20

this gives the error

Traceback (most recent call last):
  File "Generate.py", line 132, in main
  File "Generate.py", line 252, in read_weights_yamls
  File "yaml\__init__.py", line 93, in load_all
  File "yaml\constructor.py", line 45, in get_data
  File "yaml\constructor.py", line 60, in construct_document
  File "yaml\constructor.py", line 413, in construct_yaml_map
  File "Utils.py", line 248, in construct_mapping
TypeError: unhashable type: 'list'

SWCreeperKing avatar Dec 07 '25 19:12 SWCreeperKing

There's some discussion ongoing in ap-world-dev, but I'm going to say that if this is added as a feature, I don't think it should use the syntax shown in the post, and instead some other format will probably have to be added. The error is because pyyaml fails to even parse this in the first place, and it appears that for parsers that would parse it, it'd be as an implicit string instead of actually as a list key (though those are possible to represent in the standard, but pyyaml doesn't seem to be able to parse it either).

duckboycool avatar Dec 07 '25 20:12 duckboycool