Skip to content

Commit

Permalink
Use hardcoded list of CallbackAPIVersions
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesParrott committed Oct 29, 2024
1 parent f75f818 commit 2b6934c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/paho/mqtt/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,7 @@ def __init__(
raise ValueError(
"Unsupported callback API version: version 2.0 added a callback_api_version, see docs/migrations.rst for details"
)
if self._callback_api_version not in CallbackAPIVersion:
if self._callback_api_version not in [CallbackAPIVersion.VERSION1, CallbackAPIVersion.VERSION2]:
raise ValueError("Unsupported callback API version")

self._clean_start: int = MQTT_CLEAN_START_FIRST_ONLY
Expand Down
2 changes: 1 addition & 1 deletion src/paho/mqtt/enums.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
try:
import enum
except ImportError:
from . import simpler_enum as enum
import .simpler_enum as enum

class MQTTErrorCode(enum.IntEnum):
MQTT_ERR_AGAIN = -1
Expand Down
7 changes: 4 additions & 3 deletions src/paho/mqtt/simpler_enum.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@

class IntEnum:
class SimplerEnum:
pass

class Enum:
class Enum(SimplerEnum):
pass

IntEnum = Enum

class _Auto:
def __init__(self):
self._i = -1
Expand Down

0 comments on commit 2b6934c

Please sign in to comment.