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

[config] Fix _is_affirmative when passed argument is None #3063

Merged
merged 1 commit into from
Dec 6, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,8 @@ def _checksd_path(directory):


def _is_affirmative(s):
if s is None:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return s is None or isinstance(s, int) and bool(s) or s.lower() in ('yes', 'true', '1')

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree but for some reason I find things more readable the way they are, so I'll ignore this

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

especially that @degemer 's version is wrong. It would return True if s is None ..

return False
# int or real bool
if isinstance(s, int):
return bool(s)
Expand Down