Skip to content

Commit

Permalink
removed old code
Browse files Browse the repository at this point in the history
  • Loading branch information
rsnodgrass committed Jan 22, 2024
1 parent fed5904 commit 70f2f45
Showing 1 changed file with 5 additions and 21 deletions.
26 changes: 5 additions & 21 deletions pyavcontrol/client/base.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from __future__ import ( # postpone eval of annotations (for DeviceClient type annotation)
annotations,
)
# postpone eval of annotations (for DeviceClient type annotation)
from __future__ import annotations

import logging
from abc import ABC, abstractmethod
Expand Down Expand Up @@ -81,8 +80,8 @@ def _inject_client_api(client: DeviceClient, model: DeviceModel):
"""
api = model.definition.get(CONFIG.api, {})
for group_name, group_actions in api.items():
if getattr(type(client), group_name):
raise RuntimeError(f'Injecting "{group_name}" failed as it already exists in class')
if hasattr(type(client), group_name):
raise RuntimeError(f'Injecting "{group_name}" failed as it already exists in {type(client)}')

# LOG.debug(f'Adding property for group {group_name}')
group_class = _create_activity_group_class(
Expand Down Expand Up @@ -157,7 +156,7 @@ class DeviceClient(ABC):
"""

def __new__(cls, *args, **kwargs):
return super().__new__(cls, *args, **kwargs)
return super().__new__(cls)

def __init__(self, model: DeviceModel, connection: DeviceConnection):
super().__init__()
Expand Down Expand Up @@ -199,21 +198,6 @@ def send_raw(self, data: bytes) -> None:
"""
raise NotImplementedError()

def _command(self, model_id: str, format_code: str, args=None):
"""
Convert group/action/args into the full command string that should be sent
FIXME: is this still even used/referenced?
"""
cmd_eol = self._protocol_def.get(CONFIG.command_eol)
cmd_separator = self._protocol_def.get(CONFIG.command_separator)

rs232_commands = self._protocol_def.get('commands')
command = rs232_commands.get(format_code) + cmd_separator + cmd_eol
return command.format(**args).encode(
DEFAULT_ENCODING
) # FIXME: should be proper encoding

# @abstractmethod
def describe(self) -> dict:
return self._protocol_def
Expand Down

0 comments on commit 70f2f45

Please sign in to comment.