depth = MAX_INTERPOLATION_DEPTH
while depth: # Loop through this until it's done
depth -= 1
- if value.find("%(") != -1:
+ if "%(" in value:
try:
value = value % vars
except KeyError, e:
option, section, rawval, e[0])
else:
break
- if value.find("%(") != -1:
+ if "%(" in value:
raise InterpolationDepthError(option, section, rawval)
return value
format = regex_chars.sub(r"\\\1", format)
whitespace_replacement = re_compile('\s+')
format = whitespace_replacement.sub('\s*', format)
- while format.find('%') != -1:
+ while '%' in format:
directive_index = format.index('%')+1
processed_format = "%s%s%s" % (processed_format,
format[:directive_index-1],
# cause no problems since us-ascii should always be a subset of
# the charset encoding. We may want to fall back to 8-bit msgids
# if the Unicode conversion fails.
- if msg.find('\x00') >= 0:
+ if '\x00' in msg:
# Plural forms
msgid1, msgid2 = msg.split('\x00')
tmsg = tmsg.split('\x00')
# An HTTP/1.1 proxy is assumed to stay open unless
# explicitly closed.
conn = self.msg.getheader('connection')
- if conn and conn.lower().find("close") >= 0:
+ if conn and "close" in conn.lower():
return True
return False
# Proxy-Connection is a netscape hack.
pconn = self.msg.getheader('proxy-connection')
- if pconn and pconn.lower().find("keep-alive") >= 0:
+ if pconn and "keep-alive" in pconn.lower():
return False
# otherwise, assume it will close
while 1:
line = fp.readline()
if not line: break
- if line.find('{1, "') > -1:
+ if '{1, "' in line:
match = strprog.search(line)
if match:
lines.append(" '" + match.group(1) + "',\n")
# we have the catch-all agent
return True
agent = agent.lower()
- if useragent.find(agent) != -1:
+ if agent in useragent:
return True
return False
else:
alternatives = _tryorder
for browser in alternatives:
- if browser.find('%s') > -1:
+ if '%s' in browser:
# User gave us a command line, don't mess with it.
return GenericBrowser(browser)
else: