Skip to content

Commit 33e6fa3

Browse files
committed
Fix lint on b/452032333
1 parent 31a5c9c commit 33e6fa3

File tree

3 files changed

+16
-12
lines changed

3 files changed

+16
-12
lines changed

samples/snippets/writes/noxfile.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ def blacken(session: nox.sessions.Session) -> None:
160160
# format = isort + black
161161
#
162162

163+
163164
@nox.session
164165
def format(session: nox.sessions.Session) -> None:
165166
"""
@@ -187,7 +188,9 @@ def _session_tests(
187188
session: nox.sessions.Session, post_install: Callable = None
188189
) -> None:
189190
# check for presence of tests
190-
test_list = glob.glob("**/*_test.py", recursive=True) + glob.glob("**/test_*.py", recursive=True)
191+
test_list = glob.glob("**/*_test.py", recursive=True) + glob.glob(
192+
"**/test_*.py", recursive=True
193+
)
191194
test_list.extend(glob.glob("**/tests", recursive=True))
192195

193196
if len(test_list) == 0:
@@ -209,9 +212,7 @@ def _session_tests(
209212

210213
if os.path.exists("requirements-test.txt"):
211214
if os.path.exists("constraints-test.txt"):
212-
session.install(
213-
"-r", "requirements-test.txt", "-c", "constraints-test.txt"
214-
)
215+
session.install("-r", "requirements-test.txt", "-c", "constraints-test.txt")
215216
else:
216217
session.install("-r", "requirements-test.txt")
217218
with open("requirements-test.txt") as rtfile:
@@ -224,9 +225,9 @@ def _session_tests(
224225
post_install(session)
225226

226227
if "pytest-parallel" in packages:
227-
concurrent_args.extend(['--workers', 'auto', '--tests-per-worker', 'auto'])
228+
concurrent_args.extend(["--workers", "auto", "--tests-per-worker", "auto"])
228229
elif "pytest-xdist" in packages:
229-
concurrent_args.extend(['-n', 'auto'])
230+
concurrent_args.extend(["-n", "auto"])
230231

231232
session.run(
232233
"pytest",
@@ -256,7 +257,7 @@ def py(session: nox.sessions.Session) -> None:
256257

257258

258259
def _get_repo_root() -> Optional[str]:
259-
""" Returns the root folder of the project. """
260+
"""Returns the root folder of the project."""
260261
# Get root of this repository. Assume we don't have directories nested deeper than 10 items.
261262
p = Path(os.getcwd())
262263
for i in range(10):

samples/snippets/writes/write_increment_async.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from google.cloud.bigtable.data.mutations import AddToCell, RowMutationEntry
44
from google.cloud.bigtable.data.exceptions import MutationsExceptionGroup
55

6+
67
async def write_increment_async(project_id, instance_id, table_id):
78
"""Increments a value in a Bigtable table using the async client."""
89
async with BigtableDataClientAsync(project=project_id) as client:
@@ -13,11 +14,11 @@ async def write_increment_async(project_id, instance_id, table_id):
1314
# The AddToCell mutation increments the value of a cell.
1415
# The value must be a positive or negative integer.
1516
reading = AddToCell(
16-
family="counters",
17-
qualifier="odometer",
18-
value=32304
17+
family="counters", qualifier="odometer", value=32304
18+
)
19+
await batcher.append(
20+
RowMutationEntry(row_key.encode("utf-8"), [reading])
1921
)
20-
await batcher.append(RowMutationEntry(row_key.encode("utf-8"), [reading]))
2122
except MutationsExceptionGroup as e:
2223
# MutationsExceptionGroup contains a FailedMutationEntryError for
2324
# each mutation that failed.
@@ -27,4 +28,6 @@ async def write_increment_async(project_id, instance_id, table_id):
2728
print(
2829
f"Failed mutation for row {failed_entry.row_key!r} with error: {cause!r}"
2930
)
31+
32+
3033
# [END bigtable_write_increment_async]

samples/snippets/writes/writes_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,4 @@ def _write_increment_async():
8080

8181
_write_increment_async()
8282
out, _ = capsys.readouterr()
83-
assert "Successfully incremented row" in out
83+
assert "Successfully incremented row" in out

0 commit comments

Comments
 (0)