-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Add DEFAULT sentinel for gapic_v1.method #4079
Add DEFAULT sentinel for gapic_v1.method #4079
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -33,6 +33,7 @@ | |||
_API_CORE_VERSION = pkg_resources.get_distribution('google-cloud-core').version | |||
METRICS_METADATA_KEY = 'x-goog-api-client' | |||
USE_DEFAULT_METADATA = object() | |||
DEFAULT = object() |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -88,12 +89,16 @@ def _determine_timeout(default_timeout, specified_timeout, retry): | |||
Returns: | |||
Optional[Timeout]: The timeout to apply to the method or ``None``. | |||
""" | |||
if specified_timeout is DEFAULT: | |||
specified_timeout = default_timeout |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
unusued_sleep): | ||
method = mock.Mock(spec=['__call__'], side_effect=[ | ||
exceptions.InternalServerError(None), | ||
42]) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This is needed because the wrapped gapic methods can't discern between "unspecified" and "None" because the gapic clients will always specify retry and timeout, e.g.:
gapic methods will use this sentinel to indicate unspecified: