diff --git a/gajim/chat_control.py b/gajim/chat_control.py index 04f36f22b85de965d9c0ccfbf5e743a0f1d82ec1..da3cae342d71aabf1f7bcad4c4bfe9f473b686cf 100644 --- a/gajim/chat_control.py +++ b/gajim/chat_control.py @@ -1098,7 +1098,7 @@ class ChatControl(ChatControlBase): if not contact.supports(NS_CHATSTATES): return - if contact.our_chatstate == False: + if contact.our_chatstate is False: return # if the new state we wanna send (state) equals diff --git a/gajim/common/contacts.py b/gajim/common/contacts.py index c6d9edac5fd1cf67f23910af143a180746005656..4d9dd91fffd9c18e698d62fcd953e893ade831c8 100644 --- a/gajim/common/contacts.py +++ b/gajim/common/contacts.py @@ -658,7 +658,7 @@ class GC_Contacts(): if len(jid) != 2: return False gcc = self.get_gc_contact(jid[0], jid[1]) - return gcc != None + return gcc is not None def get_nb_role_total_gc_contacts(self, room_jid, role): """ diff --git a/gajim/common/file_props.py b/gajim/common/file_props.py index 05c2c6b6c71888e32261469a91132d0c97c43a0e..9cc6a9440879c79b1fdd08de0937f0b0b0a36163 100644 --- a/gajim/common/file_props.py +++ b/gajim/common/file_props.py @@ -86,7 +86,7 @@ class FilesProp: if fp is file_prop: a = account s = sid - if a != None and s != None: + if a is not None and s is not None: del files_props[a, s] diff --git a/gajim/common/optparser.py b/gajim/common/optparser.py index 6b5b5ead68ae0caacbce68198d30bf3f4b009c01..452c13d1680e40490351dc73b88010137fe19769 100644 --- a/gajim/common/optparser.py +++ b/gajim/common/optparser.py @@ -179,7 +179,7 @@ class OptionsParser: def update_config_to_01401(self): if 'autodetect_browser_mailer' not in self.old_values or 'openwith' \ not in self.old_values or \ - (self.old_values['autodetect_browser_mailer'] == False and \ + (self.old_values['autodetect_browser_mailer'] is False and \ self.old_values['openwith'] != 'custom'): app.config.set('autodetect_browser_mailer', True) app.config.set('openwith', app.config.DEFAULT_OPENWITH) diff --git a/gajim/common/socks5.py b/gajim/common/socks5.py index 60fc37a7e86c0caef78b83809c0fe1720e8ec4df..b5b84c6f8234020fe3448720b65e11c54dbb5781 100644 --- a/gajim/common/socks5.py +++ b/gajim/common/socks5.py @@ -96,7 +96,7 @@ class SocksQueue: return self.listener def send_success_reply(self, file_props, streamhost): - if file_props.streamhost_used == True: + if file_props.streamhost_used is True: for proxy in file_props.proxyhosts: if proxy['host'] == streamhost['host']: self.on_success[file_props.transport_sid](proxy) @@ -562,7 +562,7 @@ class Socks5: self.idlequeue.remove_timeout(self.fd) if self.state > 5: # no activity for foo seconds - if self.file_props.stalled == False: + if self.file_props.stalled is False: self.file_props.stalled = True self.queue.process_result(-1, self) if not self.file_props.received_len: diff --git a/gajim/common/zeroconf/zeroconf_avahi.py b/gajim/common/zeroconf/zeroconf_avahi.py index 6d0bba7ee546ad3342637b7d34da79fda2d904bf..195ef4578ff48f0dd259879ac40d51457f2a8138 100644 --- a/gajim/common/zeroconf/zeroconf_avahi.py +++ b/gajim/common/zeroconf/zeroconf_avahi.py @@ -323,7 +323,7 @@ class Zeroconf: return False def remove_announce(self): - if self.announced == False: + if self.announced is False: return False try: if self.entrygroup.GetState() != EntryGroup.FAILURE: diff --git a/gajim/filetransfers_window.py b/gajim/filetransfers_window.py index 0a076f53e63bf8e048a75288652fd73b1416a29e..77d2be9e2328b41f547b4424b62387fdc6302224 100644 --- a/gajim/filetransfers_window.py +++ b/gajim/filetransfers_window.py @@ -634,11 +634,11 @@ class FileTransfersWindow: status = 'download' else: status = 'upload' - if file_props.paused == True: + if file_props.paused is True: status = 'pause' - elif file_props.stalled == True: + elif file_props.stalled is True: status = 'waiting' - if file_props.connected == False: + if file_props.connected is False: status = 'stop' self.model.set(iter_, 0, self.get_icon(status)) if transfered_size == full_size: diff --git a/gajim/gui_menu_builder.py b/gajim/gui_menu_builder.py index 8a5aae9c8f989140e310a63c2740ff8c3fadff9e..53bc33dcfb9a90dafda3e752c8ef1281ca941da1 100644 --- a/gajim/gui_menu_builder.py +++ b/gajim/gui_menu_builder.py @@ -84,7 +84,7 @@ show_bookmarked=False, force_resource=False): elif contacts_transport != transport: contacts_transport = False - if contacts_transport == False: + if contacts_transport is False: # they are not all from the same transport invite_menuitem.set_sensitive(False) return diff --git a/gajim/htmltextview.py b/gajim/htmltextview.py index 7fb1040599ea8b0e0132cccff6f5bad46054800a..11f9303ba00442005b21062e4acd117a4a5c46b5 100644 --- a/gajim/htmltextview.py +++ b/gajim/htmltextview.py @@ -659,7 +659,7 @@ class HtmlHandler(xml.sax.handler.ContentHandler): self.starting = True def _insert_text(self, text, working_iter=None): - if working_iter == None: + if working_iter is None: working_iter = self.iter if self.starting and text != '\n': self.starting = (text[-1] == '\n') @@ -673,7 +673,8 @@ class HtmlHandler(xml.sax.handler.ContentHandler): return self.starting or self.iter.starts_line() def _flush_text(self): - if not self.text: return + if not self.text: + return text, self.text = self.text, '' if not self.preserve: text = text.replace('\n', ' ') diff --git a/gajim/message_window.py b/gajim/message_window.py index 02d8837a902654683e279e923fd6e08b4b11b077..0b93a09eebecf502a3342fd6935d9f289cde1eb5 100644 --- a/gajim/message_window.py +++ b/gajim/message_window.py @@ -767,7 +767,7 @@ class MessageWindow: # if no others controls have awaiting events # loop until finding an unread tab or having done a complete cycle while True: - if forward == True: # look for the first unread tab on the right + if forward is True: # look for the first unread tab on the right ind = ind + 1 if ind >= self.notebook.get_n_pages(): ind = 0 @@ -779,7 +779,7 @@ class MessageWindow: if ctrl.get_nb_unread() > 0: found = True break # found - elif app.config.get('ctrl_tab_go_to_next_composing') : + elif app.config.get('ctrl_tab_go_to_next_composing'): # Search for a composing contact contact = ctrl.contact if first_composing_ind == -1 and contact.chatstate == 'composing':