Skip to content

Commit 1043228

Browse files
committed
Minor fix
1 parent d0d8500 commit 1043228

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

src/confluent_kafka/_model/__init__.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
from enum import Enum, IntEnum
15+
from enum import Enum
1616
from typing import List, Optional
1717

1818
from .. import cimpl
@@ -195,12 +195,13 @@ def __lt__(self, other: object) -> bool:
195195
return self.value < other.value
196196

197197

198-
class AcknowledgeType(IntEnum):
198+
class AcknowledgeType(Enum):
199199
"""
200-
Share Consumer acknowledgement type.
201-
202-
Used to tell the broker how to
200+
Share Consumer acknowledgement type — used to tell the broker how to
203201
handle a polled message in explicit acknowledgement mode.
202+
203+
Values:
204+
-------
204205
"""
205206

206207
#: Record was processed successfully — broker will not redeliver it.
@@ -209,3 +210,8 @@ class AcknowledgeType(IntEnum):
209210
RELEASE = 2
210211
#: Permanently failed — do NOT redeliver (poison pill).
211212
REJECT = 3
213+
214+
def __index__(self) -> int:
215+
# Allow passing AcknowledgeType.ACCEPT directly where an int is
216+
# expected (e.g., PyArg_ParseTupleAndKeywords "i" format).
217+
return self.value

0 commit comments

Comments
 (0)