Skip to content

Commit 3698450

Browse files
mukund-ananthugcf-owl-bot[bot]parthea
authored
fix: Typecheck errors in samples/snippets/subscriber.py (#1186)
Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <partheniou@google.com>
1 parent e2576b6 commit 3698450

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

samples/snippets/mypy.ini

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,9 @@ strict = True
44
exclude = noxfile\.py
55
warn_unused_configs = True
66

7-
[mypy-avro.*,backoff,flaky]
7+
; Ignore errors caused due to missing library stubs or py.typed marker
8+
; Refer https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-library-stubs-or-py-typed-marker
9+
; Errors ignored instead of adding stubs as a workaround, since this directory contains sample code
10+
; that does not affect the functionality of the client library.
11+
[mypy-avro.*,backoff,flaky,google.cloud.*]
812
ignore_missing_imports = True

samples/snippets/subscriber.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -528,8 +528,10 @@ def update_subscription_with_dead_letter_policy(
528528
)
529529

530530
with subscriber:
531-
subscription_after_update = subscriber.update_subscription(
532-
request={"subscription": subscription, "update_mask": update_mask}
531+
subscription_after_update: gapic_types.Subscription = (
532+
subscriber.update_subscription(
533+
request={"subscription": subscription, "update_mask": update_mask}
534+
)
533535
)
534536

535537
print(f"After the update: {subscription_after_update}.")
@@ -573,8 +575,10 @@ def remove_dead_letter_policy(
573575
)
574576

575577
with subscriber:
576-
subscription_after_update = subscriber.update_subscription(
577-
request={"subscription": subscription, "update_mask": update_mask}
578+
subscription_after_update: gapic_types.Subscription = (
579+
subscriber.update_subscription(
580+
request={"subscription": subscription, "update_mask": update_mask}
581+
)
578582
)
579583

580584
print(f"After removing the policy: {subscription_after_update}.")

0 commit comments

Comments
 (0)