summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2019-01-07 10:27:39 +0000
committerGerrit Code Review <review@openstack.org>2019-01-07 10:27:39 +0000
commit6bb3f9d9eaa353ec5d811e4488248ecd64bac428 (patch)
tree4d64174a91a0490ac996b12ff1ee3d6a58233cd1
parent2a2dbc51dc837c83e4479317892813d93a3cc930 (diff)
parente2bcc15c8d9ad4f2d4bc7af19de1ed39dd0249d1 (diff)
Merge "dict_object.keys() is not required for *in* operator"
-rw-r--r--tests/base.py8
-rw-r--r--zuul/ansible/callback/zuul_stream.py4
-rwxr-xr-xzuul/cmd/client.py2
-rw-r--r--zuul/cmd/migrate.py8
-rw-r--r--zuul/configloader.py2
-rw-r--r--zuul/driver/gerrit/gerritconnection.py2
-rw-r--r--zuul/executor/client.py2
-rw-r--r--zuul/lib/statsd.py2
8 files changed, 15 insertions, 15 deletions
diff --git a/tests/base.py b/tests/base.py
index 6cc89fc..161eed9 100644
--- a/tests/base.py
+++ b/tests/base.py
@@ -257,7 +257,7 @@ class FakeGerritChange(object):
257 'type': 'ADDED'}, 257 'type': 'ADDED'},
258 {'file': 'README', 258 {'file': 'README',
259 'type': 'MODIFIED'}] 259 'type': 'MODIFIED'}]
260 for f in files.keys(): 260 for f in files:
261 ps_files.append({'file': f, 'type': 'ADDED'}) 261 ps_files.append({'file': f, 'type': 'ADDED'})
262 d = {'approvals': [], 262 d = {'approvals': [],
263 'createdOn': time.time(), 263 'createdOn': time.time(),
@@ -416,7 +416,7 @@ class FakeGerritChange(object):
416 416
417 def getSubmitRecords(self): 417 def getSubmitRecords(self):
418 status = {} 418 status = {}
419 for cat in self.categories.keys(): 419 for cat in self.categories:
420 status[cat] = 0 420 status[cat] = 0
421 421
422 for a in self.patchsets[-1]['approvals']: 422 for a in self.patchsets[-1]['approvals']:
@@ -695,7 +695,7 @@ class FakeGerritConnection(gerritconnection.GerritConnection):
695 # happens they can add their own verified event into the queue. 695 # happens they can add their own verified event into the queue.
696 # Nevertheless, we can update change with the new review in gerrit. 696 # Nevertheless, we can update change with the new review in gerrit.
697 697
698 for cat in action.keys(): 698 for cat in action:
699 if cat != 'submit': 699 if cat != 'submit':
700 change.addApproval(cat, action[cat], username=self.user) 700 change.addApproval(cat, action[cat], username=self.user)
701 701
@@ -1155,7 +1155,7 @@ class FakeGithubConnection(githubconnection.GithubConnection):
1155 # simulate one installation per org 1155 # simulate one installation per org
1156 orgs = {} 1156 orgs = {}
1157 latest_inst_id = 0 1157 latest_inst_id = 0
1158 for repo in self.github_data.repos.keys(): 1158 for repo in self.github_data.repos:
1159 inst_id = orgs.get(repo[0]) 1159 inst_id = orgs.get(repo[0])
1160 if not inst_id: 1160 if not inst_id:
1161 latest_inst_id += 1 1161 latest_inst_id += 1
diff --git a/zuul/ansible/callback/zuul_stream.py b/zuul/ansible/callback/zuul_stream.py
index 4245e60..36ee465 100644
--- a/zuul/ansible/callback/zuul_stream.py
+++ b/zuul/ansible/callback/zuul_stream.py
@@ -402,10 +402,10 @@ class CallbackModule(default.CallbackModule):
402 msg=result_dict['module_stderr']) 402 msg=result_dict['module_stderr'])
403 elif result._task.action == 'debug': 403 elif result._task.action == 'debug':
404 # this is a debug statement, handle it special 404 # this is a debug statement, handle it special
405 for key in [k for k in result_dict.keys() 405 for key in [k for k in result_dict
406 if k.startswith('_ansible')]: 406 if k.startswith('_ansible')]:
407 del result_dict[key] 407 del result_dict[key]
408 if 'changed' in result_dict.keys(): 408 if 'changed' in result_dict:
409 del result_dict['changed'] 409 del result_dict['changed']
410 keyname = next(iter(result_dict.keys())) 410 keyname = next(iter(result_dict.keys()))
411 # If it has msg, that means it was like: 411 # If it has msg, that means it was like:
diff --git a/zuul/cmd/client.py b/zuul/cmd/client.py
index 5a5c056..ce54513 100755
--- a/zuul/cmd/client.py
+++ b/zuul/cmd/client.py
@@ -308,7 +308,7 @@ class Client(zuul.cmd.ZuulApp):
308 fields = all_fields.keys() 308 fields = all_fields.keys()
309 else: 309 else:
310 fields = [f.strip().lower() for f in self.args.columns.split(',') 310 fields = [f.strip().lower() for f in self.args.columns.split(',')
311 if f.strip().lower() in all_fields.keys()] 311 if f.strip().lower() in all_fields]
312 312
313 table = prettytable.PrettyTable( 313 table = prettytable.PrettyTable(
314 field_names=[all_fields[f]['title'] for f in fields]) 314 field_names=[all_fields[f]['title'] for f in fields])
diff --git a/zuul/cmd/migrate.py b/zuul/cmd/migrate.py
index 7e84318..c132a8c 100644
--- a/zuul/cmd/migrate.py
+++ b/zuul/cmd/migrate.py
@@ -182,7 +182,7 @@ def merge_project_dict(project_dicts, name, project):
182 return 182 return
183 183
184 old = project_dicts[name] 184 old = project_dicts[name]
185 for key in project.keys(): 185 for key in project:
186 if key not in old: 186 if key not in old:
187 old[key] = project[key] 187 old[key] = project[key]
188 elif isinstance(old[key], list): 188 elif isinstance(old[key], list):
@@ -212,7 +212,7 @@ def normalize_project_expansions():
212 # Second, find out which projects need to expand a given template 212 # Second, find out which projects need to expand a given template
213 for job_name, project in copy.deepcopy(JOBS_FOR_EXPAND).items(): 213 for job_name, project in copy.deepcopy(JOBS_FOR_EXPAND).items():
214 # There is a job-level expansion for this one 214 # There is a job-level expansion for this one
215 if job_name in JOB_MATCHERS.keys(): 215 if job_name in JOB_MATCHERS:
216 continue 216 continue
217 for project_name, expansion in project.items(): 217 for project_name, expansion in project.items():
218 TEMPLATES_TO_EXPAND[project_name] = [] 218 TEMPLATES_TO_EXPAND[project_name] = []
@@ -416,7 +416,7 @@ def expandYamlForTemplateJob(self, project, template, jobs_glob=None):
416 and self.config.getboolean( 416 and self.config.getboolean(
417 'job_builder', 'allow_empty_variables') 417 'job_builder', 'allow_empty_variables')
418 418
419 for key in template.keys(): 419 for key in template:
420 if key not in params: 420 if key not in params:
421 params[key] = template[key] 421 params[key] = template[key]
422 422
@@ -1054,7 +1054,7 @@ class JobMapping:
1054 1054
1055 def _expandVars(self, info, match_dict): 1055 def _expandVars(self, info, match_dict):
1056 job_vars = info['vars'].copy() 1056 job_vars = info['vars'].copy()
1057 for key in job_vars.keys(): 1057 for key in job_vars:
1058 job_vars[key] = job_vars[key].format(**match_dict) 1058 job_vars[key] = job_vars[key].format(**match_dict)
1059 return job_vars 1059 return job_vars
1060 1060
diff --git a/zuul/configloader.py b/zuul/configloader.py
index 3b2def4..32c9cfd 100644
--- a/zuul/configloader.py
+++ b/zuul/configloader.py
@@ -1871,7 +1871,7 @@ class TenantParser(object):
1871 layout.getJob(job.name) 1871 layout.getJob(job.name)
1872 job.validateReferences(layout) 1872 job.validateReferences(layout)
1873 1873
1874 for project_name in layout.project_configs.keys(): 1874 for project_name in layout.project_configs:
1875 for project_config in layout.project_configs[project_name]: 1875 for project_config in layout.project_configs[project_name]:
1876 with reference_exceptions( 1876 with reference_exceptions(
1877 'project', project_config, layout.loading_errors): 1877 'project', project_config, layout.loading_errors):
diff --git a/zuul/driver/gerrit/gerritconnection.py b/zuul/driver/gerrit/gerritconnection.py
index 64f9308..ec949ce 100644
--- a/zuul/driver/gerrit/gerritconnection.py
+++ b/zuul/driver/gerrit/gerritconnection.py
@@ -798,7 +798,7 @@ class GerritConnection(BaseConnection):
798 return branches 798 return branches
799 799
800 refs = self.getInfoRefs(project) 800 refs = self.getInfoRefs(project)
801 heads = [str(k[len('refs/heads/'):]) for k in refs.keys() 801 heads = [str(k[len('refs/heads/'):]) for k in refs
802 if k.startswith('refs/heads/') and 802 if k.startswith('refs/heads/') and
803 GerritConnection._checkRefFormat(k)] 803 GerritConnection._checkRefFormat(k)]
804 self._project_branch_cache[project.name] = heads 804 self._project_branch_cache[project.name] = heads
diff --git a/zuul/executor/client.py b/zuul/executor/client.py
index db1ef48..ea0948b 100644
--- a/zuul/executor/client.py
+++ b/zuul/executor/client.py
@@ -320,7 +320,7 @@ class ExecutorClient(object):
320 _fname = '%s:%s' % ( 320 _fname = '%s:%s' % (
321 function_name, 321 function_name,
322 executor_zone) 322 executor_zone)
323 if _fname in functions.keys(): 323 if _fname in functions:
324 function_name = _fname 324 function_name = _fname
325 else: 325 else:
326 self.log.warning( 326 self.log.warning(
diff --git a/zuul/lib/statsd.py b/zuul/lib/statsd.py
index 5f8ad2d..6d6ce7a 100644
--- a/zuul/lib/statsd.py
+++ b/zuul/lib/statsd.py
@@ -50,7 +50,7 @@ def get_statsd(config, extra_keys=None):
50 format_keys = copy.copy(keys) 50 format_keys = copy.copy(keys)
51 51
52 # we need to normalize all keys which go into the metric name 52 # we need to normalize all keys which go into the metric name
53 for key in format_keys.keys(): 53 for key in format_keys:
54 normalized_value = normalize_statsd_name(format_keys[key]) 54 normalized_value = normalize_statsd_name(format_keys[key])
55 format_keys[key] = normalized_value 55 format_keys[key] = normalized_value
56 56