Change all “not … in …” into “… not in …”.

This commit is contained in:
Emmanuel Gil Peyrot 2017-10-08 15:36:10 +01:00
parent b2b6442672
commit f1b94534a4
14 changed files with 32 additions and 32 deletions

View file

@ -355,12 +355,12 @@ class Plugin(BasePlugin):
self.api.information('The current tab does not appear to be an IRC one', 'Warning')
return None
if isinstance(current, tabs.OneToOneTab):
if not '%' in current_jid.node:
if '%' not in current_jid.node:
server = current_jid.node
else:
ignored, server = current_jid.node.rsplit('%', 1)
elif isinstance(current, tabs.MucTab):
if not '%' in current_jid.node:
if '%' not in current_jid.node:
server = current_jid.node
else:
ignored, server = current_jid.node.rsplit('%', 1)

View file

@ -544,7 +544,7 @@ class Plugin(BasePlugin):
Retrieve or create an OTR context
"""
jid = safeJID(jid)
if not jid.full in self.contexts:
if jid.full not in self.contexts:
flags = POLICY_FLAGS.copy()
require = self.config.get_by_tabname('require_encryption',
jid.bare, default=False)

View file

@ -118,7 +118,7 @@ class Plugin(BasePlugin):
id_ = int(arg)
except:
return
if not id_ in self.tasks:
if id_ not in self.tasks:
return
self.api.information('Task %s: %s [DONE]' % (id_, self.tasks[id_][1]), 'Info')
@ -136,7 +136,7 @@ class Plugin(BasePlugin):
self.api.information(s, 'Info')
def remind(self, id_=0):
if not id_ in self.tasks:
if id_ not in self.tasks:
return
self.api.information('Task %s: %s' % (id_, self.tasks[id_][1]), 'Info')
if self.config.get('beep', '') == 'true':

View file

@ -49,10 +49,10 @@ class Plugin(BasePlugin):
self.tabs = {}
def on_join(self, presence, tab):
if not tab in self.tabs:
if tab not in self.tabs:
return
nick = presence['from'].resource
if not nick in self.tabs[tab]:
if nick not in self.tabs[tab]:
return
for i in self.tabs[tab][nick]:
tab.command_say("%s: %s" % (nick, i))
@ -79,9 +79,9 @@ class Plugin(BasePlugin):
return
nick, msg = args
tab = self.api.current_tab()
if not tab in self.tabs:
if tab not in self.tabs:
self.tabs[tab] = {}
if not nick in self.tabs[tab]:
if nick not in self.tabs[tab]:
self.tabs[tab][nick] = []
self.tabs[tab][nick].append(msg)
self.api.information('Message for %s queued' % nick, 'Info')
@ -89,17 +89,17 @@ class Plugin(BasePlugin):
def command_untell(self, args):
"""/untell <nick>"""
tab = self.api.current_tab()
if not tab in self.tabs:
if tab not in self.tabs:
return
nick = args
if not nick in self.tabs[tab]:
if nick not in self.tabs[tab]:
return
del self.tabs[tab][nick]
self.api.information('Messages for %s unqueued' % nick, 'Info')
def completion_untell(self, the_input):
tab = self.api.current_tab()
if not tab in self.tabs:
if tab not in self.tabs:
return Completion(the_input.auto_completion, [], '')
return Completion(the_input.auto_completion, list(self.tabs[tab]), '', quotify=False)

View file

@ -280,7 +280,7 @@ class Config(RawConfigParser):
else:
sections, result_lines = result
if not section in sections:
if section not in sections:
result_lines.append('[%s]' % section)
result_lines.append('%s = %s' % (option, value))
else:
@ -304,7 +304,7 @@ class Config(RawConfigParser):
else:
sections, result_lines = result
if not section in sections:
if section not in sections:
log.error('Tried to remove the option %s from a non-'
'existing section (%s)', option, section)
return True

View file

@ -115,7 +115,7 @@ class CommandCore:
if args is None:
return self.help('status')
if not args[0] in POSSIBLE_SHOW.keys():
if args[0] not in POSSIBLE_SHOW.keys():
return self.help('status')
show = POSSIBLE_SHOW[args[0]]
@ -562,7 +562,7 @@ class CommandCore:
if not section:
section = plugin_name
option = args[1]
if not plugin_name in self.core.plugin_manager.plugins:
if plugin_name not in self.core.plugin_manager.plugins:
file_name = self.core.plugin_manager.plugins_conf_dir
file_name = os.path.join(file_name, plugin_name + '.cfg')
plugin_config = PluginConfig(file_name, plugin_name)
@ -589,7 +589,7 @@ class CommandCore:
section = plugin_name
option = args[1]
value = args[2]
if not plugin_name in self.core.plugin_manager.plugins:
if plugin_name not in self.core.plugin_manager.plugins:
file_name = self.core.plugin_manager.plugins_conf_dir
file_name = os.path.join(file_name, plugin_name + '.cfg')
plugin_config = PluginConfig(file_name, plugin_name)

View file

@ -1347,7 +1347,7 @@ class HandlerCore:
return
cert = config.get('certificate')
# update the cert representation when it uses the old one
if cert and not ':' in cert:
if cert and ':' not in cert:
cert = ':'.join(i + j for i, j in zip(cert[::2], cert[1::2])).upper()
config.set_and_save('certificate', cert)

View file

@ -79,7 +79,7 @@ def _filter_add_receipt_request(self, stanza):
if stanza['request_receipt']:
return stanza
if not stanza['type'] in self.ack_types:
if stanza['type'] not in self.ack_types:
return stanza
if stanza['receipt']:

View file

@ -164,7 +164,7 @@ class PluginManager(object):
t = tab_type.__name__
if name in tab_type.plugin_commands:
return
if not t in commands:
if t not in commands:
commands[t] = []
commands[t].append((name, handler, help, completion))
tab_type.plugin_commands[name] = Command(handler, help,
@ -179,7 +179,7 @@ class PluginManager(object):
"""
commands = self.tab_commands[module_name]
t = tab_type.__name__
if not t in commands:
if t not in commands:
return
for command in commands[t]:
if command[0] == name:
@ -197,7 +197,7 @@ class PluginManager(object):
t = tab_type.__name__
if key in tab_type.plugin_keys:
return
if not t in keys:
if t not in keys:
keys[t] = []
keys[t].append((key, handler))
tab_type.plugin_keys[key] = handler
@ -211,7 +211,7 @@ class PluginManager(object):
"""
keys = self.tab_keys[module_name]
t = tab_type.__name__
if not t in keys:
if t not in keys:
return
for _key in keys[t]:
if _key[0] == key:

View file

@ -214,7 +214,7 @@ class Roster(object):
group.remove(contact)
for group in contact.groups:
if not group in self.groups:
if group not in self.groups:
self.groups[group] = RosterGroup(group, folded=group in self.folded_groups)
self.groups[group].add(contact)

View file

@ -143,7 +143,7 @@ class Tab(object):
@state.setter
def state(self, value):
if not value in STATE_COLORS:
if value not in STATE_COLORS:
log.debug("Invalid value for tab state: %s", value)
elif STATE_PRIORITY[value] < STATE_PRIORITY[self._state] and \
value not in ('current', 'disconnected') and \
@ -325,12 +325,12 @@ class Tab(object):
def update_commands(self):
for c in self.plugin_commands:
if not c in self.commands:
if c not in self.commands:
self.commands[c] = self.plugin_commands[c]
def update_keys(self):
for k in self.plugin_keys:
if not k in self.key_func:
if k not in self.key_func:
self.key_func[k] = self.plugin_keys[k]
def on_lose_focus(self):
@ -858,10 +858,10 @@ class OneToOneTab(ChatTab):
def _feature_correct(self, features):
"Check for the 'correction' feature"
if not 'urn:xmpp:message-correct:0' in features:
if 'urn:xmpp:message-correct:0' not in features:
if 'correct' in self.commands:
del self.commands['correct']
elif not 'correct' in self.commands:
elif 'correct' not in self.commands:
self.register_command('correct', self.command_correct,
desc='Fix the last message with whatever you want.',
shortdesc='Correct the last message.',

View file

@ -486,7 +486,7 @@ class MucTab(ChatTab):
nick = args[0]
color = args[1].lower()
user = self.get_user_by_name(nick)
if not color in xhtml.colors and color not in ('unset', 'random'):
if color not in xhtml.colors and color not in ('unset', 'random'):
return self.core.information("Unknown color: %s" % color, 'Error')
if user and user.nick == self.own_nick:
return self.core.information("You cannot change the color of your"

View file

@ -609,7 +609,7 @@ class RosterInfoTab(Tab):
return
else:
jid = safeJID(args[0]).bare
if not jid in [jid for jid in roster.jids()]:
if jid not in [jid for jid in roster.jids()]:
self.core.information('No subscription to deny', 'Warning')
return

View file

@ -145,7 +145,7 @@ def test_new_completion_quoted_random(input_obj, quoted_words):
# generate the text which is supposed to be present in the input
def f(p, i):
rep = words_l[letters[p]][i] if not ' ' in words_l[letters[p]][i] else '"'+words_l[letters[p]][i]+'"'
rep = words_l[letters[p]][i] if ' ' not in words_l[letters[p]][i] else '"'+words_l[letters[p]][i]+'"'
fst = letters[1] if p != 1 else rep
snd = letters[2] if p != 2 else rep
trd = letters[3] if p != 3 else rep