diff --git a/src/chat_control.py b/src/chat_control.py index 1985db73c6a875b996103ec0695bc4416622f530..6cfd56226e525147d626d44b1121e77a7bd5fc49 100644 --- a/src/chat_control.py +++ b/src/chat_control.py @@ -1700,7 +1700,7 @@ class ChatControl(ChatControlBase): gajim.jid_is_transport(jid): toggle_gpg_menuitem.set_sensitive(False) else: - e2e_is_active = int(self.session != None and self.session.enable_encryption) + e2e_is_active = int(self.session is not None and self.session.enable_encryption) toggle_gpg_menuitem.set_sensitive(not e2e_is_active) toggle_gpg_menuitem.set_active(self.gpg_is_active) @@ -1708,7 +1708,8 @@ class ChatControl(ChatControlBase): if not gajim.HAVE_PYCRYPTO: toggle_e2e_menuitem.set_sensitive(False) else: - isactive = int(self.session != None and self.session.enable_encryption) + isactive = int(self.session is not None and \ + self.session.enable_encryption) toggle_e2e_menuitem.set_active(isactive) toggle_e2e_menuitem.set_sensitive(not self.gpg_is_active) diff --git a/src/common/GnuPGInterface.py b/src/common/GnuPGInterface.py index 90830e55497f59164b9589207513d0284502a051..9b50af8945d3dbf1d2d9576057ea2f36663d871f 100644 --- a/src/common/GnuPGInterface.py +++ b/src/common/GnuPGInterface.py @@ -350,7 +350,7 @@ class GnuPG: handle_passphrase = 0 - if self.passphrase != None \ + if self.passphrase is not None \ and not attach_fhs.has_key('passphrase') \ and 'passphrase' not in create_fhs: handle_passphrase = 1 @@ -567,11 +567,16 @@ class Options: def get_standard_args( self ): """Generate a list of standard, non-meta or extra arguments""" args = [] - if self.homedir != None: args.extend( [ '--homedir', self.homedir ] ) - if self.options != None: args.extend( [ '--options', self.options ] ) - if self.comment != None: args.extend( [ '--comment', self.comment ] ) - if self.compress_algo != None: args.extend( [ '--compress-algo', self.compress_algo ] ) - if self.default_key != None: args.extend( [ '--default-key', self.default_key ] ) + if self.homedir is not None: + args.extend( [ '--homedir', self.homedir ] ) + if self.options is not None: + args.extend( [ '--options', self.options ] ) + if self.comment is not None: + args.extend( [ '--comment', self.comment ] ) + if self.compress_algo is not None: + args.extend( [ '--compress-algo', self.compress_algo ] ) + if self.default_key is not None: + args.extend( [ '--default-key', self.default_key ] ) if self.no_options: args.append( '--no-options' ) if self.armor: args.append( '--armor' ) diff --git a/src/common/connection_handlers.py b/src/common/connection_handlers.py index ee35525eaf80fab5ba993d59918f6bf7d47930d2..e6f72c2df4da51cbb402f4cb6d9af1d588507f66 100644 --- a/src/common/connection_handlers.py +++ b/src/common/connection_handlers.py @@ -489,7 +489,7 @@ class ConnectionBytestream: if proxyhost['jid'] == jid: proxy = proxyhost - if proxy != None: + if proxy is not None: file_props['streamhost-used'] = True if not file_props.has_key('streamhosts'): file_props['streamhosts'] = [] @@ -1104,7 +1104,7 @@ class ConnectionVcard: order = int(order) except: order = 0 - if order != None: + if order is not None: data['order'] = order if meta_list.has_key(tag): meta_list[tag].append(data) @@ -1602,7 +1602,7 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco, invite = msg.getTag('x', namespace = common.xmpp.NS_MUC_USER) if invite and not invite.getTag('invite'): invite = None - delayed = msg.getTag('x', namespace = common.xmpp.NS_DELAY) != None + delayed = msg.getTag('x', namespace = common.xmpp.NS_DELAY) is not None msg_id = None composing_xep = None # FIXME: Msn transport (CMSN1.2.1 and PyMSN0.10) do NOT RECOMMENDED @@ -1675,7 +1675,7 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco, has_timestamp = False if msg.timestamp: has_timestamp = True - if subject != None: + if subject is not None: self.dispatch('GC_SUBJECT', (frm, subject, msgtxt, has_timestamp)) else: statusCode = msg.getStatusCode() diff --git a/src/common/helpers.py b/src/common/helpers.py index c38e9228eb305b41ff41b1264b8de5924f6c9be6..2f597645e5086e43a18295c53550f411e08a8a5d 100644 --- a/src/common/helpers.py +++ b/src/common/helpers.py @@ -908,7 +908,7 @@ advanced_notif_num = None, is_first_message = True): def allow_popup_window(account, advanced_notif_num = None): '''is it allowed to popup windows?''' - if advanced_notif_num != None: + if advanced_notif_num is not None: popup = gajim.config.get_per('notifications', str(advanced_notif_num), 'auto_open') if popup == 'yes': diff --git a/src/common/pep.py b/src/common/pep.py index c9f2f59c2a81ecc28b0e8f2d2d186cd22e1404e3..f5609dc4c74e6d184c67d1b64aeeb099045c24e7 100644 --- a/src/common/pep.py +++ b/src/common/pep.py @@ -20,9 +20,9 @@ def user_mood(items, name, jid): del acc.mood['mood'] if acc.mood.has_key('text'): del acc.mood['text'] - if mood != None: + if mood is not None: acc.mood['mood'] = mood - if text != None: + if text is not None: acc.mood['text'] = text (user, resource) = gajim.get_room_and_nick_from_fjid(jid) @@ -34,9 +34,9 @@ def user_mood(items, name, jid): del contact.mood['mood'] if contact.mood.has_key('text'): del contact.mood['text'] - if mood != None: + if mood is not None: contact.mood['mood'] = mood - if text != None: + if text is not None: contact.mood['text'] = text def user_tune(items, name, jid): @@ -76,15 +76,15 @@ def user_tune(items, name, jid): del acc.tune['track'] if acc.tune.has_key('length'): del acc.tune['length'] - if artist != None: + if artist is not None: acc.tune['artist'] = artist - if title != None: + if title is not None: acc.tune['title'] = title - if source != None: + if source is not None: acc.tune['source'] = source - if track != None: + if track is not None: acc.tune['track'] = track - if length != None: + if length is not None: acc.tune['length'] = length (user, resource) = gajim.get_room_and_nick_from_fjid(jid) @@ -102,15 +102,15 @@ def user_tune(items, name, jid): del contact.tune['track'] if contact.tune.has_key('length'): del contact.tune['length'] - if artist != None: + if artist is not None: contact.tune['artist'] = artist - if title != None: + if title is not None: contact.tune['title'] = title - if source != None: + if source is not None: contact.tune['source'] = source - if track != None: + if track is not None: contact.tune['track'] = track - if length != None: + if length is not None: contact.tune['length'] = length def user_geoloc(items, name, jid): @@ -143,11 +143,11 @@ def user_activity(items, name, jid): del acc.activity['subactivity'] if acc.activity.has_key('text'): del acc.activity['text'] - if activity != None: + if activity is not None: acc.activity['activity'] = activity - if subactivity != None: + if subactivity is not None: acc.activity['subactivity'] = subactivity - if text != None: + if text is not None: acc.activity['text'] = text (user, resource) = gajim.get_room_and_nick_from_fjid(jid) @@ -161,11 +161,11 @@ def user_activity(items, name, jid): del contact.activity['subactivity'] if contact.activity.has_key('text'): del contact.activity['text'] - if activity != None: + if activity is not None: contact.activity['activity'] = activity - if subactivity != None: + if subactivity is not None: contact.activity['subactivity'] = subactivity - if text != None: + if text is not None: contact.activity['text'] = text def user_send_mood(account, mood, message = ''): diff --git a/src/common/socks5.py b/src/common/socks5.py index 3e7feeeb5c6cb510e2d0780a60519ee194a615ad..4e02125cab6ae5604f446974c1566f012b1ff24b 100644 --- a/src/common/socks5.py +++ b/src/common/socks5.py @@ -201,7 +201,7 @@ class SocksQueue: self.idx += 1 result = sock5_receiver.connect() self.connected += 1 - if result != None: + if result is not None: result = sock5_receiver.main() self.process_result(result, sock5_receiver) return 1 @@ -547,7 +547,7 @@ class Socks5: self.file_props['completed'] = True return 0 # return number of read bytes. It can be used in progressbar - if fd != None: + if fd is not None: self.file_props['stalled'] = False if fd is None and self.file_props['stalled'] is False: return None diff --git a/src/common/xmpp/client.py b/src/common/xmpp/client.py index cc8f773138e099054c76ba1650161cb0df03f83d..bc2335effe33fc2658b7c3f11d0077098dfe16a2 100644 --- a/src/common/xmpp/client.py +++ b/src/common/xmpp/client.py @@ -283,7 +283,7 @@ class Component(CommonClient): self.Namespace=auth.NS_COMPONENT_1 self.Server=server[0] CommonClient.connect(self,server=server,proxy=proxy) - if self.connected and (self.typ=='jabberd2' or not self.typ and self.Dispatcher.Stream.features != None): + if self.connected and (self.typ=='jabberd2' or not self.typ and self.Dispatcher.Stream.features is not None): self.defaultNamespace=auth.NS_CLIENT self.Dispatcher.RegisterNamespace(self.defaultNamespace) self.Dispatcher.RegisterProtocol('iq',dispatcher.Iq) diff --git a/src/common/xmpp/client_nb.py b/src/common/xmpp/client_nb.py index 6d3a852db4c048ed8cf279e8d26e39126d02e9f1..142a04d85370d8608ba0ef0699911f611017bb0f 100644 --- a/src/common/xmpp/client_nb.py +++ b/src/common/xmpp/client_nb.py @@ -354,7 +354,7 @@ class Component(NBCommonClient): on_connect = self._on_connect, on_connect_failure = self.on_connect_failure) def _on_connect(self): - if self.typ=='jabberd2' or not self.typ and self.Dispatcher.Stream.features != None: + if self.typ=='jabberd2' or not self.typ and self.Dispatcher.Stream.features is not None: self.defaultNamespace=auth.NS_CLIENT self.Dispatcher.RegisterNamespace(self.defaultNamespace) self.Dispatcher.RegisterProtocol('iq',dispatcher.Iq) diff --git a/src/common/xmpp/commands.py b/src/common/xmpp/commands.py index 673cf894d37bf66d43982939709e46a9ee57e712..433faee86c3ea38587efcfb0adc29c811ee9a656 100644 --- a/src/common/xmpp/commands.py +++ b/src/common/xmpp/commands.py @@ -115,7 +115,7 @@ class Commands(PlugIn): if items != []: for each in items: i = self._handlers[each[0]][each[1]]['disco'](conn,request,'list') - if i != None: + if i is not None: list.append(Node(tag='item',attrs={'jid':i[0],'node':i[1],'name':i[2]})) iq = request.buildReply('result') if request.getQuerynode(): iq.setQuerynode(request.getQuerynode()) @@ -243,7 +243,7 @@ class Command_Handler_Prototype(PlugIn): # Jid and session don't match. Go away imposter self._owner.send(Error(request,ERR_BAD_REQUEST)) raise NodeProcessed - elif session != None: + elif session is not None: # Not on this sessionid you won't. self._owner.send(Error(request,ERR_BAD_REQUEST)) raise NodeProcessed diff --git a/src/common/xmpp/dispatcher.py b/src/common/xmpp/dispatcher.py index 556690964fcfe95b7ef86c70ff9dca5611829c5d..95e0f00b0576c21b484dad8517d95b6c843b30ed 100644 --- a/src/common/xmpp/dispatcher.py +++ b/src/common/xmpp/dispatcher.py @@ -246,7 +246,7 @@ class Dispatcher(PlugIn): if not direct and self._owner._component: if name == 'route': - if stanza.getAttr('error') == None: + if stanza.getAttr('error') is None: if len(stanza.getChildren()) == 1: stanza = stanza.getChildren()[0] name=stanza.getName() diff --git a/src/common/xmpp/protocol.py b/src/common/xmpp/protocol.py index c09b9921f0ee34121f50bb236a1020738c7569c6..ad68c9bdda7ead811ef1657d7428f440fc509dc5 100644 --- a/src/common/xmpp/protocol.py +++ b/src/common/xmpp/protocol.py @@ -405,7 +405,7 @@ class Message(Protocol): Protocol.__init__(self, 'message', to=to, typ=typ, attrs=attrs, frm=frm, payload=payload, timestamp=timestamp, xmlns=xmlns, node=node) if body: self.setBody(body) if xhtml: self.setXHTML(xhtml) - if subject != None: self.setSubject(subject) + if subject is not None: self.setSubject(subject) def getBody(self): """ Returns text of the message. """ return self.getTagData('body') diff --git a/src/conversation_textview.py b/src/conversation_textview.py index cfa8553c4916e3f1a971f13444a2b752cc8491b3..38d742246cddafd3cf52159586cda3a3ccec6d3e 100644 --- a/src/conversation_textview.py +++ b/src/conversation_textview.py @@ -973,7 +973,7 @@ class ConversationTextview: imagepath = self.latex_to_image(special_text) end_iter = buffer.get_end_iter() anchor = buffer.create_child_anchor(end_iter) - if imagepath != None: + if imagepath is not None: img = gtk.Image() img.set_from_file(imagepath) img.show() diff --git a/src/gajim.py b/src/gajim.py index b513034ef2999a553f54d1a36bb0c9be5a2c2702..2c2a11f7db6cf7d7b14f4189487c8be3e30e204a 100755 --- a/src/gajim.py +++ b/src/gajim.py @@ -1457,7 +1457,7 @@ class Interface: title = _('Wrong Passphrase') second = _('Please retype your GPG passphrase or press Cancel.') self.gpg_dialog = None - if passphrase != None: + if passphrase is not None: self.gpg_passphrase[keyid] = passphrase gobject.timeout_add(30000, self.forget_gpg_passphrase, keyid) gajim.connections[account].gpg_passphrase(passphrase) diff --git a/src/gtkgui_helpers.py b/src/gtkgui_helpers.py index 73e2469a4692f761889ceca7ad69782cc87a629f..6b388a0f4d3fae51688c07782b8d23afc3e637e0 100644 --- a/src/gtkgui_helpers.py +++ b/src/gtkgui_helpers.py @@ -660,7 +660,7 @@ def possibly_set_gajim_as_xmpp_handler(): path_to_kde_file = None def set_gajim_as_xmpp_handler(is_checked=None): - if is_checked != None: + if is_checked is not None: # come from confirmation dialog gajim.config.set('check_if_gajim_is_default', is_checked) path_to_gajim_script, typ = get_abspath_for_script('gajim-remote', True) diff --git a/src/lastfm.py b/src/lastfm.py index c658a491235562ddbdcc27846cd48809eb7849ff..3e4822b2cb6f2807c1af23391b89ef43bf0ec590 100644 --- a/src/lastfm.py +++ b/src/lastfm.py @@ -192,7 +192,7 @@ class LastFM: if songTuple is None: songTuple = self.getLastRecentSong() - if songTuple != None: + if songTuple is not None: dict = { 'a': songTuple[0], 'n': songTuple[1], diff --git a/src/message_window.py b/src/message_window.py index 31e070147d4eee198433336c207e31df09e26b49..72f87435d5ec1c8c798be75c1cfc2f14be31390c 100644 --- a/src/message_window.py +++ b/src/message_window.py @@ -784,11 +784,12 @@ class MessageWindowMgr(gobject.GObject): return None def has_window(self, jid, acct): - return self.get_window(jid, acct) != None + return self.get_window(jid, acct) is not None def one_window_opened(self, contact=None, acct=None, type=None): try: - return self._windows[self._mode_to_key(contact, acct, type)] != None + return \ + self._windows[self._mode_to_key(contact, acct, type)] is not None except KeyError: return False diff --git a/src/notify.py b/src/notify.py index 6d6a3f599ca1944dd9aa5b436320e1ee444d6e02..cc4f60d01192d986f26acc4052b41be11bb06a59 100644 --- a/src/notify.py +++ b/src/notify.py @@ -59,7 +59,7 @@ def get_show_in_roster(event, account, contact): if event == 'gc_message_received': return True num = get_advanced_notification(event, account, contact) - if num != None: + if num is not None: if gajim.config.get_per('notifications', str(num), 'roster') == 'yes': return True if gajim.config.get_per('notifications', str(num), 'roster') == 'no': @@ -73,7 +73,7 @@ def get_show_in_roster(event, account, contact): def get_show_in_systray(event, account, contact, type_=None): '''Return True if this event must be shown in systray, else False''' num = get_advanced_notification(event, account, contact) - if num != None: + if num is not None: if gajim.config.get_per('notifications', str(num), 'systray') == 'yes': return True if gajim.config.get_per('notifications', str(num), 'systray') == 'no':