From 3698450041cb4db0e2957832c24450f674b89c11 Mon Sep 17 00:00:00 2001 From: mukund-ananthu <83691193+mukund-ananthu@users.noreply.github.com> Date: Fri, 7 Jun 2024 16:10:19 -0400 Subject: [PATCH] fix: Typecheck errors in samples/snippets/subscriber.py (#1186) Co-authored-by: Owl Bot Co-authored-by: Anthonios Partheniou --- samples/snippets/mypy.ini | 6 +++++- samples/snippets/subscriber.py | 12 ++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/samples/snippets/mypy.ini b/samples/snippets/mypy.ini index 8f2bae69a..3c8dd6f41 100644 --- a/samples/snippets/mypy.ini +++ b/samples/snippets/mypy.ini @@ -4,5 +4,9 @@ strict = True exclude = noxfile\.py warn_unused_configs = True -[mypy-avro.*,backoff,flaky] +; Ignore errors caused due to missing library stubs or py.typed marker +; Refer https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-library-stubs-or-py-typed-marker +; Errors ignored instead of adding stubs as a workaround, since this directory contains sample code +; that does not affect the functionality of the client library. +[mypy-avro.*,backoff,flaky,google.cloud.*] ignore_missing_imports = True diff --git a/samples/snippets/subscriber.py b/samples/snippets/subscriber.py index ab0c8aafa..2cd03b785 100644 --- a/samples/snippets/subscriber.py +++ b/samples/snippets/subscriber.py @@ -528,8 +528,10 @@ def update_subscription_with_dead_letter_policy( ) with subscriber: - subscription_after_update = subscriber.update_subscription( - request={"subscription": subscription, "update_mask": update_mask} + subscription_after_update: gapic_types.Subscription = ( + subscriber.update_subscription( + request={"subscription": subscription, "update_mask": update_mask} + ) ) print(f"After the update: {subscription_after_update}.") @@ -573,8 +575,10 @@ def remove_dead_letter_policy( ) with subscriber: - subscription_after_update = subscriber.update_subscription( - request={"subscription": subscription, "update_mask": update_mask} + subscription_after_update: gapic_types.Subscription = ( + subscriber.update_subscription( + request={"subscription": subscription, "update_mask": update_mask} + ) ) print(f"After removing the policy: {subscription_after_update}.")