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

feat: add a depth-limited repr function #657

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open

Conversation

chisholm
Copy link
Collaborator

Fixes #656 .

This PR shows a way to reduce the size of reprs of ORM objects. It implements a custom repr function which is depth-limited. It's a simple generic way to "prune" the repr. If you try again the script given in the issue, the result should much smaller.

This PR also overrides __repr__() for three ORM classes: Queue, Resource, Tag as an example.

The function is implemented in a pretty generic way, so you could use it with simple types and generic data structures as well, but the depth limiting is specifically implemented in terms of nested ORM objects, since it is written to solve the ORM object repr problem.

Should help reduce the size of reprs of instances of ORM-mapped
classes.
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.

1 participant