@@ -354,12 +354,13 @@ def _convert_new_topic_request(new_topic):
354
354
]
355
355
)
356
356
357
- def create_topics (self , new_topics , timeout_ms = None , validate_only = None ):
357
+ def create_topics (self , new_topics , timeout_ms = None , validate_only = False ):
358
358
"""Create new topics in the cluster.
359
359
360
360
:param new_topics: Array of NewTopic objects
361
361
:param timeout_ms: Milliseconds to wait for new topics to be created before broker returns
362
- :param validate_only: If True, don't actually create new topics. Not supported by all versions.
362
+ :param validate_only: If True, don't actually create new topics.
363
+ Not supported by all versions. Default: False
363
364
:return: Appropriate version of CreateTopicResponse class
364
365
"""
365
366
version = self ._matching_api_version (CreateTopicsRequest )
@@ -374,7 +375,6 @@ def create_topics(self, new_topics, timeout_ms=None, validate_only=None):
374
375
timeout = timeout_ms
375
376
)
376
377
elif version <= 2 :
377
- validate_only = validate_only or False
378
378
request = CreateTopicsRequest [version ](
379
379
create_topic_requests = [self ._convert_new_topic_request (new_topic ) for new_topic in new_topics ],
380
380
timeout = timeout_ms ,
@@ -434,13 +434,14 @@ def _convert_describe_config_resource_request(config_resource):
434
434
] if config_resource .configs else None
435
435
)
436
436
437
- def describe_configs (self , config_resources , include_synonyms = None ):
437
+ def describe_configs (self , config_resources , include_synonyms = False ):
438
438
"""Fetch configuration parameters for one or more kafka resources.
439
439
440
440
:param config_resources: An array of ConfigResource objects.
441
441
Any keys in ConfigResource.configs dict will be used to filter the result. The configs dict should be None
442
442
to get all values. An empty dict will get zero values (as per kafka protocol).
443
- :param include_synonyms: If True, return synonyms in response. Not supported by all versions.
443
+ :param include_synonyms: If True, return synonyms in response. Not
444
+ supported by all versions. Default: False.
444
445
:return: Appropriate version of DescribeConfigsResponse class
445
446
"""
446
447
version = self ._matching_api_version (DescribeConfigsRequest )
@@ -453,7 +454,6 @@ def describe_configs(self, config_resources, include_synonyms=None):
453
454
resources = [self ._convert_describe_config_resource_request (config_resource ) for config_resource in config_resources ]
454
455
)
455
456
elif version <= 1 :
456
- include_synonyms = include_synonyms or False
457
457
request = DescribeConfigsRequest [version ](
458
458
resources = [self ._convert_describe_config_resource_request (config_resource ) for config_resource in config_resources ],
459
459
include_synonyms = include_synonyms
@@ -519,17 +519,17 @@ def _convert_create_partitions_request(topic_name, new_partitions):
519
519
)
520
520
)
521
521
522
- def create_partitions (self , topic_partitions , timeout_ms = None , validate_only = None ):
522
+ def create_partitions (self , topic_partitions , timeout_ms = None , validate_only = False ):
523
523
"""Create additional partitions for an existing topic.
524
524
525
525
:param topic_partitions: A map of topic name strings to NewPartition objects
526
526
:param timeout_ms: Milliseconds to wait for new partitions to be created before broker returns
527
527
:param validate_only: If True, don't actually create new partitions.
528
+ Default: False
528
529
:return: Appropriate version of CreatePartitionsResponse class
529
530
"""
530
531
version = self ._matching_api_version (CreatePartitionsRequest )
531
532
timeout_ms = self ._validate_timeout (timeout_ms )
532
- validate_only = validate_only or False
533
533
if version == 0 :
534
534
request = CreatePartitionsRequest [version ](
535
535
topic_partitions = [self ._convert_create_partitions_request (topic_name , new_partitions ) for topic_name , new_partitions in topic_partitions .items ()],
0 commit comments