From 3e8f6d6418e6a66f6d133abeae6424bf96b6dad1 Mon Sep 17 00:00:00 2001 From: thijs snijder <snijder@astron.nl> Date: Tue, 29 Mar 2022 15:03:46 +0200 Subject: [PATCH] removed blank lines and old class --- .../clients/snmp_client.py | 29 +------------------ .../devices/snmp_device.py | 1 + .../test/clients/test_snmp_client.py | 5 +--- 3 files changed, 3 insertions(+), 32 deletions(-) diff --git a/tangostationcontrol/tangostationcontrol/clients/snmp_client.py b/tangostationcontrol/tangostationcontrol/clients/snmp_client.py index 4826bbe59..aac0e603f 100644 --- a/tangostationcontrol/tangostationcontrol/clients/snmp_client.py +++ b/tangostationcontrol/tangostationcontrol/clients/snmp_client.py @@ -111,34 +111,7 @@ class SNMP_client(CommClient): def load_mib(mib_name): mibBuilder = builder.MibBuilder() mibBuilder.loadModule(mib_name) - - -class annotation_wrapper: - def __init__(self, annotation): - """ - The SNMP client uses a dict and takes the following keys: - mib: the mib name - name: name of the value to read - index (optional) the index if the value thats being read from is a table. - """ - - # values start as None - self.mib = None - self.name = None - self.idx = None - - - # check if the 'mib' and 'name' keys are present - if 'mib' in annotation and 'name' in annotation: - self.mib = annotation["mib"] - self.name = annotation["name"] - - # SNMP has tables that require an index number to access them. regular non-table variable have an index of 0 - self.idx = annotation.get('index', 0) - - else: - raise ValueError(f"SNMP attribute annotation requires a dict argument with both a 'name' and 'mib' key. Instead got: {annotation}") - + class snmp_attribute: diff --git a/tangostationcontrol/tangostationcontrol/devices/snmp_device.py b/tangostationcontrol/tangostationcontrol/devices/snmp_device.py index cf079b63d..9905eec3c 100644 --- a/tangostationcontrol/tangostationcontrol/devices/snmp_device.py +++ b/tangostationcontrol/tangostationcontrol/devices/snmp_device.py @@ -157,3 +157,4 @@ def main(args=None, **kwargs): configure_logger() return run((SNMP,), args=args, **kwargs) + diff --git a/tangostationcontrol/tangostationcontrol/test/clients/test_snmp_client.py b/tangostationcontrol/tangostationcontrol/test/clients/test_snmp_client.py index 1e7854bf2..48ea5a88d 100644 --- a/tangostationcontrol/tangostationcontrol/test/clients/test_snmp_client.py +++ b/tangostationcontrol/tangostationcontrol/test/clients/test_snmp_client.py @@ -5,7 +5,7 @@ from unittest import mock from tangostationcontrol.test import base -from tangostationcontrol.clients.snmp_client import SNMP_client, snmp_attribute, annotation_wrapper +from tangostationcontrol.clients.snmp_client import SNMP_client, snmp_attribute class server_imitator: @@ -165,6 +165,3 @@ class TestSNMP(base.TestCase): checkval = server.val_check(i, server.dim_list[j]) self.assertEqual(checkval, res_lst, f"Expected: {checkval}, got: {res_lst}") - - - -- GitLab