Skip to content

Commit 9bfd9c4

Browse files
chore(python): use black==22.3.0 (#762)
* 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 76da2ab commit 9bfd9c4

File tree

11 files changed

+83
-29
lines changed

11 files changed

+83
-29
lines changed

.github/.OwlBot.lock.yaml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
# Copyright 2022 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
114
docker:
215
image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest
3-
digest: sha256:ae600f36b6bc972b368367b6f83a1d91ec2c82a4a116b383d67d547c56fe6de3
16+
digest: sha256:7cffbc10910c3ab1b852c05114a08d374c195a81cdec1d4a67a1d129331d0bfe

django_spanner/schema.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,9 @@ def add_index(self, model, index):
401401
"index": "|".join(index.fields),
402402
}
403403
with trace_call(
404-
"CloudSpannerDjango.add_index", self.connection, trace_attributes,
404+
"CloudSpannerDjango.add_index",
405+
self.connection,
406+
trace_attributes,
405407
):
406408
super().add_index(model, index)
407409

docs/conf.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@
7676
master_doc = "index"
7777

7878
# General information about the project.
79-
project = u"google-cloud-spanner-django"
80-
copyright = u"2020, Google"
81-
author = u"Google APIs"
79+
project = "google-cloud-spanner-django"
80+
copyright = "2020, Google"
81+
author = "Google APIs"
8282

8383
# The version info for the project you're documenting, acts as replacement for
8484
# |version| and |release|, also used in various other places throughout the
@@ -278,7 +278,7 @@
278278
(
279279
master_doc,
280280
"django-google-spanner.tex",
281-
u"Spanner Django Documentation",
281+
"Spanner Django Documentation",
282282
author,
283283
"manual",
284284
)
@@ -313,7 +313,7 @@
313313
(
314314
master_doc,
315315
"django-google-spanner",
316-
u"django-google-spanner Documentation",
316+
"django-google-spanner Documentation",
317317
[author],
318318
1,
319319
)
@@ -332,7 +332,7 @@
332332
(
333333
master_doc,
334334
"django-google-spanner",
335-
u"django-google-spanner Documentation",
335+
"django-google-spanner Documentation",
336336
author,
337337
"django-google-spanner",
338338
"django-google-spanner Library",

noxfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
import nox
1717

18-
BLACK_VERSION = "black==19.10b0"
18+
BLACK_VERSION = "black==22.3.0"
1919
BLACK_PATHS = [
2020
"docs",
2121
"django_spanner",

tests/performance/django_spanner/test_benchmark.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,10 @@ def __init__(self):
8787
@measure_execution_time
8888
def insert_one_row_with_fetch_after(self):
8989
author_kent = Author(
90-
id=2, first_name="Pete", last_name="Allison", rating="2.1",
90+
id=2,
91+
first_name="Pete",
92+
last_name="Allison",
93+
rating="2.1",
9194
)
9295
author_kent.save()
9396
last_name = Author.objects.get(pk=author_kent.id).last_name

tests/system/django_spanner/test_decimal.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,16 @@ def test_insert_and_search_decimal_value(self):
5353
Tests model object creation with Author model.
5454
"""
5555
author_kent = Author(
56-
first_name="Arthur", last_name="Kent", rating=Decimal("4.1"),
56+
first_name="Arthur",
57+
last_name="Kent",
58+
rating=Decimal("4.1"),
5759
)
5860
author_kent.save()
5961
qs1 = Author.objects.filter(rating__gte=3).values("rating")
6062
self.assertValuesEqual(
61-
qs1, [Decimal("4.1")], self.rating_transform,
63+
qs1,
64+
[Decimal("4.1")],
65+
self.rating_transform,
6266
)
6367
# Delete data from Author table.
6468
Author.objects.all().delete()
@@ -94,7 +98,9 @@ def test_decimal_update(self):
9498
Tests decimal object update.
9599
"""
96100
author_kent = Author(
97-
first_name="Arthur", last_name="Kent", rating=Decimal("4.1"),
101+
first_name="Arthur",
102+
last_name="Kent",
103+
rating=Decimal("4.1"),
98104
)
99105
author_kent.save()
100106
author_kent.rating = Decimal("4.2")
@@ -103,7 +109,9 @@ def test_decimal_update(self):
103109
"rating"
104110
)
105111
self.assertValuesEqual(
106-
qs1, [Decimal("4.2")], self.rating_transform,
112+
qs1,
113+
[Decimal("4.2")],
114+
self.rating_transform,
107115
)
108116
# Delete data from Author table.
109117
Author.objects.all().delete()

tests/system/django_spanner/test_queries.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ def test_insert_and_fetch_value(self):
3939
Inserting data into the model and retrieving it.
4040
"""
4141
author_kent = Author(
42-
first_name="Arthur", last_name="Kent", rating=Decimal("4.1"),
42+
first_name="Arthur",
43+
last_name="Kent",
44+
rating=Decimal("4.1"),
4345
)
4446
author_kent.save()
4547
qs1 = Author.objects.all().values("first_name", "last_name")

tests/unit/django_spanner/test_functions.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@ def test_cot(self):
8181
"""
8282
Tests cot function on a column.
8383
"""
84-
q1 = Author.objects.values("num").annotate(num_cot=Cot("num"),)
84+
q1 = Author.objects.values("num").annotate(
85+
num_cot=Cot("num"),
86+
)
8587
compiler = SQLCompiler(q1.query, self.connection, "default")
8688
sql_query, params = compiler.query.as_sql(compiler, self.connection)
8789
self.assertEqual(
@@ -95,7 +97,9 @@ def test_degrees(self):
9597
"""
9698
Tests degrees function on a column.
9799
"""
98-
q1 = Author.objects.values("num").annotate(num_degrees=Degrees("num"),)
100+
q1 = Author.objects.values("num").annotate(
101+
num_degrees=Degrees("num"),
102+
)
99103
compiler = SQLCompiler(q1.query, self.connection, "default")
100104
sql_query, params = compiler.query.as_sql(compiler, self.connection)
101105
self.assertEqual(
@@ -188,7 +192,8 @@ def test_pi(self):
188192
+ "= (3.141592653589793)"
189193
)
190194
self.assertEqual(
191-
sql_query, expected_sql,
195+
sql_query,
196+
expected_sql,
192197
)
193198
self.assertEqual(params, ())
194199

tests/unit/django_spanner/test_introspection.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,8 @@ def run_sql_in_snapshot(*args, **kwargs):
157157
cursor=cursor, table_name="Table_1"
158158
)
159159
self.assertEqual(
160-
primary_key, "PK_column",
160+
primary_key,
161+
"PK_column",
161162
)
162163

163164
def test_get_primary_key_column_returns_none(self):
@@ -174,7 +175,9 @@ def run_sql_in_snapshot(*args, **kwargs):
174175
primary_key = db_introspection.get_primary_key_column(
175176
cursor=cursor, table_name="Table_1"
176177
)
177-
self.assertIsNone(primary_key,)
178+
self.assertIsNone(
179+
primary_key,
180+
)
178181

179182
def test_get_constraints(self):
180183
"""

tests/unit/django_spanner/test_operations.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,14 @@ def test_sql_flush(self):
4343

4444
def test_sql_flush_empty_table_list(self):
4545
self.assertEqual(
46-
self.db_operations.sql_flush(style=no_style(), tables=[]), [],
46+
self.db_operations.sql_flush(style=no_style(), tables=[]),
47+
[],
4748
)
4849

4950
def test_adapt_datefield_value(self):
5051
self.assertIsInstance(
51-
self.db_operations.adapt_datefield_value("dummy_date"), DateStr,
52+
self.db_operations.adapt_datefield_value("dummy_date"),
53+
DateStr,
5254
)
5355

5456
def test_adapt_datefield_value_none(self):
@@ -204,7 +206,8 @@ def test_combine_expression_bit_extention(self):
204206

205207
def test_combine_expression_multiply(self):
206208
self.assertEqual(
207-
self.db_operations.combine_expression("*", ["10", "2"]), "10 * 2",
209+
self.db_operations.combine_expression("*", ["10", "2"]),
210+
"10 * 2",
208211
)
209212

210213
def test_combine_duration_expression_add(self):
@@ -235,10 +238,16 @@ def test_combine_duration_expression_database_error(self):
235238

236239
def test_lookup_cast_match_lookup_type(self):
237240
self.assertEqual(
238-
self.db_operations.lookup_cast("contains",), "CAST(%s AS STRING)",
241+
self.db_operations.lookup_cast(
242+
"contains",
243+
),
244+
"CAST(%s AS STRING)",
239245
)
240246

241247
def test_lookup_cast_unmatched_lookup_type(self):
242248
self.assertEqual(
243-
self.db_operations.lookup_cast("dummy",), "%s",
249+
self.db_operations.lookup_cast(
250+
"dummy",
251+
),
252+
"%s",
244253
)

0 commit comments

Comments
 (0)