From 464b26e42bee5cbade7b0df0b93aea7d26078a92 Mon Sep 17 00:00:00 2001 From: "Bryn M. Reeves" Date: Sun, 27 May 2018 09:10:12 +0100 Subject: [sos] replace hard-coded format tuple with list comprehension Instead of hard-coding a tuple for every member of SoSOptions (% (self.foo, self.bar, ...)), use a list comprehension on the existing _arg_names list to obtain the attribute values via getattr(). This avoids the need to maintain the tuple manually as options are added or removed. Signed-off-by: Bryn M. Reeves --- sos/__init__.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/sos/__init__.py b/sos/__init__.py index 96e77414..ff3153aa 100644 --- a/sos/__init__.py +++ b/sos/__init__.py @@ -112,14 +112,7 @@ class SoSOptions(object): fmt += arg + arg_fmt + sep fmt.strip(sep) fmt += suffix - return fmt % (self.all_logs, self.batch, self.build, self.case_id, - self.chroot, self.compression_type, self.config_file, - self.debug, self.enableplugins, self.experimental, - self.label, self.list_plugins, self.list_profiles, - self.log_size, self.noplugins, self.noreport, - self.onlyplugins, self.plugopts, self.preset, - self.profiles, self.quiet, self.sysroot, self.tmp_dir, - self.usealloptions, self.verbosity, self.verify) + return fmt % tuple([getattr(self, arg) for arg in _arg_names]) def __str__(self): return self.__str() -- cgit