Fix singleton-comparison pylint errors

This commit is contained in:
Philipp Hörist 2018-09-18 10:26:27 +02:00 committed by Philipp Hörist
parent 56f4d35169
commit 5d1de209a8
10 changed files with 16 additions and 15 deletions

View File

@ -1098,7 +1098,7 @@ class ChatControl(ChatControlBase):
if not contact.supports(NS_CHATSTATES): if not contact.supports(NS_CHATSTATES):
return return
if contact.our_chatstate == False: if contact.our_chatstate is False:
return return
# if the new state we wanna send (state) equals # if the new state we wanna send (state) equals

View File

@ -658,7 +658,7 @@ class GC_Contacts():
if len(jid) != 2: if len(jid) != 2:
return False return False
gcc = self.get_gc_contact(jid[0], jid[1]) 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): def get_nb_role_total_gc_contacts(self, room_jid, role):
""" """

View File

@ -86,7 +86,7 @@ class FilesProp:
if fp is file_prop: if fp is file_prop:
a = account a = account
s = sid s = sid
if a != None and s != None: if a is not None and s is not None:
del files_props[a, s] del files_props[a, s]

View File

@ -179,7 +179,7 @@ class OptionsParser:
def update_config_to_01401(self): def update_config_to_01401(self):
if 'autodetect_browser_mailer' not in self.old_values or 'openwith' \ if 'autodetect_browser_mailer' not in self.old_values or 'openwith' \
not in self.old_values or \ 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'): self.old_values['openwith'] != 'custom'):
app.config.set('autodetect_browser_mailer', True) app.config.set('autodetect_browser_mailer', True)
app.config.set('openwith', app.config.DEFAULT_OPENWITH) app.config.set('openwith', app.config.DEFAULT_OPENWITH)

View File

@ -96,7 +96,7 @@ class SocksQueue:
return self.listener return self.listener
def send_success_reply(self, file_props, streamhost): 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: for proxy in file_props.proxyhosts:
if proxy['host'] == streamhost['host']: if proxy['host'] == streamhost['host']:
self.on_success[file_props.transport_sid](proxy) self.on_success[file_props.transport_sid](proxy)
@ -562,7 +562,7 @@ class Socks5:
self.idlequeue.remove_timeout(self.fd) self.idlequeue.remove_timeout(self.fd)
if self.state > 5: if self.state > 5:
# no activity for foo seconds # no activity for foo seconds
if self.file_props.stalled == False: if self.file_props.stalled is False:
self.file_props.stalled = True self.file_props.stalled = True
self.queue.process_result(-1, self) self.queue.process_result(-1, self)
if not self.file_props.received_len: if not self.file_props.received_len:

View File

@ -323,7 +323,7 @@ class Zeroconf:
return False return False
def remove_announce(self): def remove_announce(self):
if self.announced == False: if self.announced is False:
return False return False
try: try:
if self.entrygroup.GetState() != EntryGroup.FAILURE: if self.entrygroup.GetState() != EntryGroup.FAILURE:

View File

@ -634,11 +634,11 @@ class FileTransfersWindow:
status = 'download' status = 'download'
else: else:
status = 'upload' status = 'upload'
if file_props.paused == True: if file_props.paused is True:
status = 'pause' status = 'pause'
elif file_props.stalled == True: elif file_props.stalled is True:
status = 'waiting' status = 'waiting'
if file_props.connected == False: if file_props.connected is False:
status = 'stop' status = 'stop'
self.model.set(iter_, 0, self.get_icon(status)) self.model.set(iter_, 0, self.get_icon(status))
if transfered_size == full_size: if transfered_size == full_size:

View File

@ -84,7 +84,7 @@ show_bookmarked=False, force_resource=False):
elif contacts_transport != transport: elif contacts_transport != transport:
contacts_transport = False contacts_transport = False
if contacts_transport == False: if contacts_transport is False:
# they are not all from the same transport # they are not all from the same transport
invite_menuitem.set_sensitive(False) invite_menuitem.set_sensitive(False)
return return

View File

@ -659,7 +659,7 @@ class HtmlHandler(xml.sax.handler.ContentHandler):
self.starting = True self.starting = True
def _insert_text(self, text, working_iter=None): def _insert_text(self, text, working_iter=None):
if working_iter == None: if working_iter is None:
working_iter = self.iter working_iter = self.iter
if self.starting and text != '\n': if self.starting and text != '\n':
self.starting = (text[-1] == '\n') self.starting = (text[-1] == '\n')
@ -673,7 +673,8 @@ class HtmlHandler(xml.sax.handler.ContentHandler):
return self.starting or self.iter.starts_line() return self.starting or self.iter.starts_line()
def _flush_text(self): def _flush_text(self):
if not self.text: return if not self.text:
return
text, self.text = self.text, '' text, self.text = self.text, ''
if not self.preserve: if not self.preserve:
text = text.replace('\n', ' ') text = text.replace('\n', ' ')

View File

@ -767,7 +767,7 @@ class MessageWindow:
# if no others controls have awaiting events # if no others controls have awaiting events
# loop until finding an unread tab or having done a complete cycle # loop until finding an unread tab or having done a complete cycle
while True: 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 ind = ind + 1
if ind >= self.notebook.get_n_pages(): if ind >= self.notebook.get_n_pages():
ind = 0 ind = 0
@ -779,7 +779,7 @@ class MessageWindow:
if ctrl.get_nb_unread() > 0: if ctrl.get_nb_unread() > 0:
found = True found = True
break # found 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 # Search for a composing contact
contact = ctrl.contact contact = ctrl.contact
if first_composing_ind == -1 and contact.chatstate == 'composing': if first_composing_ind == -1 and contact.chatstate == 'composing':