]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commit
toaster: get rid of using reduce
authorEd Bartosh <ed.bartosh@linux.intel.com>
Tue, 10 May 2016 08:39:04 +0000 (11:39 +0300)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 1 Jun 2016 14:28:23 +0000 (15:28 +0100)
commit249d0bc6094ec9f369a02b78d8ed634a239e5ee4
treeef7a447fff761676869bd38d9563dac9fcfcce82
parent9dd9c1393a84d1110c647e84253af8e0bb6acc45
toaster: get rid of using reduce

Replaced compicated calls of reduce with more clear code.
As reduce was removed from python 3 this change is mandatory
for the code to work on both pythons.

Here is an example change for illustration purposes:

original code:

  querydict = dict(zip(or_keys, or_values))
  query = reduce(operator.or_, map(lambda x: __get_q_for_val(x, querydict[x]), [k for k in querydict])))

replaced with:

  query = None
  for key, val in zip(or_keys, or_values):
      x = __get_q_for_val(k, val)
      query = query | x if query else x

[YOCTO #9584]

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
lib/toaster/toastergui/views.py
lib/toaster/toastergui/widgets.py