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: make timeout an optional positional arg #3938

Merged
merged 3 commits into from
Jun 3, 2020
Merged
Changes from 2 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
14 changes: 9 additions & 5 deletions pubsub/cloud-client/subscriber.py
Original file line number Diff line number Diff line change
Expand Up @@ -678,22 +678,24 @@ def callback(message):

receive_parser = subparsers.add_parser("receive", help=receive_messages.__doc__)
receive_parser.add_argument("subscription_name")
receive_parser.add_argument("--timeout", default=None, type=float)
receive_parser.add_argument("timeout", default=None, type=float, nargs="?")

receive_with_custom_attributes_parser = subparsers.add_parser(
"receive-custom-attributes",
help=receive_messages_with_custom_attributes.__doc__,
)
receive_with_custom_attributes_parser.add_argument("subscription_name")
receive_with_custom_attributes_parser.add_argument(
"--timeout", default=None, type=float
"timeout", default=None, type=float, nargs="?"
)

receive_with_flow_control_parser = subparsers.add_parser(
"receive-flow-control", help=receive_messages_with_flow_control.__doc__
)
receive_with_flow_control_parser.add_argument("subscription_name")
receive_with_flow_control_parser.add_argument("--timeout", default=None, type=float)
receive_with_flow_control_parser.add_argument(
"timeout", default=None, type=float, nargs="?"
)

synchronous_pull_parser = subparsers.add_parser(
"receive-synchronously", help=synchronous_pull.__doc__
Expand All @@ -710,15 +712,17 @@ def callback(message):
"listen-for-errors", help=listen_for_errors.__doc__
)
listen_for_errors_parser.add_argument("subscription_name")
listen_for_errors_parser.add_argument("--timeout", default=None, type=float)
listen_for_errors_parser.add_argument(
"timeout", default=None, type=float, nargs="?"
)

receive_messages_with_delivery_attempts_parser = subparsers.add_parser(
"receive-messages-with-delivery-attempts",
help=receive_messages_with_delivery_attempts.__doc__,
)
receive_messages_with_delivery_attempts_parser.add_argument("subscription_name")
receive_messages_with_delivery_attempts_parser.add_argument(
"--timeout", default=None, type=float
"timeout", default=None, type=float, nargs="?"
)

args = parser.parse_args()
Expand Down