Repository navigation
Fix AttributeError in DRILLSearchTreePriorityQueue.get_top_n - #605
Merged
Merged
Conversation
self.refined_nodes was never assigned anywhere, and dict.values() doesn't support +. Replace with list(self.nodes.values()); drop the useless all_nodes.union(self.nodes) call whose result was discarded. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Covers ontolearn/search.py:798: previously get_top_n() referenced the never-assigned self.refined_nodes and tried to add it to a dict_values object, raising AttributeError. These tests fail against the pre-fix code and pass against the fix. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2 tasks done
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DRILLSearchTreePriorityQueue.get_top_n()(ontolearn/search.py:798) referencedself.refined_nodes, an attribute that is never assigned anywhere in the codebase, and attempted+on adict_valuesobject — both raise at runtime (AttributeError/TypeError) any time this method is called.all_nodes = list(self.nodes.values())and removed the subsequent no-opall_nodes.union(self.nodes)call, whose result was discarded and which would also fail sincelisthas no.union()method.tests/test_search.pywith regression tests forget_top_n()covering thequality,heuristic, and result-size-limiting behavior.Test plan
pytest tests/test_search.py -p no:warnings -vpasses on this branchAttributeError: 'DRILLSearchTreePriorityQueue' object has no attribute 'refined_nodes'against the pre-fix version ofontolearn/search.py🤖 Generated with Claude Code