commit: fe5154cbe5300ac7f20bc6bba57dca14e6114d02
Author: Gilles Dartiguelongue <eva <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 27 23:02:28 2017 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Feb 26 20:07:50 2017 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=fe5154cb
emaint logs: remove excessive kwargs tests
Testing kwargs not being empty just makes code look more
complicated than necessary.
pym/portage/emaint/modules/logs/logs.py | 26 ++++++++++++--------------
1 file changed, 12 insertions(+), 14 deletions(-)
diff --git a/pym/portage/emaint/modules/logs/logs.py
b/pym/portage/emaint/modules/logs/logs.py
index 631aeefe0..dfe0ef0a4 100644
--- a/pym/portage/emaint/modules/logs/logs.py
+++ b/pym/portage/emaint/modules/logs/logs.py
@@ -28,10 +28,9 @@ class CleanLogs(object):
def check(self, **kwargs):
- if kwargs:
- options = kwargs.get('options', None)
- if options:
- options['pretend'] = True
+ options = kwargs.get('options', None)
+ if options:
+ options['pretend'] = True
return self.clean(**kwargs)
@@ -48,16 +47,15 @@ class CleanLogs(object):
"""
num_of_days = None
pretend = False
- if kwargs:
- # convuluted, I know, but portage.settings does not
exist in
- # kwargs.get() when called from
_emerge.main.clean_logs()
- settings = kwargs.get('settings', None)
- if not settings:
- settings = portage.settings
- options = kwargs.get('options', None)
- if options:
- num_of_days = options.get('NUM', None)
- pretend = options.get('pretend', False)
+
+ # convoluted, I know, but portage.settings does not exist in
+ # kwargs.get() when called from _emerge.main.clean_logs()
+ settings = kwargs.get('settings', getattr(portage, 'settings',
{}))
+
+ options = kwargs.get('options', None)
+ if options:
+ num_of_days = options.get('NUM', None)
+ pretend = options.get('pretend', False)
clean_cmd = settings.get("PORT_LOGDIR_CLEAN")
if clean_cmd: