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: #1671 Convert Python Bool to API Parameter for Authenticated User Notifications #2001

Merged
merged 2 commits into from Oct 11, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions github/AuthenticatedUser.py
Expand Up @@ -973,9 +973,11 @@ def get_notifications(

params = dict()
if all is not github.GithubObject.NotSet:
params["all"] = all
# convert True, False to true, false for api parameters
params["all"] = str(all).lower() if isinstance(all, bool) else all
if participating is not github.GithubObject.NotSet:
params["participating"] = participating
# convert True, False to true, false for api parameters
params["participating"] = str(participating).lower() if isinstance(participating, bool) else participating
Copy link
Collaborator

Choose a reason for hiding this comment

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

At this point, you know participating is set and is a bool, so I think you could be simplified to:

params["participating"] = "true" if participating else "false"

Copy link
Collaborator

Choose a reason for hiding this comment

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

And for all as well

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay sounds good. @s-t-e-v-e-n-k please review the change.

if since is not github.GithubObject.NotSet:
params["since"] = since.strftime("%Y-%m-%dT%H:%M:%SZ")
if before is not github.GithubObject.NotSet:
Expand Down