Cleanup: no need for keys() everywhere

This commit is contained in:
Thomas Nagy 2016-04-22 21:10:22 +02:00
parent 59b6c757e9
commit 9133dbc5c9
No known key found for this signature in database
GPG Key ID: 67A565EDFDF90E64
7 changed files with 11 additions and 8 deletions

View File

@ -139,8 +139,8 @@ def build(bld):
def touch_func(task):
for x in task.outputs:
x.write('')
for x in Task.TaskBase.classes.keys():
cls = Task.TaskBase.classes[x]
for x in Task.classes:
cls = Task.classes[x]
cls.func = touch_func
cls.color = 'CYAN'
---------------

View File

@ -199,7 +199,7 @@ for x in lst:
for func_name in funcs:
thefunc = getattr(TaskGen.task_gen, func_name, None)
if getattr(thefunc, "__name__", None) is None: continue
for feat in TaskGen.feats.keys():
for feat in TaskGen.feats:
funcs = list(TaskGen.feats[feat])
if func_name in funcs:
if x not in tool_to_features:

View File

@ -41,7 +41,7 @@ def configure(conf):
"global_define=1 by default -> no DEFINES_X anywhere"
conf.check_cfg(package='libpng')
conf.check_cc(header_name='unistd.h')
for x in conf.env.keys():
for x in conf.env:
if x.startswith('DEFINES_') and x != 'DEFINES_ST':
return 'conf.env.%s = %r' % (x, conf.env[x])
@ -50,7 +50,7 @@ def configure(conf):
"global_define=1 -> no DEFINES_X anywhere"
conf.check_cfg(package='libpng', global_define=1)
conf.check_cc(header_name='unistd.h', global_define=1)
for x in conf.env.keys():
for x in conf.env:
if x.startswith('DEFINES_') and x != 'DEFINES_ST':
return 'conf.env.%s = %r' % (x, conf.env[x])

View File

@ -59,6 +59,9 @@ class ConfigSet(object):
keys.sort()
return keys
def __iter__(self):
return iter(self.keys())
def __str__(self):
"""Text representation of the ConfigSet (for debugging purposes)"""
return "\n".join(["%r %r" % (x, self.__getitem__(x)) for x in self.keys()])

View File

@ -103,7 +103,7 @@ class task_gen(object):
def __repr__(self):
"""for debugging purposes"""
lst = []
for x in self.__dict__.keys():
for x in self.__dict__:
if x not in ('env', 'bld', 'compiled_tasks', 'tasks'):
lst.append("%s=%s" % (x, repr(getattr(self, x))))
return "bld(%s) in %s" % (", ".join(lst), self.path.abspath())

View File

@ -267,7 +267,7 @@ def validate_cfg(self, kw):
if not 'msg' in kw:
kw['msg'] = 'Checking for %r' % (kw['package'] or kw['path'])
for x in cfg_ver.keys():
for x in cfg_ver:
# Gotcha: only one predicate is allowed at a time
# TODO remove in waf 2.0
y = x.replace('-', '_')

View File

@ -329,7 +329,7 @@ class package_reader(Context.Context):
def solution_to_constraints(self, versions, constraints):
solution = []
for p in versions.keys():
for p in versions:
c = constraint()
solution.append(c)