diff --git a/src/common/connection.py b/src/common/connection.py index 40c1d013d01eecda9c379aa34d1e92a6ca832765..49454f9aef356c7da37694acc65dcb7477824d25 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 773886cc5776b5f3aca0a821a8145bbe45ef85a5..9cdc33166aa5394775e9e15ce008dd7af960aa1d 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 04c562f257e9193f1b202580291d41c07ea1a8eb..8bda87874322de0708e79d5b710b51244c9c41e5 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 b338ad9068baa7a4e294c5267351dec658ee85af..e6342f6cc7bd0855a209a2b9e9913c9233f7188f 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 c21a54bdf35b9ee304b957abbc0e25394a98d9dc..283b3ab5bc5c2391edb0fb98b4ea2478a6453645 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 70a101a61b1b086235b125ae410cc4e6ac35f685..4f198ffb8ee60dfb0b7ee5686c1b179435ddc8eb 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() diff --git a/test/lib/mock.py b/test/lib/mock.py index 5d6348b1a19037e14e3271bd6f1789291c12b089..c4a4e63320888b3a6095fd90326a84b57a1c7bd0 100644 --- a/test/lib/mock.py +++ b/test/lib/mock.py @@ -116,7 +116,7 @@ class Mock: raise a MockInterfaceError. Based on the Python 2.3.3 Reference Manual section 5.3.4: Calls. """ - if self.realClassMethods == None: + if self.realClassMethods is None: return if name not in self.realClassMethods: raise MockInterfaceError("Calling mock method '%s' that was not found in the original class" % name) @@ -411,7 +411,7 @@ def NOT(cond): def MATCHES(regex, *args, **kwargs): compiled_regex = re.compile(regex, *args, **kwargs) def testFn(param): - return compiled_regex.match(param) != None + return compiled_regex.match(param) is not None return testFn def SEQ(*sequence):