Cleanup
This commit is contained in:
@@ -128,7 +128,7 @@ class Version(str, Enum):
|
||||
|
||||
|
||||
class AlpineBitsClientInfo:
|
||||
"""Wrapper for username, password, client_id"""
|
||||
"""Wrapper for username, password, client_id."""
|
||||
|
||||
def __init__(self, username: str, password: str, client_id: str | None = None):
|
||||
self.username = username
|
||||
@@ -212,7 +212,7 @@ class ServerCapabilities:
|
||||
"""Discover all AlpineBitsAction implementations in the current module."""
|
||||
current_module = inspect.getmodule(self)
|
||||
|
||||
for name, obj in inspect.getmembers(current_module):
|
||||
for _name, obj in inspect.getmembers(current_module):
|
||||
if (
|
||||
inspect.isclass(obj)
|
||||
and issubclass(obj, AlpineBitsAction)
|
||||
@@ -230,9 +230,7 @@ class ServerCapabilities:
|
||||
This is a simple check - in practice, you might want more sophisticated detection.
|
||||
"""
|
||||
# Check if the class has overridden the handle method
|
||||
if "handle" in action_class.__dict__:
|
||||
return True
|
||||
return False
|
||||
return "handle" in action_class.__dict__
|
||||
|
||||
def create_capabilities_dict(self) -> None:
|
||||
"""Generate the capabilities dictionary based on discovered actions."""
|
||||
@@ -636,7 +634,7 @@ class NotifReportReadAction(AlpineBitsAction):
|
||||
|
||||
|
||||
class PushAction(AlpineBitsAction):
|
||||
"""Creates the necessary xml for OTA_HotelResNotif:GuestRequests"""
|
||||
"""Creates the necessary xml for OTA_HotelResNotif:GuestRequests."""
|
||||
|
||||
def __init__(self, config: dict = {}):
|
||||
self.name = AlpineBitsActionName.OTA_HOTEL_RES_NOTIF_GUEST_REQUESTS
|
||||
@@ -676,7 +674,7 @@ class AlpineBitsServer:
|
||||
their capabilities, and can respond to handshake requests with its capabilities.
|
||||
"""
|
||||
|
||||
def __init__(self, config: dict = None):
|
||||
def __init__(self, config: dict | None = None):
|
||||
self.capabilities = ServerCapabilities()
|
||||
self._action_instances = {}
|
||||
self.config = config
|
||||
@@ -782,7 +780,6 @@ class AlpineBitsServer:
|
||||
client_info=client_info,
|
||||
)
|
||||
except Exception as e:
|
||||
print(f"Error handling request {request_action_name}: {e!s}")
|
||||
# print stack trace for debugging
|
||||
import traceback
|
||||
|
||||
@@ -795,7 +792,7 @@ class AlpineBitsServer:
|
||||
def get_supported_request_names(self) -> list[str]:
|
||||
"""Get all supported request names (not capability names)."""
|
||||
request_names = []
|
||||
for capability_name in self._action_instances.keys():
|
||||
for capability_name in self._action_instances:
|
||||
action_enum = AlpineBitsActionName.get_by_capability_name(capability_name)
|
||||
if action_enum:
|
||||
request_names.append(action_enum.request_name)
|
||||
|
||||
Reference in New Issue
Block a user