Skip to content

Commit

Permalink
fixed mypy issues
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-sanche committed Oct 16, 2023
1 parent dc596df commit 5bbae6c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions google/cloud/bigtable/data/_async/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -951,12 +951,11 @@ async def mutate_row(
)
_validate_timeouts(operation_timeout, attempt_timeout)

if mutations and not isinstance(mutations, list):
mutations = [mutations]
if not mutations:
mutations_list = mutations if isinstance(mutations, list) else [mutations]
if not mutations_list:
raise ValueError("No mutations provided")

if all(mutation.is_idempotent() for mutation in mutations):
if all(mutation.is_idempotent() for mutation in mutations_list):
# mutations are all idempotent and safe to retry
predicate = retries.if_exception_type(
core_exceptions.DeadlineExceeded,
Expand Down Expand Up @@ -990,7 +989,7 @@ def on_error_fn(exc):
# trigger rpc
await deadline_wrapped(
row_key=row_key.encode("utf-8") if isinstance(row_key, str) else row_key,
mutations=[mutation._to_pb() for mutation in mutations],
mutations=[mutation._to_pb() for mutation in mutations_list],
table_name=self.table_name,
app_profile_id=self.app_profile_id,
timeout=attempt_timeout,
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/bigtable/data/read_modify_write_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def __init__(self, family: str, qualifier: bytes | str, append_value: bytes | st
super().__init__(family, qualifier)
self.append_value = append_value

def _to_dict(self) -> dict[str, str | bytes]:
def _to_dict(self) -> dict[str, str | bytes | int]:
return {
"family_name": self.family,
"column_qualifier": self.qualifier,
Expand Down

0 comments on commit 5bbae6c

Please sign in to comment.