From 5d1de209a8dec2034f5715add17117d2c456c40e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=B6rist?= Date: Tue, 18 Sep 2018 10:26:27 +0200 Subject: [PATCH] Fix singleton-comparison pylint errors --- gajim/chat_control.py | 2 +- gajim/common/contacts.py | 2 +- gajim/common/file_props.py | 2 +- gajim/common/optparser.py | 2 +- gajim/common/socks5.py | 4 ++-- gajim/common/zeroconf/zeroconf_avahi.py | 2 +- gajim/filetransfers_window.py | 6 +++--- gajim/gui_menu_builder.py | 2 +- gajim/htmltextview.py | 5 +++-- gajim/message_window.py | 4 ++-- 10 files changed, 16 insertions(+), 15 deletions(-) diff --git a/gajim/chat_control.py b/gajim/chat_control.py index 04f36f22b..da3cae342 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 c6d9edac5..4d9dd91ff 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 05c2c6b6c..9cc6a9440 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 6b5b5ead6..452c13d16 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 60fc37a7e..b5b84c6f8 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 6d0bba7ee..195ef4578 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 0a076f53e..77d2be9e2 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 8a5aae9c8..53bc33dcf 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 7fb104059..11f9303ba 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 02d8837a9..0b93a09ee 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':