All Samples(3923) | Call(3801) | Derive(0) | Import(122)
find(s, sub [,start [,end]]) -> in Return the lowest index in s where substring sub is found, such that sub is contained within s[start,end]. Optional arguments start and end are interpreted as in slice notation. Return -1 on failure.
def find(s, *args):
"""find(s, sub [,start [,end]]) -> in
Return the lowest index in s where substring sub is found,
such that sub is contained within s[start,end]. Optional
arguments start and end are interpreted as in slice notation.
Return -1 on failure.
"""
return s.find(*args)
import time import StringIO from string import find, rfind from decimal import Decimal from rdflib.term import URIRef, BNode, Literal, Variable, _XSD_PFX
u'http://example.org/#Andr\\xe9'
"""
assert(find(here, "#") < 0), "Base may not contain hash: '%s'"% here # caller must splitFrag (why?)
slashl = find(there, '/')
colonl = find(there, ':')
# join(base, 'foo:/') -- absolute
if colonl >= 0 and (slashl < 0 or colonl < slashl):
return there
bcolonl = find(here, ':')
raise ValueError ("Base <%s> has no slash after colon - with relative '%s'." %(here, there))
if here[bcolonl+1:bcolonl+3] == '//':
bpath = find(here, '/', bcolonl+3)
else:
bpath = bcolonl+1
while i>0 and uri[i-1] != '/' : i=i-1 # scan for slash
if i < 3: return uri # No way.
if string.find(base, "//", i-2)>0 \
or string.find(uri, "//", i-2)>0: return uri # An unshared "//"
if string.find(base, ":", i)>0: return uri # An unshared ":"
n = string.count(base, "/", i)
res.append(self._variables[symb])
else:
res.append(symb) # @@@ "#" CONVENTION
if not string.find(ns, "#"):progress(
"Warning: no # on namespace %s," % ns)
return j
if not ch:
raise BadSyntax(self._thisDoc, startline, str, i,
"unterminated string literal (2)")
k = string.find('abfrtvn\\"', ch)
if k >= 0:
uch = '\a\b\f\r\t\v\n\\"'[k]
ustr = ustr + uch
if ch == "":
raise BadSyntax(self._thisDoc, startline, str, i,
"unterminated string literal(3)")
k = string.find("0123456789abcdef", ch)
if k < 0:
raise BadSyntax(self._thisDoc, startline, str, i,
"bad string literal hex escape")
if ch == "":
raise BadSyntax(self._thisDoc, startline, str, i,
"unterminated string literal(3)")
k = string.find("0123456789abcdef", ch)
if k < 0:
raise BadSyntax(self._thisDoc, startline, str, i,
"bad string literal hex escape")
def stringToN3(str, singleLine=0, flags=""):
res = ''
if (len(str) > 20 and
str[-1] <> '"' and
not singleLine and
(string.find(str, "\n") >=0
or string.find(str, '"') >=0)):
if ch == '"' and delim == '"""' and str[j:j+3] != '"""': #"
res = res + ch
else:
k = string.find('\a\b\f\r\t\v\n\\"', ch)
if k >= 0: res = res + "\\" + 'abfrtvn\\"'[k]
else:
if 'e' in flags:
def dummy():
res = ""
if len(str) > 20 and (string.find(str, "\n") >=0
or string.find(str, '"') >=0):
delim= '"""'
forbidden = "\\\"\a\b\f\r\v" # (allow tabs too now)
else:
delim = '"'
forbidden = "\\\"\a\b\f\r\v\t\n"
for i in range(len(str)):
ch = str[i]
j = string.find(forbidden, ch)
src/n/o/notabene-HEAD/trunk/lib/FuXi/Rete/notation3.py notabene(Download)
# from uripath import refTo, join
# import uripath
from string import find, rfind, index
def splitFrag(uriref):
"""split a URI reference between the fragment and the rest.
u'http://example.org/#Andr\\xe9'
"""
assert(find(here, "#") < 0), "Base may not contain hash: '%s'"% here # caller must splitFrag (why?)
slashl = find(there, '/')
colonl = find(there, ':')
# join(base, 'foo:/') -- absolute
if colonl >= 0 and (slashl < 0 or colonl < slashl):
return there
bcolonl = find(here, ':')
raise ValueError ("Base <%s> has no slash after colon - with relative '%s'." %(here, there))
if here[bcolonl+1:bcolonl+3] == '//':
bpath = find(here, '/', bcolonl+3)
else:
bpath = bcolonl+1
while i>0 and uri[i-1] != '/' : i=i-1 # scan for slash
if i < 3: return uri # No way.
if string.find(base, "//", i-2)>0 \
or string.find(uri, "//", i-2)>0: return uri # An unshared "//"
if string.find(base, ":", i)>0: return uri # An unshared ":"
n = string.count(base, "/", i)
res.append(self._variables[symb])
else:
res.append(symb) # @@@ "#" CONVENTION
if not string.find(ns, "#"):progress(
"Warning: no # on namespace %s," % ns)
return j
if not ch:
raise BadSyntax(self._thisDoc, startline, str, i,
"unterminated string literal (2)")
k = string.find('abfrtvn\\"', ch)
if k >= 0:
uch = '\a\b\f\r\t\v\n\\"'[k]
ustr = ustr + uch
if ch == "":
raise BadSyntax(self._thisDoc, startline, str, i,
"unterminated string literal(3)")
k = string.find("0123456789abcdef", ch)
if k < 0:
raise BadSyntax(self._thisDoc, startline, str, i,
"bad string literal hex escape")
if ch == "":
raise BadSyntax(self._thisDoc, startline, str, i,
"unterminated string literal(3)")
k = string.find("0123456789abcdef", ch)
if k < 0:
raise BadSyntax(self._thisDoc, startline, str, i,
"bad string literal hex escape")
def stringToN3(str, singleLine=0, flags=""):
res = ''
if (len(str) > 20 and
str[-1] <> '"' and
not singleLine and
(string.find(str, "\n") >=0
or string.find(str, '"') >=0)):
if ch == '"' and delim == '"""' and str[j:j+3] != '"""': #"
res = res + ch
else:
k = string.find('\a\b\f\r\t\v\n\\"', ch)
if k >= 0: res = res + "\\" + 'abfrtvn\\"'[k]
else:
if 'e' in flags:
def dummy():
res = ""
if len(str) > 20 and (string.find(str, "\n") >=0
or string.find(str, '"') >=0):
delim= '"""'
forbidden = "\\\"\a\b\f\r\v" # (allow tabs too now)
else:
delim = '"'
forbidden = "\\\"\a\b\f\r\v\t\n"
for i in range(len(str)):
ch = str[i]
j = string.find(forbidden, ch)
src/n/o/notabene-HEAD/lib/FuXi/Rete/notation3.py notabene(Download)
# from uripath import refTo, join
# import uripath
from string import find, rfind, index
def splitFrag(uriref):
"""split a URI reference between the fragment and the rest.
u'http://example.org/#Andr\\xe9'
"""
assert(find(here, "#") < 0), "Base may not contain hash: '%s'"% here # caller must splitFrag (why?)
slashl = find(there, '/')
colonl = find(there, ':')
# join(base, 'foo:/') -- absolute
if colonl >= 0 and (slashl < 0 or colonl < slashl):
return there
bcolonl = find(here, ':')
raise ValueError ("Base <%s> has no slash after colon - with relative '%s'." %(here, there))
if here[bcolonl+1:bcolonl+3] == '//':
bpath = find(here, '/', bcolonl+3)
else:
bpath = bcolonl+1
while i>0 and uri[i-1] != '/' : i=i-1 # scan for slash
if i < 3: return uri # No way.
if string.find(base, "//", i-2)>0 \
or string.find(uri, "//", i-2)>0: return uri # An unshared "//"
if string.find(base, ":", i)>0: return uri # An unshared ":"
n = string.count(base, "/", i)
res.append(self._variables[symb])
else:
res.append(symb) # @@@ "#" CONVENTION
if not string.find(ns, "#"):progress(
"Warning: no # on namespace %s," % ns)
return j
if not ch:
raise BadSyntax(self._thisDoc, startline, str, i,
"unterminated string literal (2)")
k = string.find('abfrtvn\\"', ch)
if k >= 0:
uch = '\a\b\f\r\t\v\n\\"'[k]
ustr = ustr + uch
if ch == "":
raise BadSyntax(self._thisDoc, startline, str, i,
"unterminated string literal(3)")
k = string.find("0123456789abcdef", ch)
if k < 0:
raise BadSyntax(self._thisDoc, startline, str, i,
"bad string literal hex escape")
if ch == "":
raise BadSyntax(self._thisDoc, startline, str, i,
"unterminated string literal(3)")
k = string.find("0123456789abcdef", ch)
if k < 0:
raise BadSyntax(self._thisDoc, startline, str, i,
"bad string literal hex escape")
def stringToN3(str, singleLine=0, flags=""):
res = ''
if (len(str) > 20 and
str[-1] <> '"' and
not singleLine and
(string.find(str, "\n") >=0
or string.find(str, '"') >=0)):
if ch == '"' and delim == '"""' and str[j:j+3] != '"""': #"
res = res + ch
else:
k = string.find('\a\b\f\r\t\v\n\\"', ch)
if k >= 0: res = res + "\\" + 'abfrtvn\\"'[k]
else:
if 'e' in flags:
def dummy():
res = ""
if len(str) > 20 and (string.find(str, "\n") >=0
or string.find(str, '"') >=0):
delim= '"""'
forbidden = "\\\"\a\b\f\r\v" # (allow tabs too now)
else:
delim = '"'
forbidden = "\\\"\a\b\f\r\v\t\n"
for i in range(len(str)):
ch = str[i]
j = string.find(forbidden, ch)
src/x/b/xbmc-HEAD/xbmc/lib/libPython/Python/Mac/Tools/IDE/PyEdit.py xbmc(Download)
self._creator, filetype = MacOS.GetCreatorAndType(path)
self.addrecentfile(path)
if '\n' in text:
if string.find(text, '\r\n') >= 0:
self._eoln = '\r\n'
else:
self._eoln = '\n'
def getclasslist(self):
from string import find, strip
methodRE = re.compile(r"\r[ \t]+def ")
findMethod = methodRE.search
editor = self.editgroup.editor
text = editor.get()
list = []
append((pos + 4, functag))
pos = 4
while 1:
pos = find(text, '\rdef ', pos + 1)
if pos < 0:
break
append((pos + 5, functag))
pos = -1
if text[:6] == 'class ':
append((pos + 6, classtag))
pos = 6
while 1:
pos = find(text, '\rclass ', pos + 1)
else:
pos = -1
else:
pos = string.find(text, find, pos)
if pos < 0:
break
counter = counter + 1
else:
pos = -1
else:
pos = string.find(text, find, selend)
if pos >= 0:
editor.setselection(pos, pos + len(find))
return 1
else:
pos = -1
else:
pos = string.find(text, find)
if selstart > pos >= 0:
editor.setselection(pos, pos + len(find))
return 1
src/p/r/Products.ZSQLMethods-2.13.3/src/Shared/DC/ZRDB/RDB.py Products.ZSQLMethods(Download)
##############################################################################
'''Class for reading RDB files'''
from string import split, strip, lower, upper, atof, atoi, atol, find, join
import DateTime,re
from Missing import MV
from array import array
from Record import Record
from Acquisition import Implicit
import ExtensionClass
def parse_text(s):
if find(s,'\\') < 0 and (find(s,'\\t') < 0 and find(s,'\\n') < 0): return s
src/n/o/notabene-HEAD/trunk/lib/rdflib/syntax/parsers/n3p/uripath.py notabene(Download)
__version__ = "$Id: uripath.py,v 1.16 2004/03/21 04:24:35 timbl Exp $" from string import find, rfind, index def splitFrag(uriref):
u'http://example.org/#Andr\\xe9'
"""
assert(find(here, "#") < 0), "Base may not contain hash: '%s'"% here # caller must splitFrag (why?)
slashl = find(there, '/')
colonl = find(there, ':')
# join(base, 'foo:/') -- absolute
if colonl >= 0 and (slashl < 0 or colonl < slashl):
return there
bcolonl = find(here, ':')
raise ValueError ("Base <%s> has no slash after colon - with relative '%s'." %(here, there))
if here[bcolonl+1:bcolonl+3] == '//':
bpath = find(here, '/', bcolonl+3)
else:
bpath = bcolonl+1
while i>0 and uri[i-1] != '/' : i=i-1 # scan for slash
if i < 3: return uri # No way.
if string.find(base, "//", i-2)>0 \
or string.find(uri, "//", i-2)>0: return uri # An unshared "//"
if string.find(base, ":", i)>0: return uri # An unshared ":"
n = string.count(base, "/", i)
src/p/y/pymoo-HEAD/trunk/pymoo/lib/msg.py pymoo(Download)
""" from string import capitalize, digits, find, join, letters, lower, atoi, split from plural import pluralize # Utilities
return s[:-2]
if s[-3] in ('o', 'x'):
return s[:-2]
if s[-3] == 's' and find('aeiouy', s[-4]) == -1:
return s[:-2]
if s[-3] == 'i':
return s[:-3]+'y'
def parse_part(self, text):
# Returns (one-letter-code, data,...), remaining-text
if not text:
raise 'Parse'
code, text = text[:1], text[1:]
if find('sonidprq', lower(code)) >= 0:
cap = (lower(code) != code)
return (lower(code), cap), text
if code=='#':
return (code, None), text
if find(":.'", code) >= 0 and text[:1] == '(':
i = find(text, ')')
if i < 0:
raise 'Parse', 'could not find )'
return (code, text[1:i]), text[i+1:]
if find("lLc", code) >= 0:
result, text = self.parse_part(text)
return (code, result), text
if code == "'" and find('nid', lower(text[:1])) >= 0:
cap = (lower(text[:1]) != text[:1])
return (code + lower(text[:1]), cap), text[1:]
if code == 'x' and text[:1] == '{':
i = find(text, '}')
def parse(self, text):
if type(text) == type([]):
return text # already parsed
i = find(text, '%')
result = []
while i >= 0:
result.append(text[:i])
r,text = self.parse_selector(text[i+1:])
for x in r:
result.append(x)
i = find(text, '%')
# Find the first alphanumeric
okay = letters+digits
i = 0
while i < len(name) and (find(okay,name[i]) == -1):
i = i+1
# Now use that first useful char to determine a or an
use_an = ( name[i:i+1] in _english.vowel_list or
def get_verb(self, verbname, plural):
# Handle exceptions first
i = find(verbname, '/')
if i >= 0:
if plural:
return verbname[i+1:]
else:
def get_noun(self, nounname, plural):
# Handle exceptions first
i = find(nounname, '/')
if i >= 0:
if plural:
return nounname[i+1:]
else:
src/r/d/rdflib-HEAD/rdflib/syntax/parsers/notation3.py rdflib(Download)
import time import StringIO from string import find, rfind from decimal import Decimal from rdflib.term import URIRef, BNode, Literal, Variable
u'http://example.org/#Andr\\xe9'
"""
assert(find(here, "#") < 0), "Base may not contain hash: '%s'"% here # caller must splitFrag (why?)
slashl = find(there, '/')
colonl = find(there, ':')
# join(base, 'foo:/') -- absolute
if colonl >= 0 and (slashl < 0 or colonl < slashl):
return there
bcolonl = find(here, ':')
raise ValueError ("Base <%s> has no slash after colon - with relative '%s'." %(here, there))
if here[bcolonl+1:bcolonl+3] == '//':
bpath = find(here, '/', bcolonl+3)
else:
bpath = bcolonl+1
while i>0 and uri[i-1] != '/' : i=i-1 # scan for slash
if i < 3: return uri # No way.
if string.find(base, "//", i-2)>0 \
or string.find(uri, "//", i-2)>0: return uri # An unshared "//"
if string.find(base, ":", i)>0: return uri # An unshared ":"
n = string.count(base, "/", i)
res.append(self._variables[symb])
else:
res.append(symb) # @@@ "#" CONVENTION
if not string.find(ns, "#"):progress(
"Warning: no # on namespace %s," % ns)
return j
if not ch:
raise BadSyntax(self._thisDoc, startline, str, i,
"unterminated string literal (2)")
k = string.find('abfrtvn\\"', ch)
if k >= 0:
uch = '\a\b\f\r\t\v\n\\"'[k]
ustr = ustr + uch
if ch == "":
raise BadSyntax(self._thisDoc, startline, str, i,
"unterminated string literal(3)")
k = string.find("0123456789abcdef", ch)
if k < 0:
raise BadSyntax(self._thisDoc, startline, str, i,
"bad string literal hex escape")
if ch == "":
raise BadSyntax(self._thisDoc, startline, str, i,
"unterminated string literal(3)")
k = string.find("0123456789abcdef", ch)
if k < 0:
raise BadSyntax(self._thisDoc, startline, str, i,
"bad string literal hex escape")
def stringToN3(str, singleLine=0, flags=""):
res = ''
if (len(str) > 20 and
str[-1] <> '"' and
not singleLine and
(string.find(str, "\n") >=0
or string.find(str, '"') >=0)):
if ch == '"' and delim == '"""' and str[j:j+3] != '"""': #"
res = res + ch
else:
k = string.find('\a\b\f\r\t\v\n\\"', ch)
if k >= 0: res = res + "\\" + 'abfrtvn\\"'[k]
else:
if 'e' in flags:
def dummy():
res = ""
if len(str) > 20 and (string.find(str, "\n") >=0
or string.find(str, '"') >=0):
delim= '"""'
forbidden = "\\\"\a\b\f\r\v" # (allow tabs too now)
else:
delim = '"'
forbidden = "\\\"\a\b\f\r\v\t\n"
for i in range(len(str)):
ch = str[i]
j = string.find(forbidden, ch)
src/p/y/pymoo-HEAD/pymoo/lib/msg.py pymoo(Download)
""" from string import capitalize, digits, find, join, letters, lower, atoi, split from plural import pluralize # Utilities
return s[:-2]
if s[-3] in ('o', 'x'):
return s[:-2]
if s[-3] == 's' and find('aeiouy', s[-4]) == -1:
return s[:-2]
if s[-3] == 'i':
return s[:-3]+'y'
def parse_part(self, text):
# Returns (one-letter-code, data,...), remaining-text
if not text:
raise 'Parse'
code, text = text[:1], text[1:]
if find('sonidprq', lower(code)) >= 0:
cap = (lower(code) != code)
return (lower(code), cap), text
if code=='#':
return (code, None), text
if find(":.'", code) >= 0 and text[:1] == '(':
i = find(text, ')')
if i < 0:
raise 'Parse', 'could not find )'
return (code, text[1:i]), text[i+1:]
if find("lLc", code) >= 0:
result, text = self.parse_part(text)
return (code, result), text
if code == "'" and find('nid', lower(text[:1])) >= 0:
cap = (lower(text[:1]) != text[:1])
return (code + lower(text[:1]), cap), text[1:]
if code == 'x' and text[:1] == '{':
i = find(text, '}')
def parse(self, text):
if type(text) == type([]):
return text # already parsed
i = find(text, '%')
result = []
while i >= 0:
result.append(text[:i])
r,text = self.parse_selector(text[i+1:])
for x in r:
result.append(x)
i = find(text, '%')
# Find the first alphanumeric
okay = letters+digits
i = 0
while i < len(name) and (find(okay,name[i]) == -1):
i = i+1
# Now use that first useful char to determine a or an
use_an = ( name[i:i+1] in _english.vowel_list or
def get_verb(self, verbname, plural):
# Handle exceptions first
i = find(verbname, '/')
if i >= 0:
if plural:
return verbname[i+1:]
else:
def get_noun(self, nounname, plural):
# Handle exceptions first
i = find(nounname, '/')
if i >= 0:
if plural:
return nounname[i+1:]
else:
src/p/y/py5-HEAD/Mac/Tools/IDE/PyEdit.py py5(Download)
self._creator, filetype = MacOS.GetCreatorAndType(path)
self.addrecentfile(path)
if '\n' in text:
if string.find(text, '\r\n') >= 0:
self._eoln = '\r\n'
else:
self._eoln = '\n'
def getclasslist(self):
from string import find, strip
methodRE = re.compile(r"\r[ \t]+def ")
findMethod = methodRE.search
editor = self.editgroup.editor
text = editor.get()
list = []
append((pos + 4, functag))
pos = 4
while 1:
pos = find(text, '\rdef ', pos + 1)
if pos < 0:
break
append((pos + 5, functag))
pos = -1
if text[:6] == 'class ':
append((pos + 6, classtag))
pos = 6
while 1:
pos = find(text, '\rclass ', pos + 1)
else:
pos = -1
else:
pos = string.find(text, find, pos)
if pos < 0:
break
counter = counter + 1
else:
pos = -1
else:
pos = string.find(text, find, selend)
if pos >= 0:
editor.setselection(pos, pos + len(find))
return 1
else:
pos = -1
else:
pos = string.find(text, find)
if selstart > pos >= 0:
editor.setselection(pos, pos + len(find))
return 1
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Next