Repository navigation
fix: deprecate adjacent()/vertices() properly instead of hard-breaking - #2
Merged
Merged
Conversation
UVertex.adjacent() had been removed outright with no migration path -- renamed to neighbours()/neighbors() with zero deprecation phase, so any caller still using the old name got a bare AttributeError. Restored it as a thin wrapper: still calls neighbours() and returns its result, but now emits a DeprecationWarning first, giving callers a working upgrade path instead of an immediate break. Also fixed the same underlying anti-pattern already present nearby in Edge.vertices(): it did `raise DeprecationWarning(...)`, which aborts the call exactly like a missing method would (DeprecationWarning is just an Exception subclass when raised directly) -- no backward compatibility at all, and it never goes through the actual warnings machinery (no -W flag control, no filterwarnings support). Now uses warnings.warn(..., DeprecationWarning, stacklevel=2) and still returns self.endpoints, matching the same real deprecation pattern as adjacent() above. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2 +/- ##
==========================================
+ Coverage 81.88% 82.28% +0.40%
==========================================
Files 2 2
Lines 712 717 +5
==========================================
+ Hits 583 590 +7
+ Misses 129 127 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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
UVertex.adjacent()had been removed outright with no migration path -- renamed toneighbours()/neighbors()with zero deprecation phase, so any caller still using the old name got a bareAttributeError. Restored it as a thin wrapper: still callsneighbours()and returns its result, but now emits aDeprecationWarningfirst, giving callers a working upgrade path instead of an immediate break.Edge.vertices(): it didraise DeprecationWarning(...), which aborts the call exactly like a missing method would (DeprecationWarningis just anExceptionsubclass when raised directly) -- no backward compatibility at all, and it never goes through the actual warnings machinery (no-Wflag control, nofilterwarningssupport). Now useswarnings.warn(..., DeprecationWarning, stacklevel=2)and still returnsself.endpoints, matching the same real deprecation pattern asadjacent()above.Test plan
🤖 Generated with Claude Code