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

fire.Fire(func) means that `func` cannot return an empty dict #4

Closed
ubershmekel opened this issue Mar 4, 2017 · 2 comments
Closed

fire.Fire(func) means that `func` cannot return an empty dict #4

ubershmekel opened this issue Mar 4, 2017 · 2 comments
Labels
bug

Comments

@ubershmekel
Copy link
Contributor

@ubershmekel ubershmekel commented Mar 4, 2017

import fire

def x():
    return {}

fire.Fire(x)

Will cause this stack trace:

Traceback (most recent call last):
  File "E:/1stuff/Dropbox/dev/python/testfire/testing.py", line 7, in <module>
    z = fire.Fire(x)
  File "C:\Users\yuv\AppData\Local\Programs\Python\Python36-32\lib\site-packages\fire\core.py", line 145, in Fire
    _PrintResult(component_trace, verbose=component_trace.verbose)
  File "C:\Users\yuv\AppData\Local\Programs\Python\Python36-32\lib\site-packages\fire\core.py", line 181, in _PrintResult
    print(_DictAsString(result, verbose))
  File "C:\Users\yuv\AppData\Local\Programs\Python\Python36-32\lib\site-packages\fire\core.py", line 201, in _DictAsString
    len(str(key)) for key in result.keys()
ValueError: max() arg is an empty sequence
ubershmekel added a commit to ubershmekel/python-fire that referenced this issue Mar 4, 2017
@dbieber dbieber added the bug label Mar 4, 2017
@guoruibiao
Copy link

@guoruibiao guoruibiao commented Mar 4, 2017

python-fire is awesome cool.

@dbieber
Copy link
Member

@dbieber dbieber commented Mar 5, 2017

@ubershmekel Thanks for finding and fixing this bug! I'll respond to the pull request later in the week.

dbieber added a commit that referenced this issue Mar 6, 2017
* Fix for empty dictionary print outs

This should handle #4

* pep8 prefers `if not seq` over `len == 0`

* Use single quotes
@dbieber dbieber closed this Mar 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.