Skip to content

Commit bd9120d

Browse files
committed
type correction
1 parent b85c6e3 commit bd9120d

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

examples/adminapi.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
TopicCollection, IsolationLevel,
2323
ConsumerGroupType, ElectionType)
2424
from confluent_kafka.admin import (AdminClient, NewTopic, NewPartitions, ConfigResource,
25-
ConfigEntry, ConfigSource, AclBinding,
25+
ConfigEntry, ConfigSource, ConfigType, AclBinding,
2626
AclBindingFilter, ResourceType, ResourcePatternType,
2727
AclOperation, AclPermissionType, AlterConfigOpType,
2828
ScramMechanism, ScramCredentialInfo,
@@ -103,13 +103,13 @@ def example_create_partitions(a, topics):
103103

104104

105105
def print_config(config, depth):
106-
print('%40s = %-50s [%s,is:read-only=%r,default=%r,sensitive=%r,synonym=%r,synonyms=%s,type=%r, documentation=%s]' %
106+
print('%40s = %-50s [%s,is:read-only=%r,default=%r,sensitive=%r,synonym=%r,synonyms=%s,type=%s, documentation=%s]' %
107107
((' ' * depth) + config.name, config.value, ConfigSource(config.source),
108108
config.is_read_only, config.is_default,
109109
config.is_sensitive, config.is_synonym,
110110
["%s:%s" % (x.name, ConfigSource(x.source))
111111
for x in iter(config.synonyms.values())],
112-
config.type, config.documentation))
112+
ConfigType(config.type), config.documentation))
113113

114114

115115
def example_describe_configs(a, args):

src/confluent_kafka/admin/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
# Unused imports are keeped to be accessible using this public module
2222
from ._config import (ConfigSource, # noqa: F401
23+
ConfigType,
2324
ConfigEntry,
2425
ConfigResource,
2526
AlterConfigOpType)

src/confluent_kafka/admin/_config.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import functools
1717
from .. import cimpl as _cimpl
1818
from ._resource import ResourceType
19+
from .._util import ConversionUtil
1920

2021

2122
class AlterConfigOpType(Enum):
@@ -121,7 +122,7 @@ def __init__(self, name, value,
121122
"""Indicates whether the configuration property is a synonym for the parent configuration entry."""
122123
self.synonyms = synonyms
123124
"""A list of synonyms (ConfigEntry) and alternate sources for this configuration property."""
124-
self.type = type
125+
self.type = ConversionUtil.convert_to_enum(type, ConfigType)
125126
"""The type of the configuration property."""
126127
self.documentation = documentation
127128
"""The documentation for the configuration property."""

0 commit comments

Comments
 (0)