Skip to content

Commit

Permalink
Made classes enum.IntEnums where appropriate. (#1053)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackgene authored Oct 19, 2024
1 parent 01c60cd commit 4cff9d7
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
5 changes: 3 additions & 2 deletions aiokafka/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import logging
import random
import time
from enum import IntEnum

import aiokafka.errors as Errors
from aiokafka import __version__
Expand Down Expand Up @@ -40,12 +41,12 @@
log = logging.getLogger("aiokafka")


class ConnectionGroup:
class ConnectionGroup(IntEnum):
DEFAULT = 0
COORDINATION = 1


class CoordinationType:
class CoordinationType(IntEnum):
GROUP = 0
TRANSACTION = 1

Expand Down
3 changes: 2 additions & 1 deletion aiokafka/conn.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import uuid
import warnings
import weakref
from enum import IntEnum

import async_timeout

Expand Down Expand Up @@ -45,7 +46,7 @@
SASL_QOP_AUTH = 1


class CloseReason:
class CloseReason(IntEnum):
CONNECTION_BROKEN = 0
CONNECTION_TIMEOUT = 1
OUT_OF_SYNC = 2
Expand Down
4 changes: 3 additions & 1 deletion aiokafka/metrics/stats/percentiles.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
from enum import IntEnum

from aiokafka.metrics.compound_stat import AbstractCompoundStat, NamedMeasurable
from aiokafka.metrics.measurable import AnonMeasurable

from .histogram import Histogram
from .sampled_stat import AbstractSampledStat


class BucketSizing:
class BucketSizing(IntEnum):
CONSTANT = 0
LINEAR = 1

Expand Down
4 changes: 2 additions & 2 deletions aiokafka/producer/transaction_manager.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from collections import defaultdict, deque, namedtuple
from enum import Enum
from enum import Enum, IntEnum

from aiokafka.structs import TopicPartition
from aiokafka.util import create_future
Expand All @@ -16,7 +16,7 @@ class SubscriptionType(Enum):
USER_ASSIGNED = 4


class TransactionResult:
class TransactionResult(IntEnum):
ABORT = 0
COMMIT = 1

Expand Down

0 comments on commit 4cff9d7

Please sign in to comment.