Skip to content

Commit 572d951

Browse files
fix: make timeout an optional positional arg (#3938)
* fix: make timeout an optional positional arg * place `none` back in function signature Co-authored-by: Bu Sun Kim <[email protected]>
1 parent e0cfe08 commit 572d951

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

pubsub/cloud-client/subscriber.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -678,22 +678,24 @@ def callback(message):
678678

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

683683
receive_with_custom_attributes_parser = subparsers.add_parser(
684684
"receive-custom-attributes",
685685
help=receive_messages_with_custom_attributes.__doc__,
686686
)
687687
receive_with_custom_attributes_parser.add_argument("subscription_name")
688688
receive_with_custom_attributes_parser.add_argument(
689-
"--timeout", default=None, type=float
689+
"timeout", default=None, type=float, nargs="?"
690690
)
691691

692692
receive_with_flow_control_parser = subparsers.add_parser(
693693
"receive-flow-control", help=receive_messages_with_flow_control.__doc__
694694
)
695695
receive_with_flow_control_parser.add_argument("subscription_name")
696-
receive_with_flow_control_parser.add_argument("--timeout", default=None, type=float)
696+
receive_with_flow_control_parser.add_argument(
697+
"timeout", default=None, type=float, nargs="?"
698+
)
697699

698700
synchronous_pull_parser = subparsers.add_parser(
699701
"receive-synchronously", help=synchronous_pull.__doc__
@@ -710,15 +712,17 @@ def callback(message):
710712
"listen-for-errors", help=listen_for_errors.__doc__
711713
)
712714
listen_for_errors_parser.add_argument("subscription_name")
713-
listen_for_errors_parser.add_argument("--timeout", default=None, type=float)
715+
listen_for_errors_parser.add_argument(
716+
"timeout", default=None, type=float, nargs="?"
717+
)
714718

715719
receive_messages_with_delivery_attempts_parser = subparsers.add_parser(
716720
"receive-messages-with-delivery-attempts",
717721
help=receive_messages_with_delivery_attempts.__doc__,
718722
)
719723
receive_messages_with_delivery_attempts_parser.add_argument("subscription_name")
720724
receive_messages_with_delivery_attempts_parser.add_argument(
721-
"--timeout", default=None, type=float
725+
"timeout", default=None, type=float, nargs="?"
722726
)
723727

724728
args = parser.parse_args()

0 commit comments

Comments
 (0)