All Samples(3304) | Call(3250) | Derive(0) | Import(54)
Return a list of all non-overlapping matches in the string. If one or more groups are present in the pattern, return a list of groups; this will be a list of tuples if the pattern has more than one group. Empty matches are included in the result.
def findall(pattern, string, flags=0):
"""Return a list of all non-overlapping matches in the string.
If one or more groups are present in the pattern, return a
list of groups; this will be a list of tuples if the pattern
has more than one group.
Empty matches are included in the result."""
return _compile(pattern, flags).findall(string)
def testGetPageSource(self):
self._loadSimplePage()
source = self.driver.get_page_source()
matches = re.findall(r'<html>.*</html>', source, re.DOTALL|re.I)
self.assertTrue(len(matches) > 0)
def testIsEnabled(self):
src/s/e/selenium-2.0a5/common/test/py/api_examples.py selenium(Download)
def testGetPageSource(self):
self._loadSimplePage()
source = self.driver.get_page_source()
matches = re.findall(r'<html>.*</html>', source, re.DOTALL|re.I)
self.assertTrue(len(matches) > 0)
def testIsEnabled(self):
src/p/e/pexpect-HEAD/pexpect/examples/rippy.py pexpect(Download)
missing.append("mplayer")
cmd = "mencoder -oac help"
(command_output, exitstatus) = run(cmd)
ar = re.findall("(mp3lame)", command_output)
if len(ar)==0:
missing.append("Mencoder was not compiled with mp3lame support.")
"""
cmd = "mplayer '%s' -vo png -ao null -frames 1" % video_source_filename
(command_output, exitstatus) = run(cmd)
ar = re.findall("Movie-Aspect is ([0-9]+\.?[0-9]*:[0-9]+\.?[0-9]*)", command_output)
if len(ar)==0:
return '16/9'
if ar[0] == '1.78:1':
def get_aid_list (video_source_filename):
"""This returns a list of audio ids in the source video file.
TODO: Also extract ID_AID_nnn_LANG to associate language. Not all DVDs include this.
"""
cmd = "mplayer '%s' -vo null -ao null -frames 0 -identify" % video_source_filename
(command_output, exitstatus) = run(cmd)
idl = re.findall("ID_AUDIO_ID=([0-9]+)", command_output)
def get_sid_list (video_source_filename):
"""This returns a list of subtitle ids in the source video file.
TODO: Also extract ID_SID_nnn_LANG to associate language. Not all DVDs include this.
"""
cmd = "mplayer '%s' -vo null -ao null -frames 0 -identify" % video_source_filename
(command_output, exitstatus) = run(cmd)
idl = re.findall("ID_SUBTITLE_ID=([0-9]+)", command_output)
"""
cmd = "mplayer %s -vo null -ao null -frames 0 -identify" % audio_raw_filename
(command_output, exitstatus) = run(cmd)
idl = re.findall("ID_LENGTH=([0-9.]*)", command_output)
idl.sort()
if len(idl) != 1:
print "ERROR: cannot get length of raw audio file."
(command_output3, exitstatus3) = run(cmd3)
(command_output4, exitstatus4) = run(cmd4)
(command_output5, exitstatus5) = run(cmd5)
idl = re.findall("-vf crop=([0-9]+:[0-9]+:[0-9]+:[0-9]+)", command_output1)
idl = idl + re.findall("-vf crop=([0-9]+:[0-9]+:[0-9]+:[0-9]+)", command_output2)
idl = idl + re.findall("-vf crop=([0-9]+:[0-9]+:[0-9]+:[0-9]+)", command_output3)
idl = idl + re.findall("-vf crop=([0-9]+:[0-9]+:[0-9]+:[0-9]+)", command_output4)
idl = idl + re.findall("-vf crop=([0-9]+:[0-9]+:[0-9]+:[0-9]+)", command_output5)
if d['video_scale'][0]=='n':
d['video_scale']='none'
else:
al = re.findall("([0-9]+).*?([0-9]+)", d['video_scale'])
d['video_scale']=al[0][0]+':'+al[0][1]
d['video_crop_area'] = d['video_crop_area'].lower()
if d['video_crop_area'][0]=='n':
if len(args) > 0:
# cute one-line string-to-dictionary parser (two-lines if you count this comment):
options = dict(re.findall('([^: \t\n]*)\s*:\s*(".*"|[^ \t\n]*)', file(args[0]).read()))
options = clean_options(options)
convert (options)
else:
src/c/o/codetalker-HEAD/tests/data/getcexamples.py codetalker(Download)
def get_code(num):
print 'get page...'
url = 'http://www.c.happycodings.com/code_snippets/code%d.html' % num
text = upen(url).read()
print 'got'
code = re.findall('<TEXTAREA[^>]*>(.+?)</TEXTAREA>', text, re.S)
return code[0]
src/p/e/pexpect-2.4/examples/rippy.py pexpect(Download)
missing.append("mplayer")
cmd = "mencoder -oac help"
(command_output, exitstatus) = run(cmd)
ar = re.findall("(mp3lame)", command_output)
if len(ar)==0:
missing.append("Mencoder was not compiled with mp3lame support.")
"""
cmd = "mplayer '%s' -vo png -ao null -frames 1" % video_source_filename
(command_output, exitstatus) = run(cmd)
ar = re.findall("Movie-Aspect is ([0-9]+\.?[0-9]*:[0-9]+\.?[0-9]*)", command_output)
if len(ar)==0:
return '16/9'
if ar[0] == '1.78:1':
def get_aid_list (video_source_filename):
"""This returns a list of audio ids in the source video file.
TODO: Also extract ID_AID_nnn_LANG to associate language. Not all DVDs include this.
"""
cmd = "mplayer '%s' -vo null -ao null -frames 0 -identify" % video_source_filename
(command_output, exitstatus) = run(cmd)
idl = re.findall("ID_AUDIO_ID=([0-9]+)", command_output)
def get_sid_list (video_source_filename):
"""This returns a list of subtitle ids in the source video file.
TODO: Also extract ID_SID_nnn_LANG to associate language. Not all DVDs include this.
"""
cmd = "mplayer '%s' -vo null -ao null -frames 0 -identify" % video_source_filename
(command_output, exitstatus) = run(cmd)
idl = re.findall("ID_SUBTITLE_ID=([0-9]+)", command_output)
"""
cmd = "mplayer %s -vo null -ao null -frames 0 -identify" % audio_raw_filename
(command_output, exitstatus) = run(cmd)
idl = re.findall("ID_LENGTH=([0-9.]*)", command_output)
idl.sort()
if len(idl) != 1:
print "ERROR: cannot get length of raw audio file."
(command_output3, exitstatus3) = run(cmd3)
(command_output4, exitstatus4) = run(cmd4)
(command_output5, exitstatus5) = run(cmd5)
idl = re.findall("-vf crop=([0-9]+:[0-9]+:[0-9]+:[0-9]+)", command_output1)
idl = idl + re.findall("-vf crop=([0-9]+:[0-9]+:[0-9]+:[0-9]+)", command_output2)
idl = idl + re.findall("-vf crop=([0-9]+:[0-9]+:[0-9]+:[0-9]+)", command_output3)
idl = idl + re.findall("-vf crop=([0-9]+:[0-9]+:[0-9]+:[0-9]+)", command_output4)
idl = idl + re.findall("-vf crop=([0-9]+:[0-9]+:[0-9]+:[0-9]+)", command_output5)
if d['video_scale'][0]=='n':
d['video_scale']='none'
else:
al = re.findall("([0-9]+).*?([0-9]+)", d['video_scale'])
d['video_scale']=al[0][0]+':'+al[0][1]
d['video_crop_area'] = d['video_crop_area'].lower()
if d['video_crop_area'][0]=='n':
if len(args) > 0:
# cute one-line string-to-dictionary parser (two-lines if you count this comment):
options = dict(re.findall('([^: \t\n]*)\s*:\s*(".*"|[^ \t\n]*)', file(args[0]).read()))
options = clean_options(options)
convert (options)
else:
src/c/o/CodeTalker-1.0/tests/data/getcexamples.py CodeTalker(Download)
def get_code(num):
print 'get page...'
url = 'http://www.c.happycodings.com/code_snippets/code%d.html' % num
text = upen(url).read()
print 'got'
code = re.findall('<TEXTAREA[^>]*>(.+?)</TEXTAREA>', text, re.S)
return code[0]
src/c/y/cycad-HEAD/trunk/src/pexpect-2.0/examples/rippy.py cycad(Download)
def get_aid_list (video_source_filename):
"""This returns a list of audio ids in the source video file.
"""
result = run ("mplayer %s -vo null -ao null -frames 0 -identify" % video_source_filename)
idl = re.findall("ID_AUDIO_ID=([0-9]*)", result)
idl.sort()
return idl
This returns -1 if it cannot get the length of the given file.
"""
result = run ("mplayer %s -vo null -ao null -frames 0 -identify" % audio_raw_filename)
idl = re.findall("ID_LENGTH=([0-9]*)", result)
idl.sort()
if len(idl) != 1:
return -1
result1 = run(cmd1)
result2 = run(cmd2)
result3 = run(cmd3)
idl = re.findall("-vf crop=([0-9]+:[0-9]+:[0-9]+:[0-9]+)", result1)
idl = idl + re.findall("-vf crop=([0-9]+:[0-9]+:[0-9]+:[0-9]+)", result2)
idl = idl + re.findall("-vf crop=([0-9]+:[0-9]+:[0-9]+:[0-9]+)", result3)
items_count = count_unique(idl)
if d['video_scale'][0]=='n':
d['video_scale']='none'
else:
al = re.findall("([0-9]+).*?([0-9]+)", d['video_scale'])
d['video_scale']=al[0][0]+':'+al[0][1]
d['video_crop_area'] = d['video_crop_area'].lower()
if d['video_crop_area'][0]=='n':
os._exit(1)
if len(args) > 0:
options = dict(re.findall('([^: \t\n]*)\s*:\s*(".*"|[^ \t\n]*)', file(args[0]).read()))
options = clean_options(options)
convert (options)
else:
src/c/y/cycad-HEAD/src/pexpect-2.0/examples/rippy.py cycad(Download)
def get_aid_list (video_source_filename):
"""This returns a list of audio ids in the source video file.
"""
result = run ("mplayer %s -vo null -ao null -frames 0 -identify" % video_source_filename)
idl = re.findall("ID_AUDIO_ID=([0-9]*)", result)
idl.sort()
return idl
This returns -1 if it cannot get the length of the given file.
"""
result = run ("mplayer %s -vo null -ao null -frames 0 -identify" % audio_raw_filename)
idl = re.findall("ID_LENGTH=([0-9]*)", result)
idl.sort()
if len(idl) != 1:
return -1
result1 = run(cmd1)
result2 = run(cmd2)
result3 = run(cmd3)
idl = re.findall("-vf crop=([0-9]+:[0-9]+:[0-9]+:[0-9]+)", result1)
idl = idl + re.findall("-vf crop=([0-9]+:[0-9]+:[0-9]+:[0-9]+)", result2)
idl = idl + re.findall("-vf crop=([0-9]+:[0-9]+:[0-9]+:[0-9]+)", result3)
items_count = count_unique(idl)
if d['video_scale'][0]=='n':
d['video_scale']='none'
else:
al = re.findall("([0-9]+).*?([0-9]+)", d['video_scale'])
d['video_scale']=al[0][0]+':'+al[0][1]
d['video_crop_area'] = d['video_crop_area'].lower()
if d['video_crop_area'][0]=='n':
os._exit(1)
if len(args) > 0:
options = dict(re.findall('([^: \t\n]*)\s*:\s*(".*"|[^ \t\n]*)', file(args[0]).read()))
options = clean_options(options)
convert (options)
else:
src/p/o/pony-build-HEAD/examples/push-cgi-notifier/feedparser.py pony-build(Download)
assert sys.version.split()[0] >= '2.3.3'
assert base64 != None
user, passw = base64.decodestring(req.headers['Authorization'].split(' ')[1]).split(':')
realm = re.findall('realm="([^"]*)"', headers['WWW-Authenticate'])[0]
self.add_password(realm, host, user, passw)
retry = self.http_error_auth_reqed('www-authenticate', host, req, headers)
self.reset_retry_count()
src/p/u/publicmapping-HEAD/trunk/django/publicmapping/redistricting/static/OpenLayers-2.9.1/tools/exampleparser.py publicmapping(Download)
def getRelatedClasses(html):
"""
parses the html, and returns a list of all OpenLayers Classes
used within (ie what parts of OL the javascript uses).
"""
rawstr = r'''(?P<class>OpenLayers\..*?)\('''
return re.findall(rawstr, html)
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Next