1818import copy
1919import datetime
2020import json
21+ from typing import Any , Optional , Set , Tuple , Union
2122import warnings
2223from urllib .parse import urlsplit
2324
2425from google .api_core import datetime_helpers
2526from google .api_core .iam import Policy
27+ from google .api_core .retry import Retry
2628from google .cloud ._helpers import _datetime_to_rfc3339 , _rfc3339_nanos_to_datetime
2729from google .cloud .exceptions import NotFound
2830
29- from google .cloud .storage import _signing
31+ from google .cloud .storage import Client , _signing
3032from google .cloud .storage ._helpers import (
3133 _NOW ,
3234 _UTC ,
6567 DEFAULT_RETRY_IF_ETAG_IN_JSON ,
6668 DEFAULT_RETRY_IF_GENERATION_SPECIFIED ,
6769 DEFAULT_RETRY_IF_METAGENERATION_SPECIFIED ,
70+ ConditionalRetryPolicy ,
6871)
6972
7073_UBLA_BPO_ENABLED_MESSAGE = (
@@ -846,12 +849,12 @@ def from_string(cls, uri, client=None):
846849
847850 def blob (
848851 self ,
849- blob_name ,
850- chunk_size = None ,
851- encryption_key = None ,
852- kms_key_name = None ,
853- generation = None ,
854- ):
852+ blob_name : str ,
853+ chunk_size : Optional [ int ] = None ,
854+ encryption_key : Optional [ bytes ] = None ,
855+ kms_key_name : Optional [ str ] = None ,
856+ generation : Optional [ int ] = None ,
857+ ) -> Blob :
855858 """Factory constructor for blob object.
856859
857860 .. note::
@@ -862,9 +865,11 @@ def blob(
862865 :param blob_name: The name of the blob to be instantiated.
863866
864867 :type chunk_size: int
865- :param chunk_size: The size of a chunk of data whenever iterating
866- (in bytes). This must be a multiple of 256 KB per
867- the API specification.
868+ :param chunk_size:
869+ (Optional) The size of a chunk of data whenever iterating (in bytes).
870+ This must be a multiple of 256 KB per the API specification. If not
871+ specified, the chunk_size of the blob itself is used. If that is not
872+ specified, a default value of 40 MB is used.
868873
869874 :type encryption_key: bytes
870875 :param encryption_key:
@@ -1289,21 +1294,21 @@ def path(self):
12891294
12901295 def get_blob (
12911296 self ,
1292- blob_name ,
1293- client = None ,
1294- encryption_key = None ,
1295- generation = None ,
1296- if_etag_match = None ,
1297- if_etag_not_match = None ,
1298- if_generation_match = None ,
1299- if_generation_not_match = None ,
1300- if_metageneration_match = None ,
1301- if_metageneration_not_match = None ,
1302- timeout = _DEFAULT_TIMEOUT ,
1303- retry = DEFAULT_RETRY ,
1304- soft_deleted = None ,
1305- ** kwargs ,
1306- ):
1297+ blob_name : str ,
1298+ client : Optional [ Client ] = None ,
1299+ encryption_key : Optional [ bytes ] = None ,
1300+ generation : Optional [ int ] = None ,
1301+ if_etag_match : Optional [ Union [ str , Set [ str ]]] = None ,
1302+ if_etag_not_match : Optional [ Union [ str , Set [ str ]]] = None ,
1303+ if_generation_match : Optional [ int ] = None ,
1304+ if_generation_not_match : Optional [ int ] = None ,
1305+ if_metageneration_match : Optional [ int ] = None ,
1306+ if_metageneration_not_match : Optional [ int ] = None ,
1307+ timeout : Optional [ Union [ float , Tuple [ float , float ]]] = _DEFAULT_TIMEOUT ,
1308+ retry : Optional [ Union [ Retry , ConditionalRetryPolicy ]] = DEFAULT_RETRY ,
1309+ soft_deleted : Optional [ bool ] = None ,
1310+ ** kwargs : Any ,
1311+ ) -> Optional [ Blob ] :
13071312 """Get a blob object by name.
13081313
13091314 See a [code sample](https://cloud.google.com/storage/docs/samples/storage-get-metadata#storage_get_metadata-python)
0 commit comments