Skip to content

Commit dd55f62

Browse files
committed
fix(storage): resolve circular import issues in type hints
1 parent 4450786 commit dd55f62

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

packages/google-cloud-storage/google/cloud/storage/bucket.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,16 @@
1818
import copy
1919
import datetime
2020
import json
21-
from typing import Any, Optional, Set, Tuple, Union
2221
import warnings
22+
from typing import Any, Optional, Set, Tuple, Union, TYPE_CHECKING
2323
from urllib.parse import urlsplit
2424

2525
from google.api_core import datetime_helpers
2626
from google.api_core.iam import Policy
2727
from google.api_core.retry import Retry
2828
from google.cloud._helpers import _datetime_to_rfc3339, _rfc3339_nanos_to_datetime
2929
from google.cloud.exceptions import NotFound
30-
31-
from google.cloud.storage import Client, _signing
30+
from google.cloud.storage import _signing
3231
from google.cloud.storage._helpers import (
3332
_NOW,
3433
_UTC,
@@ -70,6 +69,9 @@
7069
ConditionalRetryPolicy,
7170
)
7271

72+
if TYPE_CHECKING:
73+
from google.cloud.storage.client import Client
74+
7375
_UBLA_BPO_ENABLED_MESSAGE = (
7476
"Pass only one of 'uniform_bucket_level_access_enabled' / "
7577
"'bucket_policy_only_enabled' to 'IAMConfiguration'."
@@ -854,7 +856,7 @@ def blob(
854856
encryption_key: Optional[bytes] = None,
855857
kms_key_name: Optional[str] = None,
856858
generation: Optional[int] = None,
857-
) -> Blob:
859+
) -> "Blob":
858860
"""Factory constructor for blob object.
859861
860862
.. note::
@@ -1295,7 +1297,7 @@ def path(self):
12951297
def get_blob(
12961298
self,
12971299
blob_name: str,
1298-
client: Optional[Client] = None,
1300+
client: Optional["Client"] = None,
12991301
encryption_key: Optional[bytes] = None,
13001302
generation: Optional[int] = None,
13011303
if_etag_match: Optional[Union[str, Set[str]]] = None,

packages/google-cloud-storage/google/cloud/storage/client.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
import functools
2222
import json
2323
import os
24-
from typing import Optional, Sequence, Tuple, Union
2524
import warnings
25+
from typing import Optional, Sequence, Tuple, Union
2626

2727
import google.api_core.client_options
2828
from google.api_core import page_iterator
@@ -32,7 +32,6 @@
3232
from google.cloud._helpers import _LocalStack
3333
from google.cloud.client import ClientWithProject
3434
from google.cloud.exceptions import NotFound
35-
3635
from google.cloud.storage._helpers import (
3736
_DEFAULT_SCHEME,
3837
_DEFAULT_UNIVERSE_DOMAIN,

0 commit comments

Comments
 (0)