From 4afe27590540740718b87500ad731c70b13a9f4f Mon Sep 17 00:00:00 2001 From: thijs snijder <snijder@astron.nl> Date: Fri, 7 May 2021 15:20:56 +0200 Subject: [PATCH] finished processing feedback --- devices/clients/ini_client.py | 18 +++++++++--------- devices/ini_device.py | 16 ---------------- 2 files changed, 9 insertions(+), 25 deletions(-) diff --git a/devices/clients/ini_client.py b/devices/clients/ini_client.py index 18500fdec..2f4d714b5 100644 --- a/devices/clients/ini_client.py +++ b/devices/clients/ini_client.py @@ -58,7 +58,7 @@ class ini_client(CommClient): self.config_file = open(self.filename, "r") self.connected = True # set connected to true - return True # if succesfull, return true. otherwise return false + return True # if successful, return true. otherwise return false def disconnect(self): self.connected = False # always force a reconnect, regardless of a successful disconnect @@ -73,16 +73,21 @@ class ini_client(CommClient): example annotation may include: - a file path and file line/location - COM object path + + Annotations: + name: Required, the name of the ini variable + section: Required, the section of the ini variable + """ # as this is an example, just print the annotation self.streams.debug_stream("annotation: {}".format(annotation)) name = annotation.get('name') if name is None: - AssertionError("ini client requires a variable name to set/get") + ValueError("ini client requires a variable `name` in the annotation to set/get") section = annotation.get('section') if section is None: - AssertionError("requires a section to open") + ValueError("requires a `section` specified in the annotation to open") return section, name @@ -120,13 +125,8 @@ class ini_client(CommClient): def write_function(value): if type(value) is list: - write_value = "" - - for i in value: - write_value = write_value + str(value) + ", " + write_value = ", ".join([str(v) for v in value]) - # strip the extra ", " at the end - write_value = write_value[:-2] else: write_value = str(value) diff --git a/devices/ini_device.py b/devices/ini_device.py index 19e6b3892..0b8161183 100644 --- a/devices/ini_device.py +++ b/devices/ini_device.py @@ -96,22 +96,6 @@ class ini_device(hardware_device): str_image_RW = attribute_wrapper(comms_annotation={"section": "image", "name": "str_image_RW"}, datatype=numpy.str_, dims=(3, 2), access=AttrWriteType.READ_WRITE) str_image_R = attribute_wrapper(comms_annotation={"section": "image", "name": "str_image_R"}, datatype=numpy.str_, dims=(3, 2)) - def always_executed_hook(self): - """Method always executed before any TANGO command is executed.""" - pass - - def delete_device(self): - """Hook to delete resources allocated in init_device. - - This method allows for any memory or other resources allocated in the - init_device method to be released. This method is called by the device - destructor and by the device Init command (a Tango built-in). - """ - self.debug_stream("Shutting down...") - - self.Off() - self.debug_stream("Shut down. Good bye.") - # -------- # overloaded functions # -------- -- GitLab