Fix superfluous-parens pylint errors

This commit is contained in:
Philipp Hörist 2018-09-16 14:42:05 +02:00 committed by Philipp Hörist
parent 54776f5877
commit a6525e19a2
18 changed files with 28 additions and 27 deletions

View File

@ -1428,7 +1428,7 @@ class ChatControl(ChatControlBase):
typ = 'pm' typ = 'pm'
self.redraw_after_event_removed(jid) self.redraw_after_event_removed(jid)
if (self.contact.show in ('offline', 'error')): if self.contact.show in ('offline', 'error'):
show_offline = app.config.get('showoffline') show_offline = app.config.get('showoffline')
show_transports = app.config.get('show_transports_group') show_transports = app.config.get('show_transports_group')
if (not show_transports and app.jid_is_transport(jid)) or \ if (not show_transports and app.jid_is_transport(jid)) or \

View File

@ -1075,7 +1075,7 @@ def get_notification_icon_tooltip_text():
for account in accounts: for account in accounts:
account_name = account['name'] account_name = account['name']
# Set account status, if not set above # Set account status, if not set above
if (show_more_accounts): if show_more_accounts:
message = '\n' + indent_with + ' %s - %s' message = '\n' + indent_with + ' %s - %s'
text += message % (account_name, get_account_status(account)) text += message % (account_name, get_account_status(account))
# Account list shown, messages need to be indented more # Account list shown, messages need to be indented more

View File

@ -67,7 +67,7 @@ class CommonResolver():
if host + type_ in self.handlers: if host + type_ in self.handlers:
for callback in self.handlers[host + type_]: for callback in self.handlers[host + type_]:
callback(host, result_list) callback(host, result_list)
del(self.handlers[host + type_]) del self.handlers[host + type_]
def start_resolve(self, host, type_): def start_resolve(self, host, type_):
pass pass

View File

@ -390,7 +390,7 @@ class SocksQueue:
else: else:
if reader.streamhost is not None: if reader.streamhost is not None:
reader.streamhost['state'] = -1 reader.streamhost['state'] = -1
del(self.readers[key]) del self.readers[key]
def remove_sender_by_key(self, key, do_disconnect=True): def remove_sender_by_key(self, key, do_disconnect=True):
sender = self.senders[key] sender = self.senders[key]
@ -398,7 +398,7 @@ class SocksQueue:
sender.disconnect() sender.disconnect()
self.idlequeue.unplug_idle(sender.fd) self.idlequeue.unplug_idle(sender.fd)
self.idlequeue.remove_timeout(sender.fd) self.idlequeue.remove_timeout(sender.fd)
del(self.senders[key]) del self.senders[key]
if self.connected > 0: if self.connected > 0:
self.connected -= 1 self.connected -= 1

View File

@ -105,7 +105,7 @@ class ZeroconfListener(IdleObject):
for jid in self.conn_holder.getRoster().keys(): for jid in self.conn_holder.getRoster().keys():
entry = self.conn_holder.getRoster().getItem(jid) entry = self.conn_holder.getRoster().getItem(jid)
for address in entry['addresses']: for address in entry['addresses']:
if (address['address'] == ipaddr): if address['address'] == ipaddr:
from_jid = jid from_jid = jid
break break
P2PClient(sock[0], [{'host': ipaddr, 'address': ipaddr, 'port': sock[1][1]}], self.conn_holder, [], from_jid) P2PClient(sock[0], [{'host': ipaddr, 'address': ipaddr, 'port': sock[1][1]}], self.conn_holder, [], from_jid)

View File

@ -66,7 +66,7 @@ class Zeroconf:
if errorCode != pybonjour.kDNSServiceErr_NoError: if errorCode != pybonjour.kDNSServiceErr_NoError:
log.debug('Error in browse_callback: %s', str(errorCode)) log.debug('Error in browse_callback: %s', str(errorCode))
return return
if not (flags & pybonjour.kDNSServiceFlagsAdd): if not flags & pybonjour.kDNSServiceFlagsAdd:
self.remove_service_callback(serviceName) self.remove_service_callback(serviceName)
return return

View File

@ -109,7 +109,7 @@ class ManageProxiesWindow:
model = self.proxies_treeview.get_model() model = self.proxies_treeview.get_model()
proxies = app.config.get_per('proxies') proxies = app.config.get_per('proxies')
i = 1 i = 1
while ('proxy' + str(i)) in proxies: while 'proxy' + str(i) in proxies:
i += 1 i += 1
iter_ = model.append() iter_ = model.append()
model.set(iter_, 0, 'proxy' + str(i)) model.set(iter_, 0, 'proxy' + str(i))

View File

@ -751,8 +751,8 @@ class ChangeStatusMessageDialog(TimeoutDialog):
def on_change_status_message_dialog_key_press_event(self, widget, event): def on_change_status_message_dialog_key_press_event(self, widget, event):
self.countdown_enabled = False self.countdown_enabled = False
if event.keyval == Gdk.KEY_Return or \ if event.keyval == Gdk.KEY_Return or \
event.keyval == Gdk.KEY_KP_Enter: # catch CTRL+ENTER event.keyval == Gdk.KEY_KP_Enter: # catch CTRL+ENTER
if (event.get_state() & Gdk.ModifierType.CONTROL_MASK): if event.get_state() & Gdk.ModifierType.CONTROL_MASK:
self.dialog.response(Gtk.ResponseType.OK) self.dialog.response(Gtk.ResponseType.OK)
# Stop the event # Stop the event
return True return True

View File

@ -577,7 +577,7 @@ class FileTransfersWindow:
app.interface.roster.draw_contact(jid, account) app.interface.roster.draw_contact(jid, account)
app.interface.roster.show_title() app.interface.roster.show_title()
FilesProp.deleteFileProp(file_props) FilesProp.deleteFileProp(file_props)
del(file_props) del file_props
def set_progress(self, typ, sid, transfered_size, iter_=None): def set_progress(self, typ, sid, transfered_size, iter_=None):
""" """

View File

@ -436,7 +436,7 @@ class GajimRemote:
res = self.print_info(level+1, val) res = self.print_info(level+1, val)
if res != '': if res != '':
ret_str += '%s%s: \n%s' % (spacing, key, res) ret_str += '%s%s: \n%s' % (spacing, key, res)
if (encode_return): if encode_return:
try: try:
ret_str = ret_str.encode(PREFERRED_ENCODING) ret_str = ret_str.encode(PREFERRED_ENCODING)
except Exception: except Exception:

View File

@ -1474,7 +1474,7 @@ class GroupchatControl(ChatControlBase):
for special_word in special_words: for special_word in special_words:
found_here = text.find(special_word) found_here = text.find(special_word)
while(found_here > -1): while found_here > -1:
end_here = found_here + len(special_word) end_here = found_here + len(special_word)
if (found_here == 0 or not text[found_here - 1].isalpha()) and \ if (found_here == 0 or not text[found_here - 1].isalpha()) and \
(end_here == len(text) or not text[end_here].isalpha()): (end_here == len(text) or not text[end_here].isalpha()):
@ -2783,7 +2783,7 @@ class GroupchatControl(ChatControlBase):
is set this way) is set this way)
""" """
if path.get_depth() == 1: # It's a group if path.get_depth() == 1: # It's a group
if (widget.row_expanded(path)): if widget.row_expanded(path):
widget.collapse_row(path) widget.collapse_row(path)
else: else:
widget.expand_row(path, False) widget.expand_row(path, False)
@ -2834,7 +2834,7 @@ class GroupchatControl(ChatControlBase):
self.room_jid): self.room_jid):
# it's a group # it's a group
if x < 27: if x < 27:
if (widget.row_expanded(path)): if widget.row_expanded(path):
widget.collapse_row(path) widget.collapse_row(path)
else: else:
widget.expand_row(path, False) widget.expand_row(path, False)

View File

@ -145,7 +145,7 @@ class EmojiAsciiData(dict):
# escape regexp metachars # escape regexp metachars
emoticon_escaped = re.escape(emoticon) emoticon_escaped = re.escape(emoticon)
emoticons_pattern += emoticon_escaped + '|' emoticons_pattern += emoticon_escaped + '|'
if (emoticon_length != len(emoticon)): if emoticon_length != len(emoticon):
# Build up expressions to match emoticons next to others # Build up expressions to match emoticons next to others
pre_pattern = pre_pattern[:-1] + ')|(?<=' pre_pattern = pre_pattern[:-1] + ')|(?<='
post_pattern = post_pattern[:-1] + ')|(?=' post_pattern = post_pattern[:-1] + ')|(?='

View File

@ -412,7 +412,7 @@ class HistoryWindow:
log = time.localtime(timestamp) log = time.localtime(timestamp)
y, m, d = log[0], log[1], log[2] y, m, d = log[0], log[1], log[2]
date = datetime.datetime(y, m, d) date = datetime.datetime(y, m, d)
return(date) return date
def _change_date(self, widget): def _change_date(self, widget):
# Get day selected in calendar # Get day selected in calendar

View File

@ -732,7 +732,7 @@ def make_jabber_state_images():
app.interface.jabber_state_images['32'] = load_iconset(path) app.interface.jabber_state_images['32'] = load_iconset(path)
path = os.path.join(helpers.get_iconset_path(iconset), '24x24') path = os.path.join(helpers.get_iconset_path(iconset), '24x24')
if (os.path.exists(path)): if os.path.exists(path):
app.interface.jabber_state_images['24'] = load_iconset(path) app.interface.jabber_state_images['24'] = load_iconset(path)
else: else:
# Resize 32x32 icons to 24x24 # Resize 32x32 icons to 24x24

View File

@ -358,7 +358,7 @@ class Interface:
elif (obj.errcode == '404') or (obj.errcon in ('item-not-found', elif (obj.errcode == '404') or (obj.errcon in ('item-not-found',
'remote-server-not-found')): 'remote-server-not-found')):
# remote server does not exist # remote server does not exist
if (obj.errcon == 'remote-server-not-found'): if obj.errcon == 'remote-server-not-found':
self.handle_gc_error(gc_control, _('Unable to join group chat'), self.handle_gc_error(gc_control, _('Unable to join group chat'),
_('Remote server <b>%s</b> does not exist.') % obj.room_jid) _('Remote server <b>%s</b> does not exist.') % obj.room_jid)
# group chat does not exist # group chat does not exist

View File

@ -1063,7 +1063,7 @@ class HtmlTextView(Gtk.TextView):
if bounds: if bounds:
(search_iter, end) = bounds (search_iter, end) = bounds
while (search_iter.compare(end)): while search_iter.compare(end):
character = search_iter.get_char() character = search_iter.get_char()
if character == '\ufffc': if character == '\ufffc':
anchor = search_iter.get_child_anchor() anchor = search_iter.get_child_anchor()

View File

@ -722,7 +722,7 @@ class MessageWindow:
return self._widget_to_control(nth_child) return self._widget_to_control(nth_child)
def has_control(self, jid, acct): def has_control(self, jid, acct):
return (acct in self._controls and jid in self._controls[acct]) return acct in self._controls and jid in self._controls[acct]
def change_key(self, old_jid, new_jid, acct): def change_key(self, old_jid, new_jid, acct):
""" """

View File

@ -1149,7 +1149,7 @@ class RosterWindow:
# Hide group if no more contacts # Hide group if no more contacts
iterG = self._get_group_iter(group, account, model=self.modelfilter) iterG = self._get_group_iter(group, account, model=self.modelfilter)
to_hide = [] to_hide = []
while(iterG): while iterG:
parent = self.modelfilter.iter_parent(iterG) parent = self.modelfilter.iter_parent(iterG)
if (not self.modelfilter.iter_has_child(iterG)) or (to_hide \ if (not self.modelfilter.iter_has_child(iterG)) or (to_hide \
and self.modelfilter.iter_n_children(iterG) == 1): and self.modelfilter.iter_n_children(iterG) == 1):
@ -3220,8 +3220,9 @@ class RosterWindow:
elif type_ == 'agent': elif type_ == 'agent':
self.on_remove_agent(widget, list_) self.on_remove_agent(widget, list_)
elif not (event.get_state() & (Gdk.ModifierType.CONTROL_MASK | \ elif not (event.get_state() &
Gdk.ModifierType.MOD1_MASK)): (Gdk.ModifierType.CONTROL_MASK |
Gdk.ModifierType.MOD1_MASK)):
num = Gdk.keyval_to_unicode(event.keyval) num = Gdk.keyval_to_unicode(event.keyval)
if num and num > 31: if num and num > 31:
# if we got unicode symbol without ctrl / alt # if we got unicode symbol without ctrl / alt
@ -3362,7 +3363,7 @@ class RosterWindow:
titer = model.get_iter(path) titer = model.get_iter(path)
if x > x_min and x < x_min + 27 and type_ == 'contact' and \ if x > x_min and x < x_min + 27 and type_ == 'contact' and \
model.iter_has_child(titer): model.iter_has_child(titer):
if (self.tree.row_expanded(path)): if self.tree.row_expanded(path):
self.tree.collapse_row(path) self.tree.collapse_row(path)
else: else:
self.tree.expand_row(path, False) self.tree.expand_row(path, False)
@ -3375,13 +3376,13 @@ class RosterWindow:
else: else:
if type_ == 'group' and x < 27: if type_ == 'group' and x < 27:
# first cell in 1st column (the arrow SINGLE clicked) # first cell in 1st column (the arrow SINGLE clicked)
if (self.tree.row_expanded(path)): if self.tree.row_expanded(path):
self.tree.collapse_row(path) self.tree.collapse_row(path)
else: else:
self.expand_group_row(path) self.expand_group_row(path)
elif type_ == 'contact' and x > x_min and x < x_min + 27: elif type_ == 'contact' and x > x_min and x < x_min + 27:
if (self.tree.row_expanded(path)): if self.tree.row_expanded(path):
self.tree.collapse_row(path) self.tree.collapse_row(path)
else: else:
self.tree.expand_row(path, False) self.tree.expand_row(path, False)