Open lmmx opened 3 years ago
Is this a bug, or should I be looking for the comment in another place?
Yes, the boolean value is a real bool
while others are tomlkit wrapped objects. This is intended as users may compare the value with boolean singletons with is
@frostming so is there any other way of getting the comment for it?
@Ovsyanka83
v2 = d['foo'].value.item('baz')
print(v2.trivia.comment)
@frostming thanks for the quick reply! Spent an hour trying to figure it out on my own but gave up. I think, the problem is the lack of documentation on the topic. I.e. ".value" was never mentioned in the README.md, and I haven't found any other documentation for tomlkit. I think, there should be a small section on manually extracting all information from tables that mentions how "value" actually has the "item" method.
Also, there's the issue of Bool being not json-serializable.
I've just tried to set up comment parsing in a TOML config file to see if I could use it for documentation, and it seems like it'll work except for when the configured value is a boolean.
When I drop into a debugger and look at the attributes of the parsed value:
and then tab complete to show the attributes, the dict
x
has atrivia
attribute but the valuey
does not:x.trivia.comment
but there's nothing theretrivia.comment
attributeIs this a bug, or should I be looking for the comment in another place?
To minimally reproduce:
⇣