You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When there are sections defined out of order, it seems tomlkit does not like it. Original issue was reported at python-poetry/poetry#4718.
The following code runs without issues, however does not modify the toml. Using content.value_insert_after() causes AttributeError: 'dict' object has no attribute '_insert_after'.
If we remove build-system from the toml, the code below raises AttributeError: 'Table' object has no attribute '_insert_after'. However using content.value succeeds with the right results.
You are trying to get the DOM element(A Container in tomlkit) of the table via .value while for a OutOfOrderTableProxy, the .value returns an intermediate helper Container that is created when building the proxy, hence any modification won't reflect to the original document.
To fix it, you need to make the modification on one of the underlying tables that are combined by the OutOfOrderTableProxy. See the example here. However, that needs to add those underscored methods to both OutOfOrderTableProxy, Table, and perhaps InlineTable.
Activity
abn commentedon May 25, 2022
Here is a test case that reproduces the issue.
abn commentedon May 27, 2022
@frostming any chance I can get a pointer on where to fix this? Happy to do the leg work.
frostming commentedon May 30, 2022
You are trying to get the DOM element(A
Containerin tomlkit) of the table via.valuewhile for aOutOfOrderTableProxy, the.valuereturns an intermediate helperContainerthat is created when building the proxy, hence any modification won't reflect to the original document.To fix it, you need to make the modification on one of the underlying tables that are combined by the
OutOfOrderTableProxy. See the example here. However, that needs to add those underscored methods to bothOutOfOrderTableProxy,Table, and perhapsInlineTable.Kilo59 commentedon Mar 31, 2024
I'm having trouble following the example here.
Is there any more documentation or examples on how to resolve these out of order problems?
I'm trying to update a
tool.<TOOL_NAME>section but I can't seem to get it right.Desired
Actual
frostming commentedon Apr 1, 2024
Sorry, what code you are trying?