Skip to content

Improve repr string representation of SummaryCounters - #1233

Merged
robsdedude merged 3 commits into
neo4j:6.xfrom
robsdedude:feat/summary-counters-repr
Aug 22, 2025
Merged

robsdedude merged 3 commits into
neo4j:6.xfrom
robsdedude:feat/summary-counters-repr

Conversation

@robsdedude

@robsdedude robsdedude commented Aug 21, 2025 •

Copy link
Copy Markdown
Member

Instead of for example {'nodes_created': 42, 'labels_removed': 0, '_contains_system_updates': True} the repr string representation is now SummaryCounters({'nodes-created': 42, 'labels-removed': 0, 'contains-system-updates': True}) or similar.

This is more in line with Python's recommendations:

If at all possible, this should look like a valid Python expression that could be used to recreate an object with the same value (given an appropriate environment). If this is not possible, a string of the form <...some useful description...> should be returned.

-- https://docs.python.org/3/reference/datamodel.html#object.__repr__

Further, the str representation has been adjusted from for instance {'nodes_created': 42, 'labels_removed': 0, '_contains_system_updates': True} to SummaryCounters{nodes_created: 42, contains_updates: True, contains_system_updates: True} representing all non-default attributes/properties of the object.

@robsdedude
robsdedude force-pushed the feat/summary-counters-repr branch from 19ddf5e to 17656c7 Compare August 21, 2025 13:50
@robsdedude
robsdedude marked this pull request as ready for review August 21, 2025 16:03

@MaxAake MaxAake left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ ✏️
Just a minor spelling error in tests

Comment thread tests/unit/common/work/test_summary.py Resolved
Comment thread tests/unit/common/work/test_summary.py Resolved
robsdedude and others added 2 commits August 22, 2025 13:23
Co-authored-by: Max Gustafsson <61233757+MaxAake@users.noreply.github.com>
@robsdedude
robsdedude enabled auto-merge (squash) August 22, 2025 14:05
@robsdedude
robsdedude merged commit 6a98a8e into neo4j:6.x Aug 22, 2025
@robsdedude
robsdedude deleted the feat/summary-counters-repr branch August 22, 2025 15:05
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