Skip to content

Commit 8ca0faa

Browse files
chore(python): use black==22.3.0 (#181)
* 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: update black version in noxfile * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * ci: add commit to trigger gh actions Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <partheniou@google.com>
1 parent 8575b67 commit 8ca0faa

File tree

7 files changed

+46
-23
lines changed

7 files changed

+46
-23
lines changed

.github/.OwlBot.lock.yaml

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

docs/conf.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,13 @@
314314
# One entry per manual page. List of tuples
315315
# (source start file, name, description, authors, manual section).
316316
man_pages = [
317-
(root_doc, "google-cloud-core", "google-cloud-core Documentation", [author], 1,)
317+
(
318+
root_doc,
319+
"google-cloud-core",
320+
"google-cloud-core Documentation",
321+
[author],
322+
1,
323+
)
318324
]
319325

320326
# If true, show URL addresses after external links.
@@ -355,7 +361,10 @@
355361
intersphinx_mapping = {
356362
"python": ("https://python.readthedocs.org/en/latest/", None),
357363
"google-auth": ("https://googleapis.dev/python/google-auth/latest/", None),
358-
"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+
),
359368
"grpc": ("https://grpc.github.io/grpc/python/", None),
360369
"proto-plus": ("https://proto-plus-python.readthedocs.io/en/latest/", None),
361370
"protobuf": ("https://googleapis.dev/python/protobuf/latest/", None),

google/cloud/_helpers/__init__.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,11 @@ def __init__(self):
8585
self._stack = []
8686

8787
def __iter__(self):
88-
"""Iterate the stack in LIFO order.
89-
"""
88+
"""Iterate the stack in LIFO order."""
9089
return iter(reversed(self._stack))
9190

9291
def push(self, resource):
93-
"""Push a resource onto our stack.
94-
"""
92+
"""Push a resource onto our stack."""
9593
self._stack.append(resource)
9694

9795
def pop(self):
@@ -284,7 +282,7 @@ def _rfc3339_nanos_to_datetime(dt_str):
284282
micros = 0
285283
else:
286284
scale = 9 - len(fraction)
287-
nanos = int(fraction) * (10 ** scale)
285+
nanos = int(fraction) * (10**scale)
288286
micros = nanos // 1000
289287
return bare_seconds.replace(microsecond=micros, tzinfo=UTC)
290288

@@ -416,8 +414,8 @@ def _datetime_to_pb_timestamp(when):
416414
:returns: A timestamp protobuf corresponding to the object.
417415
"""
418416
ms_value = _microseconds_from_datetime(when)
419-
seconds, micros = divmod(ms_value, 10 ** 6)
420-
nanos = micros * 10 ** 3
417+
seconds, micros = divmod(ms_value, 10**6)
418+
nanos = micros * 10**3
421419
return timestamp_pb2.Timestamp(seconds=seconds, nanos=nanos)
422420

423421

google/cloud/client/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,8 @@ def _http(self):
209209
"""
210210
if self._http_internal is None:
211211
self._http_internal = google.auth.transport.requests.AuthorizedSession(
212-
self._credentials, refresh_timeout=_CREDENTIALS_REFRESH_TIMEOUT,
212+
self._credentials,
213+
refresh_timeout=_CREDENTIALS_REFRESH_TIMEOUT,
213214
)
214215
self._http_internal.configure_mtls_channel(self._client_cert_source)
215216
return self._http_internal
@@ -254,7 +255,8 @@ def __init__(self, project=None, credentials=None):
254255
# https://github.com/googleapis/python-cloud-core/issues/27
255256
if project is None:
256257
project = os.getenv(
257-
environment_vars.PROJECT, os.getenv(environment_vars.LEGACY_PROJECT),
258+
environment_vars.PROJECT,
259+
os.getenv(environment_vars.LEGACY_PROJECT),
258260
)
259261

260262
# Project set on explicit credentials overrides discovery from

noxfile.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import nox
2020

2121

22-
BLACK_VERSION = "black==19.10b0"
22+
BLACK_VERSION = "black==22.3.0"
2323
BLACK_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"]
2424

2525
DEFAULT_PYTHON_VERSION = "3.7"
@@ -43,7 +43,10 @@ def mypy(session):
4343
"""Run type-checking."""
4444
session.install(".", "mypy")
4545
session.install(
46-
"types-setuptools", "types-requests", "types-mock", "types-protobuf",
46+
"types-setuptools",
47+
"types-requests",
48+
"types-mock",
49+
"types-protobuf",
4750
)
4851
session.run("mypy", "google", "tests")
4952

@@ -143,7 +146,10 @@ def docfx(session):
143146

144147
session.install("-e", ".")
145148
session.install(
146-
"sphinx==4.0.1", "alabaster", "recommonmark", "gcp-sphinx-docfx-yaml",
149+
"sphinx==4.0.1",
150+
"alabaster",
151+
"recommonmark",
152+
"gcp-sphinx-docfx-yaml",
147153
)
148154

149155
shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True)

tests/unit/test__helpers.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,9 @@ def test_success(self):
553553
out_message = self._call_fut(date_pb2.Date, in_message_any)
554554
self.assertEqual(in_message, out_message)
555555

556-
def test_failure(self,):
556+
def test_failure(
557+
self,
558+
):
557559
from google.protobuf import any_pb2
558560
from google.type import date_pb2
559561
from google.type import timeofday_pb2
@@ -636,7 +638,7 @@ def test_with_negative_microseconds(self):
636638
result = self._call_fut(timedelta_val)
637639
self.assertIsInstance(result, duration_pb2.Duration)
638640
self.assertEqual(result.seconds, seconds - 1)
639-
self.assertEqual(result.nanos, 10 ** 9 + 1000 * microseconds)
641+
self.assertEqual(result.nanos, 10**9 + 1000 * microseconds)
640642

641643
def test_with_negative_seconds(self):
642644
import datetime
@@ -648,7 +650,7 @@ def test_with_negative_seconds(self):
648650
result = self._call_fut(timedelta_val)
649651
self.assertIsInstance(result, duration_pb2.Duration)
650652
self.assertEqual(result.seconds, seconds + 1)
651-
self.assertEqual(result.nanos, -(10 ** 9 - 1000 * microseconds))
653+
self.assertEqual(result.nanos, -(10**9 - 1000 * microseconds))
652654

653655

654656
class Test__duration_pb_to_timedelta(unittest.TestCase):

tests/unit/test_client.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,8 @@ def test_ctor_defaults_wo_envvar(self):
234234
environ = {}
235235
patch_env = mock.patch("os.environ", new=environ)
236236
patch_default = mock.patch(
237-
"google.cloud.client._determine_default_project", return_value=None,
237+
"google.cloud.client._determine_default_project",
238+
return_value=None,
238239
)
239240
with patch_env:
240241
with patch_default as patched:
@@ -268,7 +269,8 @@ def test_ctor_defaults_w_legacy_envvar(self):
268269
def test_ctor_w_explicit_project(self):
269270
explicit_project = "explicit-project-456"
270271
patch_default = mock.patch(
271-
"google.cloud.client._determine_default_project", return_value=None,
272+
"google.cloud.client._determine_default_project",
273+
return_value=None,
272274
)
273275
with patch_default as patched:
274276
client = self._make_one(project=explicit_project)
@@ -280,7 +282,8 @@ def test_ctor_w_explicit_project(self):
280282
def test_ctor_w_explicit_project_bytes(self):
281283
explicit_project = b"explicit-project-456"
282284
patch_default = mock.patch(
283-
"google.cloud.client._determine_default_project", return_value=None,
285+
"google.cloud.client._determine_default_project",
286+
return_value=None,
284287
)
285288
with patch_default as patched:
286289
client = self._make_one(project=explicit_project)
@@ -292,7 +295,8 @@ def test_ctor_w_explicit_project_bytes(self):
292295
def test_ctor_w_explicit_project_invalid(self):
293296
explicit_project = object()
294297
patch_default = mock.patch(
295-
"google.cloud.client._determine_default_project", return_value=None,
298+
"google.cloud.client._determine_default_project",
299+
return_value=None,
296300
)
297301
with patch_default as patched:
298302
with self.assertRaises(ValueError):
@@ -331,7 +335,8 @@ def test_ctor_w_explicit_credentials_w_project(self):
331335
project = "credentials-project-456"
332336
credentials = self._make_credentials(project_id=project)
333337
patch_default = mock.patch(
334-
"google.cloud.client._determine_default_project", return_value=None,
338+
"google.cloud.client._determine_default_project",
339+
return_value=None,
335340
)
336341
with patch_default as patched:
337342
client = self._make_one(credentials=credentials)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy