From: Thierry Parmentelat Date: Wed, 15 Sep 2010 13:45:28 +0000 (+0200) Subject: replace filter(lambda) with [ .. for .. if ..] X-Git-Tag: plcapi-5.0-17~2 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;ds=sidebyside;h=95835e3d5fd6818bef42ccd78252218a9431a045;p=plcapi.git replace filter(lambda) with [ .. for .. if ..] --- diff --git a/PLC/Methods/GetPeerData.py b/PLC/Methods/GetPeerData.py index f26322e..f4681ef 100644 --- a/PLC/Methods/GetPeerData.py +++ b/PLC/Methods/GetPeerData.py @@ -47,17 +47,15 @@ class GetPeerData(Method): start = time.time() # Filter out various secrets - node_fields = filter(lambda field: field not in \ - ['boot_nonce', 'key', 'session', 'root_person_ids'], - Node.fields) + node_fields = [ field for field in Node.fields if field \ + not in ['boot_nonce', 'key', 'session', 'root_person_ids']] nodes = Nodes(self.api, {'peer_id': None}, node_fields); # filter out whitelisted nodes nodes = [ n for n in nodes if not n['slice_ids_whitelist']] - person_fields = filter(lambda field: field not in \ - ['password', 'verification_key', 'verification_expires'], - Person.fields) + person_fields = [ field for field in Person.fields if field \ + not in ['password', 'verification_key', 'verification_expires']] # XXX Optimize to return only those Persons, Keys, and Slices # necessary for slice creation on the calling peer's nodes.