From d1727cf7432f49c7da81dab36b51277be772dd01 Mon Sep 17 00:00:00 2001 From: Yunze Xu Date: Thu, 21 Mar 2024 13:18:00 +0800 Subject: [PATCH] Fix incorrect type hints in Client (#204) Fixes https://github.com/apache/pulsar-client-python/issues/188 --- pulsar/__init__.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pulsar/__init__.py b/pulsar/__init__.py index 99b225f..a46c209 100644 --- a/pulsar/__init__.py +++ b/pulsar/__init__.py @@ -43,7 +43,7 @@ """ import logging -from typing import List, Tuple, Optional +from typing import List, Tuple, Optional, Union import _pulsar @@ -627,7 +627,7 @@ def create_producer(self, topic, properties=None, batching_type: BatchingType = BatchingType.Default, encryption_key=None, - crypto_key_reader: CryptoKeyReader = None, + crypto_key_reader: Union[None, CryptoKeyReader] = None, access_mode: ProducerAccessMode = ProducerAccessMode.Shared, ): """ @@ -804,7 +804,7 @@ def subscribe(self, topic, subscription_name, properties=None, pattern_auto_discovery_period=60, initial_position: InitialPosition = InitialPosition.Latest, - crypto_key_reader: CryptoKeyReader = None, + crypto_key_reader: Union[None, CryptoKeyReader] = None, replicate_subscription_state_enabled=False, max_pending_chunked_message=10, auto_ack_oldest_chunked_message_on_queue_full=False, @@ -813,7 +813,7 @@ def subscribe(self, topic, subscription_name, key_shared_policy=None, batch_index_ack_enabled=False, regex_subscription_mode: RegexSubscriptionMode = RegexSubscriptionMode.PersistentOnly, - dead_letter_policy: ConsumerDeadLetterPolicy = None, + dead_letter_policy: Union[None, ConsumerDeadLetterPolicy] = None, ): """ Subscribe to the given topic and subscription combination. @@ -1005,7 +1005,7 @@ def create_reader(self, topic, start_message_id, reader_name=None, subscription_role_prefix=None, is_read_compacted=False, - crypto_key_reader: CryptoKeyReader = None, + crypto_key_reader: Union[None, CryptoKeyReader] = None, start_message_id_inclusive=False ): """