diff options
author | Tres Seaver <tseaver@palladion.com> | 2021-08-03 13:59:25 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-03 13:59:25 -0400 |
commit | a30f004e74f709d46e905dd819c71f43354e9ac9 (patch) | |
tree | 6e4367ce5fecd92fde24337a7b26373328e8e9df /google/api_core/timeout.py | |
parent | ff6ef1bd07fa68307b7c82c910416d770e7b3416 (diff) | |
download | python-api-core-a30f004e74f709d46e905dd819c71f43354e9ac9.tar.gz |
fix!: drop support for Python 2.7 / 3.5 (#212)
Drop 'six' module
Drop 'u"' prefixes for text
Remove other Python 2.7 workarounds
Drop use of 'pytz'
Dxpand range to allow 'google-auth' 2.x versions
Remove 'general_helpers.wraps': except for a backward-compatibility
import, 'functools.wraps' does everything wee need on Python >= 3.6.
Remove 'packaging' dependency
Release-As: 2.0.0b1
Closes #74.
Closes #215.
Diffstat (limited to 'google/api_core/timeout.py')
-rw-r--r-- | google/api_core/timeout.py | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/google/api_core/timeout.py b/google/api_core/timeout.py index 17c1bea..7323218 100644 --- a/google/api_core/timeout.py +++ b/google/api_core/timeout.py @@ -54,11 +54,9 @@ matches ``api_method(request, timeout=None, retry=None)``. from __future__ import unicode_literals import datetime - -import six +import functools from google.api_core import datetime_helpers -from google.api_core import general_helpers _DEFAULT_INITIAL_TIMEOUT = 5.0 # seconds _DEFAULT_MAXIMUM_TIMEOUT = 30.0 # seconds @@ -68,7 +66,6 @@ _DEFAULT_TIMEOUT_MULTIPLIER = 2.0 _DEFAULT_DEADLINE = None -@six.python_2_unicode_compatible class ConstantTimeout(object): """A decorator that adds a constant timeout argument. @@ -95,7 +92,7 @@ class ConstantTimeout(object): Callable: The wrapped function. """ - @general_helpers.wraps(func) + @functools.wraps(func) def func_with_timeout(*args, **kwargs): """Wrapped function that adds timeout.""" kwargs["timeout"] = self._timeout @@ -140,7 +137,6 @@ def _exponential_timeout_generator(initial, maximum, multiplier, deadline): timeout = timeout * multiplier -@six.python_2_unicode_compatible class ExponentialTimeout(object): """A decorator that adds an exponentially increasing timeout argument. @@ -207,7 +203,7 @@ class ExponentialTimeout(object): self._initial, self._maximum, self._multiplier, self._deadline ) - @general_helpers.wraps(func) + @functools.wraps(func) def func_with_timeout(*args, **kwargs): """Wrapped function that adds timeout.""" kwargs["timeout"] = next(timeouts) |