Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Made classes enum.IntEnums where appropriate. #1053

Merged
merged 1 commit into from
Oct 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading