Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix clear function #24

Merged
merged 3 commits into from
Feb 7, 2018
Merged

Fix clear function #24

merged 3 commits into from
Feb 7, 2018

Conversation

tcezard
Copy link

@tcezard tcezard commented Jan 22, 2018

The clear function in XmlDictionary and XmlList were both eagerly removing all elements of the rootnode even if those elements were not being parsed.
In object where the rootnode is shared running list.clear() was removing all elements of the rootnode.
This PR will fix this by only removing elements that have been parsed.
I also had to change the way SubTagDictionary is finding its rootnode by using the Nestable class.
fixes #23

@coveralls
Copy link

coveralls commented Jan 22, 2018

Coverage Status

Coverage increased (+0.03%) to 77.122% when pulling b1937f1 on fix_clear into 66586f0 on master.

XmlDictionary.__init__(self, instance)

def _update_elems(self):
tag_node = self.rootnode(self.instance).find(self.tag)
Copy link
Collaborator

@mwhamgenomics mwhamgenomics Jan 29, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the call to rootnode.find redundant, or will removing it cause a behaviour change?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because of the use of nesting in the __init__, self.rootnode() now returns the node of the tag making this function simpler and allowing the clear() function to work as expected

@tcezard tcezard merged commit c0c7067 into master Feb 7, 2018
@tcezard tcezard deleted the fix_clear branch May 11, 2018 03:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UdfConfig presets clear method clears the entire UdfConfig object
3 participants