Skip to content

Commit 026ee31

Browse files
committed
chore: remove Python 2-specific kwargs hack
1 parent 90c1bd1 commit 026ee31

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

google/api_core/gapic_v1/method.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -111,26 +111,22 @@ def __init__(self, target, retry, timeout, metadata=None):
111111
self._timeout = timeout
112112
self._metadata = metadata
113113

114-
def __call__(self, *args, **kwargs):
114+
def __call__(self, *args, timeout=DEFAULT, retry=DEFAULT, **kwargs):
115115
"""Invoke the low-level RPC with retry, timeout, and metadata."""
116-
# Note: Due to Python 2 lacking keyword-only arguments we use kwargs to
117-
# extract the retry and timeout params.
118-
timeout_ = _determine_timeout(
116+
timeout = _determine_timeout(
119117
self._timeout,
120-
kwargs.pop("timeout", self._timeout),
118+
timeout,
121119
# Use only the invocation-specified retry only for this, as we only
122120
# want to adjust the timeout deadline if the *user* specified
123121
# a different retry.
124-
kwargs.get("retry", None),
122+
retry,
125123
)
126124

127-
retry = kwargs.pop("retry", self._retry)
128-
129125
if retry is DEFAULT:
130126
retry = self._retry
131127

132128
# Apply all applicable decorators.
133-
wrapped_func = _apply_decorators(self._target, [retry, timeout_])
129+
wrapped_func = _apply_decorators(self._target, [retry, timeout])
134130

135131
# Add the user agent metadata to the call.
136132
if self._metadata is not None:

0 commit comments

Comments
 (0)