[Yum-devel] [PATCH] updating yumRepo dump() method and adding YumConf.dump() method to output nicer lists of all of our config settings

Seth Vidal skvidal at fedoraproject.org
Thu Nov 12 20:29:31 UTC 2009



On Thu, 12 Nov 2009, James Antill wrote:

> On Thu, 2009-11-12 at 14:38 -0500, Seth Vidal wrote:
>> ---
>>  yum/config.py  |   23 +++++++++++++++++++++++
>>  yum/yumRepo.py |   36 ++++++++++++++++++++++++------------
>>  2 files changed, 47 insertions(+), 12 deletions(-)
>
> ACK. It probably doesn't really matter, but...
>
>> +        excluded_vars = ['cfg', 'uid', 'yumvar', 'progress_obj', 'failure_obj',
>> +                         'disable_excludes', 'config_file_age', 'config_file_path',
>> +                         ]
>
> If this is a tuple instead of a list, the "in" below is a bit faster,
> AIUI.
>
>> +        for attr in dir(self):
>> +            if attr.startswith('_'):
>> +                continue
>> +            if attr in excluded_vars:
>> +                continue
>> +            if isinstance(getattr(self, attr), types.MethodType):
>> +                continue
>> +            res = getattr(self, attr)
>> +            if not res:
>> +                res = ''
>> +            if type(res) == types.ListType:
>> +                res = ', '.join(res)
>
> Also may be worth doing: ',\n    '.join(res) ... or not.
>

just to make you happy.

done.
-sv



More information about the Yum-devel mailing list