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

Blocking given objects from further expansion. #75

Open
thisismygitrepo opened this issue Jun 22, 2023 · 3 comments
Open

Blocking given objects from further expansion. #75

thisismygitrepo opened this issue Jun 22, 2023 · 3 comments

Comments

@thisismygitrepo
Copy link

Can we please have a direly missing option to block given objects from further expansion?
For example, I want to have very deep expansion of my object but I don't want to expose any low level details of foreign objects, e.g. pandas dataframe. Unless I'm very much mistaken, I couldn't see an option for this.
Thank you.

@mgedmin
Copy link
Owner

mgedmin commented Jun 23, 2023

The filter argument for objgraph.show_refs()/objgraph.show_backrefs() works like this. E.g.

objgraph.show_refs([start], filter=lambda x: not isinstance(x, pandas.DataFrame))

I see that it is rather underdocumented. The docs for objgraph.typestats() also has it, and describes it as

If filter is specified, it should be a function taking one argument and returning a boolean. Objects for which filter(obj) returns False will be ignored.

and I should copy the second sentence and include it in the explanation of filter in the docs for show_refs/backrefs.

@thisismygitrepo
Copy link
Author

thisismygitrepo commented Jul 5, 2023

Thanks for showing this. I'm aware of this one already and it is a bit restricted in its functionality.

  • First, it hides the object altogether as opposed to, stop expanding it. The pandas dataframe object in itself is an important object in my graph but not its details. This applies to hunderds of other objects.
  • Can we also have filtering based on the name of attribute, as opposed to its type? like there could be a dict object, but I would like to hide it because its parent call it __cache, not because of its type.

@J12D
Copy link

J12D commented Feb 16, 2024

+1 this would be helpful — essentially I want to express “render objects of this type, but don’t expand them further”.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants