Skip to content

Conversation

@jpagh
Copy link
Contributor

@jpagh jpagh commented Nov 17, 2025

I'm sorry that this PR does more than one thing.

First, it fixes the complete_elements methods of DADict and DASet to return a new instance of their class with the complete_elements, rather than returning a generic dict or set. This matches the behavior of the method in a DAList and gives access to all of the DA methods included expected string output.

Second, it adds the cancel_add_or_edit method to DADict. This is very similar to the DAList version it is based on, but handles deleting the new_item_name attribute and uses popitem to remove the last item from the dict.

Third, it fixes the logic in DAList's cancel_add_or_edit method to only pop the last item if self.complete_elements().number() is less than self.number_gathered() rather than only if they are unequal. This is just a safety net for the (maybe not even possible) edge case where the length of complete_elements is somehow bigger than number_gathered, in which case you can't know if you want to pop the last element off of the DAList. I wrote the DADict version using this same logic. In all normal cases this works as expected and the same as with !=.

@jpagh jpagh changed the title Fix complete_elements and add cancel_add_or_edit Fix complete_elements in DADict/DASet and add cancel_add_or_edit to DADict Nov 17, 2025
@jhpyle jhpyle merged commit 5fd32ea into jhpyle:master Jan 1, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants