Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/gajim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYann Leboulanger <asterix@lagaule.org>2008-12-04 01:04:42 +0300
committerYann Leboulanger <asterix@lagaule.org>2008-12-04 01:04:42 +0300
commit89f02b1feb0e204667ed7ecf1c174dbfed12de03 (patch)
treeff31cda4867a9cd95d6ef85548845932358b7065
parent88ef121510b0df414642a86d5c4b204744c0c620 (diff)
[thorstenp] replace filter lambda with list comprehension
-rw-r--r--src/common/connection_handlers.py4
-rw-r--r--src/common/stanza_session.py9
-rwxr-xr-xsrc/gajim.py3
-rw-r--r--src/gtkgui_helpers.py6
4 files changed, 10 insertions, 12 deletions
diff --git a/src/common/connection_handlers.py b/src/common/connection_handlers.py
index f316fa671..8e0fe6e39 100644
--- a/src/common/connection_handlers.py
+++ b/src/common/connection_handlers.py
@@ -1321,7 +1321,7 @@ sent a message to.'''
sessions = self.sessions[jid].values()
# sessions that we haven't received a thread ID in
- idless = filter(lambda s: not s.received_thread_id, sessions)
+ idless = [s for s in sessions if not s.received_thread_id]
# filter out everything except the default session type
p = lambda s: isinstance(s, gajim.default_session_type)
@@ -1344,7 +1344,7 @@ sent a message to.'''
p = lambda s: isinstance(s, gajim.default_session_type)
chat_sessions = filter(p, sessions)
- orphaned = filter(lambda s: not s.control, chat_sessions)
+ orphaned = [s for s in chat_sessions if not s.control]
return orphaned[0]
except (KeyError, IndexError):
diff --git a/src/common/stanza_session.py b/src/common/stanza_session.py
index 3797fd428..791fe91a3 100644
--- a/src/common/stanza_session.py
+++ b/src/common/stanza_session.py
@@ -244,8 +244,8 @@ class EncryptedStanzaSession(StanzaSession):
return crypto.encode_mpi(gajim.pubkey.sign(hash_, '')[0])
def encrypt_stanza(self, stanza):
- encryptable = filter(lambda x: x.getName() not in ('error', 'amp',
- 'thread'), stanza.getChildren())
+ encryptable = [x for x in stanza.getChildren() if x.getName() not in ('error', 'amp',
+ 'thread')]
# XXX can also encrypt contents of <error/> elements in stanzas @type =
# 'error'
@@ -324,8 +324,7 @@ class EncryptedStanzaSession(StanzaSession):
stanza.delChild(c)
# contents of <c>, minus <mac>, minus whitespace
- macable = ''.join(map(str, filter(lambda x: x.getName() != 'mac',
- c.getChildren())))
+ macable = ''.join(str(x) for x in c.getChildren() if x.getName() != 'mac')
received_mac = base64.b64decode(c.getTagData('mac'))
calculated_mac = self.hmac(self.km_o, macable + \
@@ -365,7 +364,7 @@ class EncryptedStanzaSession(StanzaSession):
def c7lize_mac_id(self, form):
kids = form.getChildren()
- macable = filter(lambda x: x.getVar() not in ('mac', 'identity'), kids)
+ macable = [x for x in kids if x.getVar() not in ('mac', 'identity')]
return ''.join(map(lambda el: xmpp.c14n.c14n(el), macable))
def verify_identity(self, form, dh_i, sigmai, i_o):
diff --git a/src/gajim.py b/src/gajim.py
index 982873e7b..1712499c7 100755
--- a/src/gajim.py
+++ b/src/gajim.py
@@ -2687,8 +2687,7 @@ class Interface:
conn = gajim.connections[account]
if not session and fjid in conn.sessions:
- sessions = filter(lambda s: isinstance(s, ChatControlSession),
- conn.sessions[fjid].values())
+ sessions = [s for s in conn.sessions[fjid].values() if isinstance(s, ChatControlSession)]
# look for an existing session with a chat control
for s in sessions:
diff --git a/src/gtkgui_helpers.py b/src/gtkgui_helpers.py
index 69abbd0e7..2033b248e 100644
--- a/src/gtkgui_helpers.py
+++ b/src/gtkgui_helpers.py
@@ -229,15 +229,15 @@ def get_running_processes():
files = filter(str.isdigit, files)
# files that aren't directories...
- files = filter(lambda f:os.path.isdir('/proc/' + f), files)
+ files = [f for f in files if os.path.isdir('/proc/' + f)]
# processes owned by somebody not running gajim...
# (we check if we have access to that file)
- files = filter(lambda f:os.access('/proc/' + f +'/exe', os.F_OK), files)
+ files = [f for f in files if os.access('/proc/' + f +'/exe', os.F_OK)]
# be sure that /proc/[number]/exe is really a symlink
# to avoid TBs in incorrectly configured systems
- files = filter(lambda f:os.path.islink('/proc/' + f + '/exe'), files)
+ files = [f for f in files if os.path.islink('/proc/' + f + '/exe')]
# list of processes
processes = [os.path.basename(os.readlink('/proc/' + f +'/exe')) for f in files]