[bitbake-devel] [PATCH 1/4] fetch/git: use enumerate for ud.names
Christopher Larson
kergoth at gmail.com
Tue Mar 21 18:41:01 UTC 2017
From: Christopher Larson <chris_larson at mentor.com>
list.index() isn't a particularly efficient operation, so keep track of our
position via enumerate() instead, which is more pythonic as well.
Signed-off-by: Christopher Larson <chris_larson at mentor.com>
---
lib/bb/fetch2/git.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py
index 0779e80..bbd302e 100644
--- a/lib/bb/fetch2/git.py
+++ b/lib/bb/fetch2/git.py
@@ -173,8 +173,8 @@ class Git(FetchMethod):
if len(branches) != len(ud.names):
raise bb.fetch2.ParameterError("The number of name and branch parameters is not balanced", ud.url)
ud.branches = {}
- for name in ud.names:
- branch = branches[ud.names.index(name)]
+ for pos, name in enumerate(ud.names):
+ branch = branches[pos]
ud.branches[name] = branch
ud.unresolvedrev[name] = branch
--
2.8.0
More information about the bitbake-devel
mailing list