From 60bed532f94b7542f5f631de8306d8ca239491b9 Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Mon, 25 Nov 2024 15:14:50 +1100 Subject: [PATCH] Switch connection_manager.CONNECTION_STATE to Enum Since the earliest version of Python we support is now Python 3.6, we can use an enum.Enum for CONNECTION_STATE, rather than a dict. This should result in no behaviour changes. --- jellyfin_apiclient_python/connection_manager.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/jellyfin_apiclient_python/connection_manager.py b/jellyfin_apiclient_python/connection_manager.py index 1df32dd..79ce11d 100644 --- a/jellyfin_apiclient_python/connection_manager.py +++ b/jellyfin_apiclient_python/connection_manager.py @@ -6,6 +6,7 @@ import logging import socket from datetime import datetime +from enum import Enum from operator import itemgetter import urllib3 @@ -18,12 +19,11 @@ ################################################################################################# LOG = logging.getLogger('JELLYFIN.' + __name__) -CONNECTION_STATE = { - 'Unavailable': 0, - 'ServerSelection': 1, - 'ServerSignIn': 2, - 'SignedIn': 3 -} +class CONNECTION_STATE(Enum): + Unavailable = 0 + ServerSelection = 1 + ServerSignIn = 2 + SignedIn = 3 #################################################################################################