Repository navigation
fix: repr(g) is the one-line summary, show() lists the vertices - #87
Merged
Merged
Conversation
The graph had two __repr__ definitions in one class. The first returned str(self) and was shadowed by the second, which printed one line per vertex, so a repr (a notebook cell, a debugger, a log line, an error message) was as long as the graph. A type: ignore[no-redef] hid the redefinition. Keep one __repr__, the same one-line summary as __str__, and have show() print what the long repr did: each vertex with its name, coordinate and component number. plot() and show() now refer to each other in :seealso:. Part of #23. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 4 |
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #87 +/- ##
==========================================
+ Coverage 97.54% 97.98% +0.43%
==========================================
Files 4 4
Lines 1591 1586 -5
==========================================
+ Hits 1552 1554 +2
+ Misses 39 32 -7 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
10 tasks
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.
Part of #23.
What
Graphhad two__repr__definitions. The first returnedstr(self)and was shadowed by the second, which printed one line per vertex. Atype: ignore[no-redef]hid the redefinition.A
repris what appears in a notebook cell, a debugger pane, a log line, pytest output and error messages, so a repr as long as the graph is a hazard on a large one.__repr__, the same one-line summary as__str__:UGraph: 3 vertices, 2 edges, 1 component.show()now prints what the long repr did: each vertex with its name, coordinate and component number (edges are unchanged).plot()andshow()refer to each other in:seealso:, as do__str__,__repr__andshow().Behaviour change
repr(g)changes from a listing to one line, andshow()gains the coordinate and component on each vertex line. Both carry.. versionchanged:: 1.1. I found no use of the graph's repr in RTB's or MVTB's source. The CHANGELOG line is left until theUnreleasedsection exists (#78 is adding it).Tests
show()output against hand-written lines, including a second component and an edgeshow()on a vertex with no coordinatepytest tests: 775 passed.mypy src: clean. The nitpicky docs build has the same 11 warnings with and without the change, none for these methods.🤖 Generated with Claude Code