diff options
author | Bryn M. Reeves <bmr@redhat.com> | 2018-05-27 09:10:12 +0100 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2018-06-20 18:01:21 +0100 |
commit | 464b26e42bee5cbade7b0df0b93aea7d26078a92 (patch) | |
tree | e3c2c92ac0cfaa30cb81254440e01dc8d1b854d1 | |
parent | 5ebe80605ead91b448a4731881d618ed334c6e77 (diff) | |
download | sos-464b26e42bee5cbade7b0df0b93aea7d26078a92.tar.gz |
[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 <bmr@redhat.com>
-rw-r--r-- | sos/__init__.py | 9 |
1 files changed, 1 insertions, 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() |