Skip to content

Commit ad39116

Browse files
chore(python): use black==22.3.0 (#742)
* chore(python): use black==22.3.0 Source-Link: googleapis/synthtool@6fab84a Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:7cffbc10910c3ab1b852c05114a08d374c195a81cdec1d4a67a1d129331d0bfe * chore(python): use black==22.3.0 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <[email protected]>
1 parent a8fcebb commit ad39116

28 files changed

+527
-237
lines changed

.github/.OwlBot.lock.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# limitations under the License.
1414
docker:
1515
image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest
16-
digest: sha256:5d8da01438ece4021d135433f2cf3227aa39ef0eaccc941d62aa35e6902832ae
16+
digest: sha256:7cffbc10910c3ab1b852c05114a08d374c195a81cdec1d4a67a1d129331d0bfe

docs/conf.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,10 @@
361361
intersphinx_mapping = {
362362
"python": ("https://python.readthedocs.org/en/latest/", None),
363363
"google-auth": ("https://googleapis.dev/python/google-auth/latest/", None),
364-
"google.api_core": ("https://googleapis.dev/python/google-api-core/latest/", None,),
364+
"google.api_core": (
365+
"https://googleapis.dev/python/google-api-core/latest/",
366+
None,
367+
),
365368
"grpc": ("https://grpc.github.io/grpc/python/", None),
366369
"proto-plus": ("https://proto-plus-python.readthedocs.io/en/latest/", None),
367370
"protobuf": ("https://googleapis.dev/python/protobuf/latest/", None),

google/cloud/storage/_helpers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ def _get_storage_host():
6969

7070
def _get_environ_project():
7171
return os.getenv(
72-
environment_vars.PROJECT, os.getenv(environment_vars.LEGACY_PROJECT),
72+
environment_vars.PROJECT,
73+
os.getenv(environment_vars.LEGACY_PROJECT),
7374
)
7475

7576

google/cloud/storage/_signing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def get_expiration_seconds_v2(expiration):
109109
# If it's a datetime, convert to a timestamp.
110110
if isinstance(expiration, datetime.datetime):
111111
micros = _helpers._microseconds_from_datetime(expiration)
112-
expiration = micros // 10 ** 6
112+
expiration = micros // 10**6
113113

114114
if not isinstance(expiration, int):
115115
raise TypeError(

google/cloud/storage/acl.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,10 @@ def reload(self, client=None, timeout=_DEFAULT_TIMEOUT, retry=DEFAULT_RETRY):
460460
self.entities.clear()
461461

462462
found = client._get_resource(
463-
path, query_params=query_params, timeout=timeout, retry=retry,
463+
path,
464+
query_params=query_params,
465+
timeout=timeout,
466+
retry=retry,
464467
)
465468
self.loaded = True
466469

google/cloud/storage/blob.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,11 @@
8787

8888

8989
_API_ACCESS_ENDPOINT = "https://storage.googleapis.com"
90-
_DEFAULT_CONTENT_TYPE = u"application/octet-stream"
91-
_DOWNLOAD_URL_TEMPLATE = u"{hostname}/download/storage/v1{path}?alt=media"
92-
_BASE_UPLOAD_TEMPLATE = u"{hostname}/upload/storage/v1{bucket_path}/o?uploadType="
93-
_MULTIPART_URL_TEMPLATE = _BASE_UPLOAD_TEMPLATE + u"multipart"
94-
_RESUMABLE_URL_TEMPLATE = _BASE_UPLOAD_TEMPLATE + u"resumable"
90+
_DEFAULT_CONTENT_TYPE = "application/octet-stream"
91+
_DOWNLOAD_URL_TEMPLATE = "{hostname}/download/storage/v1{path}?alt=media"
92+
_BASE_UPLOAD_TEMPLATE = "{hostname}/upload/storage/v1{bucket_path}/o?uploadType="
93+
_MULTIPART_URL_TEMPLATE = _BASE_UPLOAD_TEMPLATE + "multipart"
94+
_RESUMABLE_URL_TEMPLATE = _BASE_UPLOAD_TEMPLATE + "resumable"
9595
# NOTE: "acl" is also writeable but we defer ACL management to
9696
# the classes in the google.cloud.storage.acl module.
9797
_CONTENT_TYPE_FIELD = "contentType"
@@ -4459,7 +4459,7 @@ def _raise_from_invalid_response(error):
44594459
else:
44604460
error_message = str(error)
44614461

4462-
message = u"{method} {url}: {error}".format(
4462+
message = "{method} {url}: {error}".format(
44634463
method=response.request.method, url=response.request.url, error=error_message
44644464
)
44654465

google/cloud/storage/bucket.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1383,7 +1383,10 @@ def list_notifications(
13831383
client = self._require_client(client)
13841384
path = self.path + "/notificationConfigs"
13851385
iterator = client._list_resource(
1386-
path, _item_to_notification, timeout=timeout, retry=retry,
1386+
path,
1387+
_item_to_notification,
1388+
timeout=timeout,
1389+
retry=retry,
13871390
)
13881391
iterator.bucket = self
13891392
return iterator
@@ -2952,7 +2955,8 @@ def make_public(
29522955
for blob in blobs:
29532956
blob.acl.all().grant_read()
29542957
blob.acl.save(
2955-
client=client, timeout=timeout,
2958+
client=client,
2959+
timeout=timeout,
29562960
)
29572961

29582962
def make_private(

google/cloud/storage/client.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,7 +1130,9 @@ def download_blob_to_file(
11301130
headers = _get_encryption_headers(blob_or_uri._encryption_key)
11311131
headers["accept-encoding"] = "gzip"
11321132
_add_etag_match_headers(
1133-
headers, if_etag_match=if_etag_match, if_etag_not_match=if_etag_not_match,
1133+
headers,
1134+
if_etag_match=if_etag_match,
1135+
if_etag_not_match=if_etag_not_match,
11341136
)
11351137
headers = {**_get_default_headers(self._connection.user_agent), **headers}
11361138

@@ -1475,7 +1477,11 @@ def create_hmac_key(
14751477
qs_params["userProject"] = user_project
14761478

14771479
api_response = self._post_resource(
1478-
path, None, query_params=qs_params, timeout=timeout, retry=retry,
1480+
path,
1481+
None,
1482+
query_params=qs_params,
1483+
timeout=timeout,
1484+
retry=retry,
14791485
)
14801486
metadata = HMACKeyMetadata(self)
14811487
metadata._properties = api_response["metadata"]

google/cloud/storage/hmac_key.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,10 @@ def exists(self, timeout=_DEFAULT_TIMEOUT, retry=DEFAULT_RETRY):
211211
qs_params["userProject"] = self.user_project
212212

213213
self._client._get_resource(
214-
self.path, query_params=qs_params, timeout=timeout, retry=retry,
214+
self.path,
215+
query_params=qs_params,
216+
timeout=timeout,
217+
retry=retry,
215218
)
216219
except NotFound:
217220
return False
@@ -239,7 +242,10 @@ def reload(self, timeout=_DEFAULT_TIMEOUT, retry=DEFAULT_RETRY):
239242
qs_params["userProject"] = self.user_project
240243

241244
self._properties = self._client._get_resource(
242-
self.path, query_params=qs_params, timeout=timeout, retry=retry,
245+
self.path,
246+
query_params=qs_params,
247+
timeout=timeout,
248+
retry=retry,
243249
)
244250

245251
def update(self, timeout=_DEFAULT_TIMEOUT, retry=DEFAULT_RETRY_IF_ETAG_IN_JSON):
@@ -263,7 +269,11 @@ def update(self, timeout=_DEFAULT_TIMEOUT, retry=DEFAULT_RETRY_IF_ETAG_IN_JSON):
263269

264270
payload = {"state": self.state}
265271
self._properties = self._client._put_resource(
266-
self.path, payload, query_params=qs_params, timeout=timeout, retry=retry,
272+
self.path,
273+
payload,
274+
query_params=qs_params,
275+
timeout=timeout,
276+
retry=retry,
267277
)
268278

269279
def delete(self, timeout=_DEFAULT_TIMEOUT, retry=DEFAULT_RETRY):
@@ -289,5 +299,8 @@ def delete(self, timeout=_DEFAULT_TIMEOUT, retry=DEFAULT_RETRY):
289299
qs_params["userProject"] = self.user_project
290300

291301
self._client._delete_resource(
292-
self.path, query_params=qs_params, timeout=timeout, retry=retry,
302+
self.path,
303+
query_params=qs_params,
304+
timeout=timeout,
305+
retry=retry,
293306
)

google/cloud/storage/notification.py

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -156,26 +156,22 @@ def topic_name(self):
156156

157157
@property
158158
def topic_project(self):
159-
"""Project ID of topic to which notifications are published.
160-
"""
159+
"""Project ID of topic to which notifications are published."""
161160
return self._topic_project
162161

163162
@property
164163
def custom_attributes(self):
165-
"""Custom attributes passed with notification events.
166-
"""
164+
"""Custom attributes passed with notification events."""
167165
return self._properties.get("custom_attributes")
168166

169167
@property
170168
def event_types(self):
171-
"""Event types for which notification events are published.
172-
"""
169+
"""Event types for which notification events are published."""
173170
return self._properties.get("event_types")
174171

175172
@property
176173
def blob_name_prefix(self):
177-
"""Prefix of blob names for which notification events are published.
178-
"""
174+
"""Prefix of blob names for which notification events are published."""
179175
return self._properties.get("object_name_prefix")
180176

181177
@property
@@ -278,7 +274,11 @@ def create(self, client=None, timeout=_DEFAULT_TIMEOUT, retry=None):
278274
)
279275

280276
self._properties = client._post_resource(
281-
path, properties, query_params=query_params, timeout=timeout, retry=retry,
277+
path,
278+
properties,
279+
query_params=query_params,
280+
timeout=timeout,
281+
retry=retry,
282282
)
283283

284284
def exists(self, client=None, timeout=_DEFAULT_TIMEOUT, retry=DEFAULT_RETRY):
@@ -318,7 +318,10 @@ def exists(self, client=None, timeout=_DEFAULT_TIMEOUT, retry=DEFAULT_RETRY):
318318

319319
try:
320320
client._get_resource(
321-
self.path, query_params=query_params, timeout=timeout, retry=retry,
321+
self.path,
322+
query_params=query_params,
323+
timeout=timeout,
324+
retry=retry,
322325
)
323326
except NotFound:
324327
return False
@@ -360,7 +363,10 @@ def reload(self, client=None, timeout=_DEFAULT_TIMEOUT, retry=DEFAULT_RETRY):
360363
query_params["userProject"] = self.bucket.user_project
361364

362365
response = client._get_resource(
363-
self.path, query_params=query_params, timeout=timeout, retry=retry,
366+
self.path,
367+
query_params=query_params,
368+
timeout=timeout,
369+
retry=retry,
364370
)
365371
self._set_properties(response)
366372

@@ -400,7 +406,10 @@ def delete(self, client=None, timeout=_DEFAULT_TIMEOUT, retry=DEFAULT_RETRY):
400406
query_params["userProject"] = self.bucket.user_project
401407

402408
client._delete_resource(
403-
self.path, query_params=query_params, timeout=timeout, retry=retry,
409+
self.path,
410+
query_params=query_params,
411+
timeout=timeout,
412+
retry=retry,
404413
)
405414

406415

0 commit comments

Comments
 (0)