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

Fix error when clime.now is imported in a module without any callables #25

Merged
merged 2 commits into from Jan 6, 2015

Conversation

@uranusjr
Copy link
Contributor

uranusjr commented Jan 5, 2015

To reproduce, run import clime.now in an empty module.

This patch eats the exception and outputs nothing if there's nothing to print.

I also removed the cmd_func local variable because it is not needed anywhere.

uranusjr added 2 commits Jan 5, 2015
If clime.now is imported in a module with no functions at all, the
usage list would be empty. In this case next(iusages) will fail with
a StopIteration error.

This patch eats the exception and outputs nothing if there's nothing
to print.
@@ -632,7 +632,6 @@ def append_usage(cmd_name, without_name=False):
usages.append(Command(cmd_func, cmd_name).build_usage(without_name))

usages = []
cmd_func = None

This comment has been minimized.

Copy link
@moskytw

moskytw Jan 6, 2015

Owner

can it be deleted?

This comment has been minimized.

Copy link
@uranusjr

uranusjr Jan 6, 2015

Author Contributor

PyFlakes thinks so.

(clime)tp-mba:clime uranusjr$ pyflakes clime/core.py
clime/core.py:635: local variable 'cmd_func' is assigned to but never used

This comment has been minimized.

Copy link
@moskytw

moskytw Jan 6, 2015

Owner

okay, yeah, that is right.

moskytw added a commit that referenced this pull request Jan 6, 2015
Fix error when clime.now is imported in a module without any callables
@moskytw moskytw merged commit 67ef3a7 into moskytw:dev Jan 6, 2015
1 check passed
1 check passed
continuous-integration/travis-ci The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.