@@ -299,12 +299,13 @@ def _convert_new_topic_request(new_topic):
299
299
]
300
300
)
301
301
302
- def create_topics (self , new_topics , timeout_ms = None , validate_only = None ):
302
+ def create_topics (self , new_topics , timeout_ms = None , validate_only = False ):
303
303
"""Create new topics in the cluster.
304
304
305
305
:param new_topics: Array of NewTopic objects
306
306
:param timeout_ms: Milliseconds to wait for new topics to be created before broker returns
307
- :param validate_only: If True, don't actually create new topics. Not supported by all versions.
307
+ :param validate_only: If True, don't actually create new topics.
308
+ Not supported by all versions. Default: False
308
309
:return: Appropriate version of CreateTopicResponse class
309
310
"""
310
311
version = self ._matching_api_version (CreateTopicsRequest )
@@ -319,7 +320,6 @@ def create_topics(self, new_topics, timeout_ms=None, validate_only=None):
319
320
timeout = timeout_ms
320
321
)
321
322
elif version <= 2 :
322
- validate_only = validate_only or False
323
323
request = CreateTopicsRequest [version ](
324
324
create_topic_requests = [self ._convert_new_topic_request (new_topic ) for new_topic in new_topics ],
325
325
timeout = timeout_ms ,
@@ -374,13 +374,14 @@ def _convert_describe_config_resource_request(config_resource):
374
374
] if config_resource .configs else None
375
375
)
376
376
377
- def describe_configs (self , config_resources , include_synonyms = None ):
377
+ def describe_configs (self , config_resources , include_synonyms = False ):
378
378
"""Fetch configuration parameters for one or more kafka resources.
379
379
380
380
:param config_resources: An array of ConfigResource objects.
381
381
Any keys in ConfigResource.configs dict will be used to filter the result. The configs dict should be None
382
382
to get all values. An empty dict will get zero values (as per kafka protocol).
383
- :param include_synonyms: If True, return synonyms in response. Not supported by all versions.
383
+ :param include_synonyms: If True, return synonyms in response. Not
384
+ supported by all versions. Default: False.
384
385
:return: Appropriate version of DescribeConfigsResponse class
385
386
"""
386
387
version = self ._matching_api_version (DescribeConfigsRequest )
@@ -393,7 +394,6 @@ def describe_configs(self, config_resources, include_synonyms=None):
393
394
resources = [self ._convert_describe_config_resource_request (config_resource ) for config_resource in config_resources ]
394
395
)
395
396
elif version <= 1 :
396
- include_synonyms = include_synonyms or False
397
397
request = DescribeConfigsRequest [version ](
398
398
resources = [self ._convert_describe_config_resource_request (config_resource ) for config_resource in config_resources ],
399
399
include_synonyms = include_synonyms
@@ -445,17 +445,17 @@ def _convert_create_partitions_request(topic_name, new_partitions):
445
445
)
446
446
)
447
447
448
- def create_partitions (self , topic_partitions , timeout_ms = None , validate_only = None ):
448
+ def create_partitions (self , topic_partitions , timeout_ms = None , validate_only = False ):
449
449
"""Create additional partitions for an existing topic.
450
450
451
451
:param topic_partitions: A map of topic name strings to NewPartition objects
452
452
:param timeout_ms: Milliseconds to wait for new partitions to be created before broker returns
453
453
:param validate_only: If True, don't actually create new partitions.
454
+ Default: False
454
455
:return: Appropriate version of CreatePartitionsResponse class
455
456
"""
456
457
version = self ._matching_api_version (CreatePartitionsRequest )
457
458
timeout_ms = self ._validate_timeout (timeout_ms )
458
- validate_only = validate_only or False
459
459
if version == 0 :
460
460
request = CreatePartitionsRequest [version ](
461
461
topic_partitions = [self ._convert_create_partitions_request (topic_name , new_partitions ) for topic_name , new_partitions in topic_partitions .items ()],
0 commit comments