@@ -364,12 +364,13 @@ def _convert_new_topic_request(new_topic):
364
364
]
365
365
)
366
366
367
- def create_topics (self , new_topics , timeout_ms = None , validate_only = None ):
367
+ def create_topics (self , new_topics , timeout_ms = None , validate_only = False ):
368
368
"""Create new topics in the cluster.
369
369
370
370
:param new_topics: Array of NewTopic objects
371
371
:param timeout_ms: Milliseconds to wait for new topics to be created before broker returns
372
- :param validate_only: If True, don't actually create new topics. Not supported by all versions.
372
+ :param validate_only: If True, don't actually create new topics.
373
+ Not supported by all versions. Default: False
373
374
:return: Appropriate version of CreateTopicResponse class
374
375
"""
375
376
version = self ._matching_api_version (CreateTopicsRequest )
@@ -384,7 +385,6 @@ def create_topics(self, new_topics, timeout_ms=None, validate_only=None):
384
385
timeout = timeout_ms
385
386
)
386
387
elif version <= 2 :
387
- validate_only = validate_only or False
388
388
request = CreateTopicsRequest [version ](
389
389
create_topic_requests = [self ._convert_new_topic_request (new_topic ) for new_topic in new_topics ],
390
390
timeout = timeout_ms ,
@@ -444,13 +444,14 @@ def _convert_describe_config_resource_request(config_resource):
444
444
] if config_resource .configs else None
445
445
)
446
446
447
- def describe_configs (self , config_resources , include_synonyms = None ):
447
+ def describe_configs (self , config_resources , include_synonyms = False ):
448
448
"""Fetch configuration parameters for one or more kafka resources.
449
449
450
450
:param config_resources: An array of ConfigResource objects.
451
451
Any keys in ConfigResource.configs dict will be used to filter the result. The configs dict should be None
452
452
to get all values. An empty dict will get zero values (as per kafka protocol).
453
- :param include_synonyms: If True, return synonyms in response. Not supported by all versions.
453
+ :param include_synonyms: If True, return synonyms in response. Not
454
+ supported by all versions. Default: False.
454
455
:return: Appropriate version of DescribeConfigsResponse class
455
456
"""
456
457
version = self ._matching_api_version (DescribeConfigsRequest )
@@ -463,7 +464,6 @@ def describe_configs(self, config_resources, include_synonyms=None):
463
464
resources = [self ._convert_describe_config_resource_request (config_resource ) for config_resource in config_resources ]
464
465
)
465
466
elif version <= 1 :
466
- include_synonyms = include_synonyms or False
467
467
request = DescribeConfigsRequest [version ](
468
468
resources = [self ._convert_describe_config_resource_request (config_resource ) for config_resource in config_resources ],
469
469
include_synonyms = include_synonyms
@@ -529,17 +529,17 @@ def _convert_create_partitions_request(topic_name, new_partitions):
529
529
)
530
530
)
531
531
532
- def create_partitions (self , topic_partitions , timeout_ms = None , validate_only = None ):
532
+ def create_partitions (self , topic_partitions , timeout_ms = None , validate_only = False ):
533
533
"""Create additional partitions for an existing topic.
534
534
535
535
:param topic_partitions: A map of topic name strings to NewPartition objects
536
536
:param timeout_ms: Milliseconds to wait for new partitions to be created before broker returns
537
537
:param validate_only: If True, don't actually create new partitions.
538
+ Default: False
538
539
:return: Appropriate version of CreatePartitionsResponse class
539
540
"""
540
541
version = self ._matching_api_version (CreatePartitionsRequest )
541
542
timeout_ms = self ._validate_timeout (timeout_ms )
542
- validate_only = validate_only or False
543
543
if version == 0 :
544
544
request = CreatePartitionsRequest [version ](
545
545
topic_partitions = [self ._convert_create_partitions_request (topic_name , new_partitions ) for topic_name , new_partitions in topic_partitions .items ()],
0 commit comments