Skip to content

Commit 5bcd7a3

Browse files
committed
fix: add legacy imports to preserve backwards compatibility
1 parent ffe7555 commit 5bcd7a3

File tree

2 files changed

+26
-28
lines changed

2 files changed

+26
-28
lines changed

google/api_core/retry/__init__.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,18 @@
3131
# The following imports are for backwards compatibility with https://github.com/googleapis/python-api-core/blob/4d7d2edee2c108d43deb151e6e0fdceb56b73275/google/api_core/retry.py
3232
#
3333
# TODO: Revert these imports on the next major version release (https://github.com/googleapis/python-api-core/issues/576)
34-
import datetime
35-
import functools
36-
import logging
37-
import random
38-
import sys
39-
import time
40-
import inspect
41-
import warnings
42-
from typing import Any, Callable, TypeVar, TYPE_CHECKING
43-
from google.api_core import datetime_helpers
44-
from google.api_core import exceptions
45-
from google.auth import exceptions as auth_exceptions
34+
import datetime # noqa: F401
35+
import functools # noqa: F401
36+
import logging # noqa: F401
37+
import random # noqa: F401
38+
import sys # noqa: F401
39+
import time # noqa: F401
40+
import inspect # noqa: F401
41+
import warnings # noqa: F401
42+
from typing import Any, Callable, TypeVar, TYPE_CHECKING # noqa: F401
43+
from google.api_core import datetime_helpers # noqa: F401
44+
from google.api_core import exceptions # noqa: F401
45+
from google.auth import exceptions as auth_exceptions # noqa: F401
4646

4747
__all__ = (
4848
"exponential_sleep_generator",

tests/unit/retry/test_retry_imports.py

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,25 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
import pytest
16-
1715
def test_legacy_imports_retry_unary_sync():
1816
# TODO: Delete this test when when we revert these imports on the
1917
# next major version release
2018
# (https://github.com/googleapis/python-api-core/issues/576)
2119

2220
from google.api_core.retry import logging
23-
from google.api_core.retry import datetime
24-
from google.api_core.retry import functools
25-
from google.api_core.retry import logging
26-
from google.api_core.retry import random
27-
from google.api_core.retry import sys
28-
from google.api_core.retry import time
29-
from google.api_core.retry import inspect
30-
from google.api_core.retry import warnings
31-
from google.api_core.retry import Any, Callable, TypeVar, TYPE_CHECKING
32-
33-
from google.api_core.retry import datetime_helpers
34-
from google.api_core.retry import exceptions
35-
from google.api_core.retry import auth_exceptions
21+
from google.api_core.retry import datetime # noqa: F401
22+
from google.api_core.retry import functools # noqa: F401
23+
from google.api_core.retry import logging # noqa: F401
24+
from google.api_core.retry import random # noqa: F401
25+
from google.api_core.retry import sys # noqa: F401
26+
from google.api_core.retry import time # noqa: F401
27+
from google.api_core.retry import inspect # noqa: F401
28+
from google.api_core.retry import warnings # noqa: F401
29+
from google.api_core.retry import Any, Callable, TypeVar, TYPE_CHECKING # noqa: F401
30+
31+
from google.api_core.retry import datetime_helpers # noqa: F401
32+
from google.api_core.retry import exceptions # noqa: F401
33+
from google.api_core.retry import auth_exceptions # noqa: F401
3634

3735
### FIXME: How do we test the following, and how do we import it in __init__.py?
3836
# import google.api_core.retry.requests.exceptions
@@ -43,7 +41,7 @@ def test_legacy_imports_retry_unary_async():
4341
# next major version release
4442
# (https://github.com/googleapis/python-api-core/issues/576)
4543

46-
from google.api_core import retry_async
44+
from google.api_core import retry_async # noqa: F401
4745

4846
### FIXME: each of the following cause errors on the "retry_async" part: module not found
4947
# import google.api_core.retry_async.functools

0 commit comments

Comments
 (0)