[oe-commits] [bitbake] 07/11: fetch/git: use enumerate for ud.names

git at git.openembedded.org git at git.openembedded.org
Tue Mar 21 21:11:55 UTC 2017


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository bitbake.

commit dec6e90a4d27ee335e9c78aeebd277098fec94d1
Author: Christopher Larson <chris_larson at mentor.com>
AuthorDate: Tue Mar 21 11:41:01 2017 -0700

    fetch/git: use enumerate for ud.names
    
    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>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 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
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list