From 73aee40542e00c51eb0369e37211748bd0b03448 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Sat, 11 Oct 2008 09:44:12 +0000 Subject: [thorstenp] replace none equality test with identity test --- src/common/connection.py | 2 +- src/common/socks5.py | 2 +- src/common/xmpp/browser.py | 4 ++-- src/common/zeroconf/connection_handlers_zeroconf.py | 6 +++--- src/common/zeroconf/connection_zeroconf.py | 2 +- src/session.py | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/common/connection.py b/src/common/connection.py index 40c1d013d..49454f9ae 100644 --- a/src/common/connection.py +++ b/src/common/connection.py @@ -1204,7 +1204,7 @@ class Connection(ConnectionHandlers): ji = gajim.get_jid_without_resource(jid) if gajim.config.should_log(self.name, ji): log_msg = msg - if original_message != None: + if original_message is not None: log_msg = original_message if subject: log_msg = _('Subject: %(subject)s\n%(message)s') % \ diff --git a/src/common/socks5.py b/src/common/socks5.py index 773886cc5..9cdc33166 100644 --- a/src/common/socks5.py +++ b/src/common/socks5.py @@ -893,7 +893,7 @@ class Socks5Receiver(Socks5, IdleObject): def connect(self): ''' create the socket and plug it to the idlequeue ''' - if self.ais == None: + if self.ais is None: return None for ai in self.ais: diff --git a/src/common/xmpp/browser.py b/src/common/xmpp/browser.py index 04c562f25..8bda87874 100644 --- a/src/common/xmpp/browser.py +++ b/src/common/xmpp/browser.py @@ -197,14 +197,14 @@ class Browser(PlugIn): # handler must return list: [{jid,action,node,name}] if type(handler)==dict: lst=handler['items'] else: lst=handler(conn,request,'items') - if lst==None: + if lst is None: conn.send(Error(request,ERR_ITEM_NOT_FOUND)) raise NodeProcessed for item in lst: q.addChild('item',item) elif request.getQueryNS()==NS_DISCO_INFO: if type(handler)==dict: dt=handler['info'] else: dt=handler(conn,request,'info') - if dt==None: + if dt is None: conn.send(Error(request,ERR_ITEM_NOT_FOUND)) raise NodeProcessed # handler must return dictionary: diff --git a/src/common/zeroconf/connection_handlers_zeroconf.py b/src/common/zeroconf/connection_handlers_zeroconf.py index b338ad906..e6342f6cc 100644 --- a/src/common/zeroconf/connection_handlers_zeroconf.py +++ b/src/common/zeroconf/connection_handlers_zeroconf.py @@ -93,7 +93,7 @@ class ConnectionBytestream(connection_handlers.ConnectionBytestream): self.dispatch('ERROR', (_('Wrong host'), _('The host %s you configured as the ft_add_hosts_to_send advanced option is not valid, so ignored.') % ft_host)) listener = gajim.socks5queue.start_listener(port, sha_str, self._result_socks5_sid, file_props['sid']) - if listener == None: + if listener is None: file_props['error'] = -5 self.dispatch('FILE_REQUEST_ERROR', (unicode(receiver), file_props, '')) @@ -263,7 +263,7 @@ class ConnectionBytestream(connection_handlers.ConnectionBytestream): if proxyhost['jid'] == jid: proxy = proxyhost - if proxy != None: + if proxy is not None: file_props['streamhost-used'] = True if 'streamhosts' not in file_props: file_props['streamhosts'] = [] @@ -397,7 +397,7 @@ class ConnectionHandlersZeroconf(ConnectionVcard, ConnectionBytestream, connecti if not mtype: mtype = 'normal' - if frm == None: + if frm is None: for key in self.connection.zeroconf.contacts: if ip == self.connection.zeroconf.contacts[key][zeroconf.C_ADDRESS]: frm = key diff --git a/src/common/zeroconf/connection_zeroconf.py b/src/common/zeroconf/connection_zeroconf.py index c21a54bdf..283b3ab5b 100644 --- a/src/common/zeroconf/connection_zeroconf.py +++ b/src/common/zeroconf/connection_zeroconf.py @@ -457,7 +457,7 @@ class ConnectionZeroconf(ConnectionHandlersZeroconf): reason += ' ' + _('Your message could not be sent.') self.dispatch('MSGERROR', [jid, '-1', reason, None, None, session]) - ret = self.connection.send(msg_iq, msg != None, on_ok=on_send_ok, + ret = self.connection.send(msg_iq, msg is not None, on_ok=on_send_ok, on_not_ok=on_send_not_ok) if ret == -1: # Contact Offline diff --git a/src/session.py b/src/session.py index 70a101a61..4f198ffb8 100644 --- a/src/session.py +++ b/src/session.py @@ -62,7 +62,7 @@ class ChatControlSession(stanza_session.EncryptedStanzaSession): chatstate = None # chatstates - look for chatstate tags in a message if not delayed - delayed = msg.getTag('x', namespace=common.xmpp.NS_DELAY) != None + delayed = msg.getTag('x', namespace=common.xmpp.NS_DELAY) is not None if not delayed: composing_xep = False children = msg.getChildren() -- cgit v1.2.3