1# Copyright 2017 Google LLC
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15"""Retry implementation for Google API client libraries."""
16
17from google.auth import exceptions as auth_exceptions # noqa: F401
18
19# The following imports are for backwards compatibility with https://github.com/googleapis/python-api-core/blob/4d7d2edee2c108d43deb151e6e0fdceb56b73275/google/api_core/retry.py
20#
21# TODO: Revert these imports on the next major version release (https://github.com/googleapis/python-api-core/issues/576)
22from google.api_core import ( # noqa: F401
23 datetime_helpers,
24 exceptions,
25)
26
27from .retry_base import (
28 RetryFailureReason,
29 build_retry_error,
30 exponential_sleep_generator,
31 if_exception_type,
32 if_transient_error,
33)
34from .retry_streaming import StreamingRetry, retry_target_stream
35from .retry_streaming_async import AsyncStreamingRetry
36from .retry_streaming_async import retry_target_stream as retry_target_stream_async
37from .retry_unary import Retry, retry_target
38from .retry_unary_async import AsyncRetry
39from .retry_unary_async import retry_target as retry_target_async
40
41__all__ = (
42 "exponential_sleep_generator",
43 "if_exception_type",
44 "if_transient_error",
45 "build_retry_error",
46 "RetryFailureReason",
47 "Retry",
48 "AsyncRetry",
49 "StreamingRetry",
50 "AsyncStreamingRetry",
51 "retry_target",
52 "retry_target_async",
53 "retry_target_stream",
54 "retry_target_stream_async",
55)