The Wayback Machine - https://web.archive.org/web/20201020072056/https://github.com/google/python-fire/issues/249
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

When returning a dict containing keys starting with an underscore, these entries are not shown #249

Open
gab50000 opened this issue Apr 23, 2020 · 2 comments

Comments

@gab50000
Copy link

@gab50000 gab50000 commented Apr 23, 2020

Example:

import fire

assert fire.__version__ == "0.3.1"

def f():
    return {"_id": 123, "x": 5}

fire.Fire(f)

I guess this has to do with hiding private object attributes from the user?
But it would be nice if one could disable this behavior somehow.

@dbieber
Copy link
Member

@dbieber dbieber commented Apr 23, 2020

If you add -- --verbose or -- -v to your command, then the hidden attributes will be included.

@gab50000
Copy link
Author

@gab50000 gab50000 commented Apr 24, 2020

Great, thanks for the tip!
Do you think it would make sense to offer a way to enable such an option per default for certain functions?

For example:

import fire


def f():
    return {"_id": 12, "a": 2}

def g():
    return {"_id": 12, "a": 2}


fire.Fire(options={"f": {"verbose": True}, "g": {"verbose": False}))

This way, calling f would print the full dictionary, whereas calling g would only print "a: 2".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants
You can’t perform that action at this time.