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 .retry_base import exponential_sleep_generator
18from .retry_base import if_exception_type
19from .retry_base import if_transient_error
20from .retry_base import build_retry_error
21from .retry_base import RetryFailureReason
22from .retry_unary import Retry
23from .retry_unary import retry_target
24from .retry_unary_async import AsyncRetry
25from .retry_unary_async import retry_target as retry_target_async
26from .retry_streaming import StreamingRetry
27from .retry_streaming import retry_target_stream
28from .retry_streaming_async import AsyncStreamingRetry
29from .retry_streaming_async import retry_target_stream as retry_target_stream_async
30
31# The following imports are for backwards compatibility with https://github.com/googleapis/python-api-core/blob/4d7d2edee2c108d43deb151e6e0fdceb56b73275/google/api_core/retry.py
32#
33# TODO: Revert these imports on the next major version release (https://github.com/googleapis/python-api-core/issues/576)
34from google.api_core import datetime_helpers # noqa: F401
35from google.api_core import exceptions # noqa: F401
36from google.auth import exceptions as auth_exceptions # noqa: F401
37
38__all__ = (
39 "exponential_sleep_generator",
40 "if_exception_type",
41 "if_transient_error",
42 "build_retry_error",
43 "RetryFailureReason",
44 "Retry",
45 "AsyncRetry",
46 "StreamingRetry",
47 "AsyncStreamingRetry",
48 "retry_target",
49 "retry_target_async",
50 "retry_target_stream",
51 "retry_target_stream_async",
52)