Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitffc51f0

Browse files
authored
fix: make 'gapic_v1.method.DEFAULT' a typed object (#292)
FBO checkers which need to verify default values for 'retry' / 'timeout'
1 parentd2a729e commitffc51f0

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

‎google/api_core/gapic_v1/method.py‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,26 @@
1818
pagination, and long-running operations to gRPC methods.
1919
"""
2020

21+
importenum
2122
importfunctools
2223

2324
fromgoogle.api_coreimportgrpc_helpers
2425
fromgoogle.api_coreimporttimeout
2526
fromgoogle.api_core.gapic_v1importclient_info
2627

2728
USE_DEFAULT_METADATA=object()
28-
DEFAULT=object()
29+
30+
31+
class_MethodDefault(enum.Enum):
32+
# Uses enum so that pytype/mypy knows that this is the only possible value.
33+
# https://stackoverflow.com/a/60605919/101923
34+
#
35+
# Literal[_DEFAULT_VALUE] is an alternative, but only added in Python 3.8.
36+
# https://docs.python.org/3/library/typing.html#typing.Literal
37+
_DEFAULT_VALUE=object()
38+
39+
40+
DEFAULT=_MethodDefault._DEFAULT_VALUE
2941
"""Sentinel value indicating that a retry or timeout argument was unspecified,
3042
so the default should be used."""
3143

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp