From b69e6944b45ed1c59e43c7b75571777711b8a30d Mon Sep 17 00:00:00 2001 From: Munyoki Kilyungi Date: Wed, 7 Sep 2022 12:07:22 +0300 Subject: Remove redundant cursor.fetchone() * wqflask/base/data_set.py (DataSet.retrieve_other_names): Call cursor.fetchone() only once. --- wqflask/base/data_set.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py index 470aa28b..cd626526 100644 --- a/wqflask/base/data_set.py +++ b/wqflask/base/data_set.py @@ -650,18 +650,16 @@ class DataSet: "ProbeSetFreeze.FullName = %s " "OR ProbeSetFreeze.ShortName = %s)", (self.name,)*3) - (self.id, self.name, self.fullname, self.shortname, - self.data_scale, self.tissue) = cursor.fetchone() else: + self.tissue = "N/A" cursor.execute( "SELECT Id, Name, FullName, ShortName " f"FROM {self.type}Freeze " "WHERE (Name = %s OR FullName = " "%s OR ShortName = %s)", (self.name,)*3) - (self.id, self.name, self.fullname, self.shortname, - self.data_scale, self.tissue) = cursor.fetchone() - self.tissue = "N/A" + (self.id, self.name, self.fullname, self.shortname, + self.data_scale, self.tissue) = cursor.fetchone() except TypeError: pass -- cgit v1.2.3