Skip to content

Commit aaa343f

Browse files
chore: add TYPE_CHECKING for imports (#756)
1 parent d374887 commit aaa343f

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

google/cloud/sql/connector/connector.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@
1313
See the License for the specific language governing permissions and
1414
limitations under the License.
1515
"""
16+
from __future__ import annotations
17+
1618
import asyncio
1719
from functools import partial
1820
import logging
1921
from threading import Thread
2022
from types import TracebackType
21-
from typing import Any, Dict, Optional, Type
23+
from typing import Any, Dict, Optional, Type, TYPE_CHECKING
2224

23-
from google.auth.credentials import Credentials
2425
import google.cloud.sql.connector.asyncpg as asyncpg
2526
from google.cloud.sql.connector.exceptions import ConnectorLoopError
2627
from google.cloud.sql.connector.instance import (
@@ -32,6 +33,9 @@
3233
import google.cloud.sql.connector.pytds as pytds
3334
from google.cloud.sql.connector.utils import format_database_user, generate_keys
3435

36+
if TYPE_CHECKING:
37+
from google.auth.credentials import Credentials
38+
3539
logger = logging.getLogger(name=__name__)
3640

3741
ASYNC_DRIVERS = ["asyncpg"]

google/cloud/sql/connector/instance.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@
1313
See the License for the specific language governing permissions and
1414
limitations under the License.
1515
"""
16+
from __future__ import annotations
17+
1618
import asyncio
17-
import datetime
1819
from enum import Enum
1920
import logging
2021
import ssl
@@ -24,6 +25,7 @@
2425
Dict,
2526
Optional,
2627
Tuple,
28+
TYPE_CHECKING,
2729
)
2830

2931
import aiohttp
@@ -47,6 +49,9 @@
4749
from google.cloud.sql.connector.utils import _auth_init, write_to_file
4850
from google.cloud.sql.connector.version import __version__ as version
4951

52+
if TYPE_CHECKING:
53+
import datetime
54+
5055
logger = logging.getLogger(name=__name__)
5156

5257
APPLICATION_NAME = "cloud-sql-python-connector"

google/cloud/sql/connector/refresh_utils.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,20 @@
1313
See the License for the specific language governing permissions and
1414
limitations under the License.
1515
"""
16+
from __future__ import annotations
17+
1618
import asyncio
1719
import copy
1820
import datetime
1921
import logging
20-
from typing import Any, Dict, List
21-
22-
import aiohttp
22+
from typing import Any, Dict, List, TYPE_CHECKING
2323

24-
import google.auth
2524
from google.auth.credentials import Credentials, Scoped
2625
import google.auth.transport.requests
2726

27+
if TYPE_CHECKING:
28+
import aiohttp
29+
2830
logger = logging.getLogger(name=__name__)
2931

3032
_sql_api_version: str = "v1beta4"

0 commit comments

Comments
 (0)