rem
stringlengths
1
226k
add
stringlengths
0
227k
context
stringlengths
6
326k
meta
stringlengths
143
403
input_ids
listlengths
256
256
attention_mask
listlengths
256
256
labels
listlengths
128
128
self.startTagCommon(name, attrList, self.endsep) def do_startTag(self, name, attrList): self.startTagCommon(name, attrList, ">") def startTagCommon(self, name, attrList, end):
self.do_startTag(name, attrList, self.endsep) bytecode_handlers["startEndTag"] = do_startEndTag def do_startTag(self, name, attrList, end=">"):
def do_startEndTag(self, name, attrList): self.startTagCommon(name, attrList, self.endsep)
9e161e97a6a5d5ad093527696fe023a7f75f261c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9658/9e161e97a6a5d5ad093527696fe023a7f75f261c/TALInterpreter.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 741, 67, 1937, 25633, 12, 2890, 16, 508, 16, 1604, 682, 4672, 365, 18, 1937, 1805, 6517, 12, 529, 16, 1604, 682, 16, 365, 18, 409, 10814, 13, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 741, 67, 1937, 25633, 12, 2890, 16, 508, 16, 1604, 682, 4672, 365, 18, 1937, 1805, 6517, 12, 529, 16, 1604, 682, 16, 365, 18, 409, 10814, 13, 2, -100, -100, -100, -100, -100, -100, -...
'eventType', 'eventNumber', 'reqComment', 'reqDesc',
'eventType', 'eventNumber', 'reqComment', 'reqDesc', 'reqInform',
def SelectAndSort(rows,default_sort): total = len(rows) if total == 0: return { 'OK':True, 'result':{}, 'total': 0 } try: start = int(request.params.get('start', 0)) limit = int(request.params.get('limit', total)) sort = request.params.get('sort', default_sort) dir = request.params.get('dir', 'ASC') if not sort in rows[0]: raise Exception('Sort field '+sort+' is not found') except Exception, e: return S_ERROR('Badly formatted list request: '+str(e)) rows.sort(key=lambda x: x[sort], reverse=(dir!='ASC')) return { 'OK':True, 'result':rows[start:start+limit], 'total': total }
b9761aa9ab4861edf3c2372da881c23cf931a85c /local1/tlutelli/issta_data/temp/all_python//python/2009_temp/2009/12767/b9761aa9ab4861edf3c2372da881c23cf931a85c/ProductionRequest.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 6766, 1876, 4416, 12, 3870, 16, 1886, 67, 3804, 4672, 2078, 273, 562, 12, 3870, 13, 309, 2078, 422, 374, 30, 327, 288, 296, 3141, 4278, 5510, 16, 296, 2088, 4278, 2916, 16, 296, 4963, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 6766, 1876, 4416, 12, 3870, 16, 1886, 67, 3804, 4672, 2078, 273, 562, 12, 3870, 13, 309, 2078, 422, 374, 30, 327, 288, 296, 3141, 4278, 5510, 16, 296, 2088, 4278, 2916, 16, 296, 4963, ...
repme = "\n*[[:Image:%s]] seems to have problems ('''no data found in the image''')"
repme = "\n*[[:Image:%s]] problems '''with the APIs'''"
def tag_image(self, put = True): """ Function to add the template in the image and to find out who's the user that has uploaded the image. """ # Defing the image's Page Object p = wikipedia.ImagePage(self.site, 'Image:%s' % self.image) # Get the image's description try: testoa = p.get() except wikipedia.NoPage: wikipedia.output(u'%s has been deleted...' % p.title()) # We have a problem! Report and exit! return False # You can use this function also to find only the user that # has upload the image (FixME: Rewrite a bit this part) if put: p.put(testoa + self.newtext, comment = self.commImage, minorEdit = True) # paginetta it's the image page object. paginetta = wikipedia.ImagePage(self.site, self.image_namespace + self.image) # I take the data of the latest uploader and I take only the name imagedata = paginetta.getFileVersionHistory() #print imagedata # Let it so for de-buggin porpuse (wikipedia.output gives error) # When an Image is deleted from Commons and someone has add something in the wikipedia page # The bot doesn't catch the data properly :-) if imagedata == list(): wikipedia.output(u"Seems that %s hasn't the image at all, but there is something in the description..." % self.image) repme = "\n*[[:Image:%s]] seems to have problems ('''no data found in the image''')" self.report_image(self.image, self.rep_page, self.com, repme) # We have a problem! Report and exit! return False try: nick = paginetta.getFileVersionHistory()[0][1] # Get the latest uploader except IndexError: wikipedia.output(u"Seems that %s hasn't the image at all, but there is something in the description..." % self.image) repme = "\n*[[:Image:%s]] seems to have problems ('''no data found in the image''')" # We have a problem! Report and exit! self.report_image(self.image, self.rep_page, self.com, repme) return False luser = wikipedia.url2link(nick, self.site, self.site) pagina_discussione = "%s:%s" % (self.site.namespace(3), luser) # Defing the talk page (pagina_discussione = talk_page ^__^ ) talk_page = wikipedia.Page(self.site, pagina_discussione) self.talk_page = talk_page self.luser = luser return True
c32a9657c984361a1f0ef309792e0888c4e841f9 /local1/tlutelli/issta_data/temp/all_python//python/2008_temp/2008/4404/c32a9657c984361a1f0ef309792e0888c4e841f9/checkimages.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1047, 67, 2730, 12, 2890, 16, 1378, 273, 1053, 4672, 3536, 4284, 358, 527, 326, 1542, 316, 326, 1316, 471, 358, 1104, 596, 10354, 1807, 326, 729, 716, 711, 9140, 326, 1316, 18, 3536, 4...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1047, 67, 2730, 12, 2890, 16, 1378, 273, 1053, 4672, 3536, 4284, 358, 527, 326, 1542, 316, 326, 1316, 471, 358, 1104, 596, 10354, 1807, 326, 729, 716, 711, 9140, 326, 1316, 18, 3536, 4...
self.scale /= aspect self.pov = V(-part.center[0], -part.center[1], -part.center[2]) self.setZoomFactor(1.0) self.gl_update()
scale /= aspect pov = V(-part.center[0], -part.center[1], -part.center[2]) self.animateView(self.quat, scale, pov, 1.0)
def setViewFitToWindow(self): "Change current view so that our model's bbox fits in our window, and gl_update." #Recalculate center and bounding box for the current part part = self.part part.computeBoundingBox() self.scale = float( part.bbox.scale() ) #bruce 050616 added float() as a precaution, probably not needed # appropriate height to show everything, for square or wide glpane [bruce 050616 comment] aspect = float(self.width) / self.height if aspect < 1.0: # tall (narrow) glpane -- need to increase self.scale # (defined in terms of glpane height) so part bbox fits in width # [bruce 050616 comment] self.scale /= aspect self.pov = V(-part.center[0], -part.center[1], -part.center[2]) self.setZoomFactor(1.0) self.gl_update()
dc06c760dbe5ded748eaa71389af2211878d2189 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11221/dc06c760dbe5ded748eaa71389af2211878d2189/GLPane.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 19923, 14219, 774, 3829, 12, 2890, 4672, 315, 3043, 783, 1476, 1427, 716, 3134, 938, 1807, 8472, 13351, 316, 3134, 2742, 16, 471, 5118, 67, 2725, 1199, 468, 426, 11162, 4617, 471, 7552, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 19923, 14219, 774, 3829, 12, 2890, 4672, 315, 3043, 783, 1476, 1427, 716, 3134, 938, 1807, 8472, 13351, 316, 3134, 2742, 16, 471, 5118, 67, 2725, 1199, 468, 426, 11162, 4617, 471, 7552, ...
'property editor: set value', value
def setValue(self, value): 'property editor: set value', value self.value = value if self.editorCtrl: self.editorCtrl.SetValue(self.value)
43e4ab46eed5e41d2af40091522912ba9175fcc3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/4325/43e4ab46eed5e41d2af40091522912ba9175fcc3/PropertyEditors.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 5524, 12, 2890, 16, 460, 4672, 365, 18, 1132, 273, 460, 309, 365, 18, 9177, 12418, 30, 365, 18, 9177, 12418, 18, 694, 620, 12, 2890, 18, 1132, 13, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 5524, 12, 2890, 16, 460, 4672, 365, 18, 1132, 273, 460, 309, 365, 18, 9177, 12418, 30, 365, 18, 9177, 12418, 18, 694, 620, 12, 2890, 18, 1132, 13, 2, -100, -100, -100, -100, -100, -1...
self.send_document(describe(x), html.document(x))
self.send_document(describe(x), html.document(x, path))
def do_GET(self): path = self.path if path[-5:] == '.html': path = path[:-5] if path[:1] == '/': path = path[1:] if path and path != '.': try: p, x = locate(path) except DocImportError, value: self.send_document(path, html.escape( 'Problem in %s - %s' % (value.filename, value.args))) return if x: self.send_document(describe(x), html.document(x)) else: self.send_document(path,
2c3f3ddf9452a1f3f228e0d8c7abdbeed214a6b7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3187/2c3f3ddf9452a1f3f228e0d8c7abdbeed214a6b7/pydoc.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 741, 67, 3264, 12, 2890, 4672, 589, 273, 365, 18, 803, 309, 589, 18919, 25, 26894, 422, 2418, 2620, 4278, 589, 273, 589, 10531, 17, 25, 65, 309, 589, 10531, 21, 65, 422, 2023, 30, 58...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 741, 67, 3264, 12, 2890, 4672, 589, 273, 365, 18, 803, 309, 589, 18919, 25, 26894, 422, 2418, 2620, 4278, 589, 273, 589, 10531, 17, 25, 65, 309, 589, 10531, 21, 65, 422, 2023, 30, 58...
return [self._eval(i) for i in srange(Integer(1),n+1)]
return [self._eval(i) for i in srange(self.offset, n+self.offset)]
def list(self, n): return [self._eval(i) for i in srange(Integer(1),n+1)]
e5d5b60c16d66a2bb879d4bdc18e2f9b3b075cd6 /local1/tlutelli/issta_data/temp/all_python//python/2007_temp/2007/9890/e5d5b60c16d66a2bb879d4bdc18e2f9b3b075cd6/sloane_functions.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 666, 12, 2890, 16, 290, 4672, 327, 306, 2890, 6315, 8622, 12, 77, 13, 364, 277, 316, 272, 3676, 12, 4522, 12, 21, 3631, 82, 15, 21, 25887, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 666, 12, 2890, 16, 290, 4672, 327, 306, 2890, 6315, 8622, 12, 77, 13, 364, 277, 316, 272, 3676, 12, 4522, 12, 21, 3631, 82, 15, 21, 25887, 2, -100, -100, -100, -100, -100, -100, -100...
return rfe(data, self.limit)
filterd = self.filter(range(len(self.data)), self.limit) return rfe(data, len(filterd))
def __call__(self, data, weightId=None): from orngSVM import RFE rfe = RFE() return rfe(data, self.limit)
040b4fbf2aa44ad50b9f46c3dfe85ba5dcbacbec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6366/040b4fbf2aa44ad50b9f46c3dfe85ba5dcbacbec/OWPreprocess.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1001, 1991, 972, 12, 2890, 16, 501, 16, 3119, 548, 33, 7036, 4672, 628, 578, 3368, 55, 7397, 1930, 534, 8090, 436, 3030, 273, 534, 8090, 1435, 1034, 72, 273, 365, 18, 2188, 12, 3676, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1001, 1991, 972, 12, 2890, 16, 501, 16, 3119, 548, 33, 7036, 4672, 628, 578, 3368, 55, 7397, 1930, 534, 8090, 436, 3030, 273, 534, 8090, 1435, 1034, 72, 273, 365, 18, 2188, 12, 3676, ...
coeffients are not considered (default: False).
coeffients are not considered (default: False).
def _singular_(self, singular=singular_default, have_ring=False, force=False): """ Return Singular polynomial matching this polynomial.
b8eaa1d317a4562175e2142f48231d5a39ec4cd9 /local1/tlutelli/issta_data/temp/all_python//python/2007_temp/2007/9890/b8eaa1d317a4562175e2142f48231d5a39ec4cd9/polynomial_singular_interface.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 389, 17835, 67, 12, 2890, 16, 10048, 33, 17835, 67, 1886, 16, 1240, 67, 8022, 33, 8381, 16, 2944, 33, 8381, 4672, 3536, 2000, 348, 17830, 16991, 3607, 333, 16991, 18, 2, 0, 0, 0, 0, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 389, 17835, 67, 12, 2890, 16, 10048, 33, 17835, 67, 1886, 16, 1240, 67, 8022, 33, 8381, 16, 2944, 33, 8381, 4672, 3536, 2000, 348, 17830, 16991, 3607, 333, 16991, 18, 2, -100, -100, -1...
def _check_has_start(self, cr, uid, ids, context=None): for campaign in self.browse(cr, uid, ids, context=context): if not any(a.start for a in campaign.activity_ids): return False return True
def __str__(self): return self._str
9f6839faa1900a1dc012884b012b4d0d255c1acc /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/9f6839faa1900a1dc012884b012b4d0d255c1acc/marketing_campaign.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1001, 701, 972, 12, 2890, 4672, 327, 365, 6315, 701, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1001, 701, 972, 12, 2890, 4672, 327, 365, 6315, 701, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, ...
if dep not in self.runq_revdeps[dep]: self.runq_revdeps[dep].append(listid)
self.runq_revdeps[dep].add(listid)
def mark_active(listid, depth): """ Mark an item as active along with its depends (calls itself recursively) """
1a3deae075da2346cac60d69782906b71e9db782 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/2672/1a3deae075da2346cac60d69782906b71e9db782/runqueue.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 2267, 67, 3535, 12, 1098, 350, 16, 3598, 4672, 3536, 6622, 392, 761, 487, 2695, 7563, 598, 2097, 10935, 261, 12550, 6174, 8536, 13, 3536, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 2267, 67, 3535, 12, 1098, 350, 16, 3598, 4672, 3536, 6622, 392, 761, 487, 2695, 7563, 598, 2097, 10935, 261, 12550, 6174, 8536, 13, 3536, 2, -100, -100, -100, -100, -100, -100, -100, -10...
if self.draw==1: self.bezier()
def pen_up(self,x='',y=''): if self.draw==1: self.bezier() self.draw=0 if x !='' is not None: x,y=self.get_position(x,y) self.move(x,y)
5d0449986c9a1f53d8c2d77fa8f905fd8f885f79 /local1/tlutelli/issta_data/temp/all_python//python/2009_temp/2009/3123/5d0449986c9a1f53d8c2d77fa8f905fd8f885f79/pltloader.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 14264, 67, 416, 12, 2890, 16, 92, 2218, 2187, 93, 2218, 11, 4672, 365, 18, 9446, 33, 20, 309, 619, 480, 6309, 353, 486, 599, 30, 619, 16, 93, 33, 2890, 18, 588, 67, 3276, 12, 92, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 14264, 67, 416, 12, 2890, 16, 92, 2218, 2187, 93, 2218, 11, 4672, 365, 18, 9446, 33, 20, 309, 619, 480, 6309, 353, 486, 599, 30, 619, 16, 93, 33, 2890, 18, 588, 67, 3276, 12, 92, ...
"virConnect" : True
"virConnect" : True, "virDomainSnapshot": True,
def buildStubs(): global py_types global py_return_types global unknown_types try: f = open(os.path.join(srcPref,"libvirt-api.xml")) data = f.read() (parser, target) = getparser() parser.feed(data) parser.close() except IOError, msg: try: f = open(os.path.join(srcPref,"..","docs","libvirt-api.xml")) data = f.read() (parser, target) = getparser() parser.feed(data) parser.close() except IOError, msg: print file, ":", msg sys.exit(1) n = len(functions.keys()) print "Found %d functions in libvirt-api.xml" % (n) py_types['pythonObject'] = ('O', "pythonObject", "pythonObject", "pythonObject") try: f = open(os.path.join(srcPref,"libvirt-override-api.xml")) data = f.read() (parser, target) = getparser() parser.feed(data) parser.close() except IOError, msg: print file, ":", msg print "Found %d functions in libvirt-override-api.xml" % ( len(functions.keys()) - n) nb_wrap = 0 failed = 0 skipped = 0 include = open("libvirt.h", "w") include.write("/* Generated */\n\n") export = open("libvirt-export.c", "w") export.write("/* Generated */\n\n") wrapper = open("libvirt.c", "w") wrapper.write("/* Generated */\n\n") wrapper.write("#include <Python.h>\n") wrapper.write("#include <libvirt/libvirt.h>\n") wrapper.write("#include \"typewrappers.h\"\n") wrapper.write("#include \"libvirt.h\"\n\n") for function in functions.keys(): ret = print_function_wrapper(function, wrapper, export, include) if ret < 0: failed = failed + 1 functions_failed.append(function) del functions[function] if ret == 0: skipped = skipped + 1 functions_skipped.append(function) del functions[function] if ret == 1: nb_wrap = nb_wrap + 1 include.close() export.close() wrapper.close() print "Generated %d wrapper functions" % nb_wrap print "Missing type converters: " for type in unknown_types.keys(): print "%s:%d " % (type, len(unknown_types[type])), print for f in functions_failed: print "ERROR: failed %s" % f if failed > 0: return -1 return 0
a4079e7ec63c7ecdc5fcd23b33831c58e3679d46 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8293/a4079e7ec63c7ecdc5fcd23b33831c58e3679d46/generator.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1361, 11974, 87, 13332, 2552, 2395, 67, 2352, 2552, 2395, 67, 2463, 67, 2352, 2552, 5917, 67, 2352, 225, 775, 30, 284, 273, 1696, 12, 538, 18, 803, 18, 5701, 12, 4816, 23218, 10837, 29...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1361, 11974, 87, 13332, 2552, 2395, 67, 2352, 2552, 2395, 67, 2463, 67, 2352, 2552, 5917, 67, 2352, 225, 775, 30, 284, 273, 1696, 12, 538, 18, 803, 18, 5701, 12, 4816, 23218, 10837, 29...
os.close(self.rpmout)
self.rpmout.close()
def grabOutput(self, flag): if flag: if not self.rpmout: # Grab rpm output, but not the python one. import codecs, locale encoding = locale.getpreferredencoding() sys.stdout = codecs.getwriter(encoding)(os.fdopen(os.dup(1), "w")) sys.stderr = codecs.getwriter(encoding)(os.fdopen(os.dup(2), "w")) self.stdout = sys.stdout self.stderr = sys.stderr pipe = os.pipe() os.dup2(pipe[1], 1) os.dup2(pipe[1], 2) os.close(pipe[1]) self.rpmout = pipe[0] setCloseOnExec(self.rpmout) flags = fcntl.fcntl(self.rpmout, fcntl.F_GETFL, 0) flags |= os.O_NONBLOCK fcntl.fcntl(self.rpmout, fcntl.F_SETFL, flags) else: if self.rpmout: self._rpmout() os.dup2(sys.stdout.fileno(), 1) os.dup2(sys.stderr.fileno(), 2) #sys.stdout.close() #sys.stderr.close() sys.stdout = self.stdout sys.stderr = self.stderr del self.stdout del self.stderr os.close(self.rpmout) self.rpmout = None
0062dcc9e21dbb89992cdaaa1fa3418a9dcd28d0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8317/0062dcc9e21dbb89992cdaaa1fa3418a9dcd28d0/pm.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 11086, 1447, 12, 2890, 16, 2982, 4672, 309, 2982, 30, 309, 486, 365, 18, 86, 7755, 659, 30, 468, 17150, 25228, 876, 16, 1496, 486, 326, 5790, 1245, 18, 1930, 17437, 16, 2573, 2688, 273...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 11086, 1447, 12, 2890, 16, 2982, 4672, 309, 2982, 30, 309, 486, 365, 18, 86, 7755, 659, 30, 468, 17150, 25228, 876, 16, 1496, 486, 326, 5790, 1245, 18, 1930, 17437, 16, 2573, 2688, 273...
self._obj_list=list(self._obj_list) for obj in self._obj_list: if obj[0] == sel_text: self._obj_list.remove(obj) break
self._obj_list=list(self._obj_list) for obj in self._obj_list: if obj[0] == sel_text: self._obj_list.remove(obj) break
def DeleteObject(self,sel_text): self._obj_list=list(self._obj_list) for obj in self._obj_list: if obj[0] == sel_text: self._obj_list.remove(obj) break
bc3c1f7a22dbca3c418f700cf48883617e53933e /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7397/bc3c1f7a22dbca3c418f700cf48883617e53933e/tiny_xmlrpc.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 2504, 921, 12, 2890, 16, 1786, 67, 955, 4672, 365, 6315, 2603, 67, 1098, 33, 1098, 12, 2890, 6315, 2603, 67, 1098, 13, 364, 1081, 316, 365, 6315, 2603, 67, 1098, 30, 309, 1081, 63, 2...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 2504, 921, 12, 2890, 16, 1786, 67, 955, 4672, 365, 6315, 2603, 67, 1098, 33, 1098, 12, 2890, 6315, 2603, 67, 1098, 13, 364, 1081, 316, 365, 6315, 2603, 67, 1098, 30, 309, 1081, 63, 2...
'got': u'User talk',
def __init__(self): family.Family.__init__(self) self.name = 'uncyclopedia'
5291e54d99c50e05679c62b06fbab03ab3f57e0d /local1/tlutelli/issta_data/temp/all_python//python/2009_temp/2009/4404/5291e54d99c50e05679c62b06fbab03ab3f57e0d/uncyclopedia_family.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1001, 2738, 972, 12, 2890, 4672, 6755, 18, 9203, 16186, 2738, 972, 12, 2890, 13, 365, 18, 529, 273, 296, 551, 93, 7550, 1845, 1155, 11, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1001, 2738, 972, 12, 2890, 4672, 6755, 18, 9203, 16186, 2738, 972, 12, 2890, 13, 365, 18, 529, 273, 296, 551, 93, 7550, 1845, 1155, 11, 2, -100, -100, -100, -100, -100, -100, -100, -10...
misc.verbose("computing")
def complement(self, bound=None): """ Return the largest Hecke-stable complement of this space.
05078b815053ac3375902dc0b8efa000494b5e85 /local1/tlutelli/issta_data/temp/all_python//python/2009_temp/2009/9890/05078b815053ac3375902dc0b8efa000494b5e85/submodule.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 17161, 12, 2890, 16, 2489, 33, 7036, 4672, 3536, 2000, 326, 12756, 670, 762, 73, 17, 15021, 17161, 434, 333, 3476, 18, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 17161, 12, 2890, 16, 2489, 33, 7036, 4672, 3536, 2000, 326, 12756, 670, 762, 73, 17, 15021, 17161, 434, 333, 3476, 18, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
sage: os.listdir(nb.directory() + '/worksheets/' + W.filename())
sage: sorted(os.listdir(nb.directory() + '/worksheets/' + W.filename()))
def filename(self): """ Return the filename (really directory) where the files associated to this worksheet are stored.
13d9e03cd24c242b5d2bad990d2e34b2b320f25d /local1/tlutelli/issta_data/temp/all_python//python/2008_temp/2008/9890/13d9e03cd24c242b5d2bad990d2e34b2b320f25d/worksheet.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1544, 12, 2890, 4672, 3536, 2000, 326, 1544, 261, 266, 1230, 1867, 13, 1625, 326, 1390, 3627, 358, 333, 13622, 854, 4041, 18, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1544, 12, 2890, 4672, 3536, 2000, 326, 1544, 261, 266, 1230, 1867, 13, 1625, 326, 1390, 3627, 358, 333, 13622, 854, 4041, 18, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -10...
if isMethod: writeResultConv(f, member.realtype, len(member.params) + 1, 'vp', '*vp') elif isGetter: writeResultConv(f, member.realtype, None, 'vp', '*vp')
if isMethod or isGetter: writeResultConv(f, member.realtype, 'vp', '*vp')
f.write("#ifdef DEBUG\n")
6a1f237207f51d1463e1c61da017872f3721beeb /local1/tlutelli/issta_data/temp/all_python//python/2009_temp/2009/11102/6a1f237207f51d1463e1c61da017872f3721beeb/qsgen.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 284, 18, 2626, 2932, 7, 430, 536, 6369, 64, 82, 7923, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 284, 18, 2626, 2932, 7, 430, 536, 6369, 64, 82, 7923, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -10...
self.add_tiddler(Tiddler('::' + i)) def add_html (self, source): "converts HTML source code to tiddlers in this TiddlyWiki"
self.addTiddler(Tiddler('::' + i)) def addHtml (self, source): """Adds HTML source code to this TiddlyWiki."""
def add_twee (self, source): "converts Twee source code to tiddlers in this TiddlyWiki" source = source.replace("\r\n", "\n") tiddlers = source.split('\n::') for i in tiddlers: self.add_tiddler(Tiddler('::' + i))
6c1969959d8e0961fa5075dac2f76e60b7f2c5fe /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11433/6c1969959d8e0961fa5075dac2f76e60b7f2c5fe/tiddlywiki.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 527, 67, 11246, 1340, 261, 2890, 16, 1084, 4672, 315, 6283, 87, 12694, 1340, 1084, 981, 358, 268, 1873, 3135, 316, 333, 399, 1873, 715, 25438, 6, 1084, 273, 1084, 18, 2079, 31458, 86, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 527, 67, 11246, 1340, 261, 2890, 16, 1084, 4672, 315, 6283, 87, 12694, 1340, 1084, 981, 358, 268, 1873, 3135, 316, 333, 399, 1873, 715, 25438, 6, 1084, 273, 1084, 18, 2079, 31458, 86, ...
self._pull_trigger()
self.trigger.pull_trigger()
def wait(self, msgid): """Invoke asyncore mainloop and wait for reply.""" if __debug__: self.log("wait(%d)" % msgid, level=TRACE)
1cceda96839c92537b269956e7f6f5d3f6fc638c /local1/tlutelli/issta_data/temp/all_python//python/2008_temp/2008/10048/1cceda96839c92537b269956e7f6f5d3f6fc638c/connection.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 2529, 12, 2890, 16, 24389, 4672, 3536, 10969, 4326, 479, 2774, 6498, 471, 2529, 364, 4332, 12123, 309, 1001, 4148, 972, 30, 365, 18, 1330, 2932, 7048, 9275, 72, 2225, 738, 24389, 16, 180...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 2529, 12, 2890, 16, 24389, 4672, 3536, 10969, 4326, 479, 2774, 6498, 471, 2529, 364, 4332, 12123, 309, 1001, 4148, 972, 30, 365, 18, 1330, 2932, 7048, 9275, 72, 2225, 738, 24389, 16, 180...
"('company', '=', parent.company), " \ "('id', '!=', parent.account)]",
"('company', '=', _parent_invoice.company), " \ "('id', '!=', _parent_invoice.account)]",
def refund(self, cursor, user, ids, context=None): ''' Refund invoices and return ids of new invoices. ''' new_ids = [] for invoice in self.browse(cursor, user, ids, context=context): vals = self._refund(cursor, user, invoice, context=context) new_ids.append(self.create(cursor, user, vals, context=context)) return new_ids
539479e0405abbee5564053fa837d5346bb3c202 /local1/tlutelli/issta_data/temp/all_python//python/2008_temp/2008/9267/539479e0405abbee5564053fa837d5346bb3c202/invoice.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 16255, 12, 2890, 16, 3347, 16, 729, 16, 3258, 16, 819, 33, 7036, 4672, 9163, 3941, 1074, 2198, 17725, 471, 327, 3258, 434, 394, 2198, 17725, 18, 9163, 394, 67, 2232, 273, 5378, 364, 91...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 16255, 12, 2890, 16, 3347, 16, 729, 16, 3258, 16, 819, 33, 7036, 4672, 9163, 3941, 1074, 2198, 17725, 471, 327, 3258, 434, 394, 2198, 17725, 18, 9163, 394, 67, 2232, 273, 5378, 364, 91...
print 'final branch with', tree, ''.join(tree), leavessum
if DEBUG: print 'final branch with', tree, ''.join(tree), leavessum
def calc_prob(self, tree, parent=None): '''walking a tree bottom-up based on dictionary '''
9c5fff34ffccf856c501965fc5adda55ae71eb98 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12658/9c5fff34ffccf856c501965fc5adda55ae71eb98/treewalkerclass.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 7029, 67, 7748, 12, 2890, 16, 2151, 16, 982, 33, 7036, 4672, 9163, 11348, 310, 279, 2151, 5469, 17, 416, 2511, 603, 3880, 9163, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 7029, 67, 7748, 12, 2890, 16, 2151, 16, 982, 33, 7036, 4672, 9163, 11348, 310, 279, 2151, 5469, 17, 416, 2511, 603, 3880, 9163, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, ...
print "will execute (from %s): %s" % (source, command)
msg = "will execute (from %s): %s" % (source, command)
def debug_run_command(command, source = "user debug input"): #bruce 040913-16 in GLPane.py; modified 040928 """Execute a python command, supplied by the user via some sort of debugging interface (named by source), in debug.py's globals. Return 1 for ok (incl empty command), 0 for any error. Caller should not print exception diagnostics -- this function does that (and does not reraise the exception). """ #e someday we might record time, history, etc command = "" + command # i.e. assert it's a string #k what's a better way to do the following? while command and command[0] == '\n': command = command[1:] while command and command[-1] == '\n': command = command[:-1] if not command: print "empty command (from %s), nothing executed" % (source,) return 1 if '\n' not in command: print "will execute (from %s): %s" % (source, command) else: nlines = command.count('\n')+1 print "will execute (from %s; %d lines):\n%s" % (source, nlines, command) command = command + '\n' #k probably not needed try: ## exec command in globals() legally_exec_command_in_globals( command, globals() ) except: print_compact_traceback("exception from that: ") return 0 else: print "did it!" return 1 pass
600e4a9b0c3fe0e8fcfd7cdc7f070e5fa6d8102c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11221/600e4a9b0c3fe0e8fcfd7cdc7f070e5fa6d8102c/debug.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1198, 67, 2681, 67, 3076, 12, 3076, 16, 1084, 273, 315, 1355, 1198, 810, 6, 4672, 468, 2848, 3965, 16486, 5908, 3437, 17, 2313, 316, 10252, 8485, 18, 2074, 31, 4358, 16486, 5908, 6030, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1198, 67, 2681, 67, 3076, 12, 3076, 16, 1084, 273, 315, 1355, 1198, 810, 6, 4672, 468, 2848, 3965, 16486, 5908, 3437, 17, 2313, 316, 10252, 8485, 18, 2074, 31, 4358, 16486, 5908, 6030, ...
exampledata = 'iv'
exampledata = 'ivfake'
def momcondIVLS(params, endog, exog, instrum): return instrum * (endog - np.dot(exog, params))[:,None]
c9e87aac6981f5881e22af3b25dfde96efdcbd26 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12658/c9e87aac6981f5881e22af3b25dfde96efdcbd26/gmm.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 312, 362, 10013, 8188, 3045, 12, 2010, 16, 679, 717, 16, 431, 717, 16, 16170, 379, 4672, 327, 16170, 379, 380, 261, 409, 717, 300, 1130, 18, 9811, 12, 338, 717, 16, 859, 3719, 10531, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 312, 362, 10013, 8188, 3045, 12, 2010, 16, 679, 717, 16, 431, 717, 16, 16170, 379, 4672, 327, 16170, 379, 380, 261, 409, 717, 300, 1130, 18, 9811, 12, 338, 717, 16, 859, 3719, 10531, ...
import netsvc
def email_send(email_from, email_to, subject, body, email_cc=None, email_bcc=None, reply_to=False, attach=None, tinycrm=False, ssl=False, debug=False, subtype='plain', x_headers=None): """Send an email.""" import smtplib from email.MIMEText import MIMEText from email.MIMEBase import MIMEBase from email.MIMEMultipart import MIMEMultipart from email.Header import Header from email.Utils import formatdate, COMMASPACE from email.Utils import formatdate, COMMASPACE from email import Encoders if x_headers is None: x_headers = {} if not ssl: ssl = config.get('smtp_ssl', False) if not email_from and not config['email_from']: raise Exception("No Email sender by default, see config file") if not email_cc: email_cc = [] if not email_bcc: email_bcc = [] if not attach: msg = MIMEText(body or '',_subtype=subtype,_charset='utf-8') else: msg = MIMEMultipart() msg['Subject'] = Header(ustr(subject), 'utf-8') msg['From'] = email_from del msg['Reply-To'] if reply_to: msg['Reply-To'] = reply_to else: msg['Reply-To'] = msg['From'] msg['To'] = COMMASPACE.join(email_to) if email_cc: msg['Cc'] = COMMASPACE.join(email_cc) if email_bcc: msg['Bcc'] = COMMASPACE.join(email_bcc) msg['Date'] = formatdate(localtime=True) # Add OpenERP Server information msg['X-Generated-By'] = 'OpenERP (http://www.openerp.com)' msg['X-OpenERP-Server-Host'] = socket.gethostname() msg['X-OpenERP-Server-Version'] = release.version # Add dynamic X Header for key, value in x_headers.items(): msg['X-OpenERP-%s' % key] = str(value) if tinycrm: msg['Message-Id'] = "<%s-tinycrm-%s@%s>" % (time.time(), tinycrm, socket.gethostname()) if attach: msg.attach( MIMEText(body or '', _charset='utf-8', _subtype=subtype) ) for (fname,fcontent) in attach: part = MIMEBase('application', "octet-stream") part.set_payload( fcontent ) Encoders.encode_base64(part) part.add_header('Content-Disposition', 'attachment; filename="%s"' % (fname,)) msg.attach(part) try: s = smtplib.SMTP() if debug: s.debuglevel = 5 s.connect(config['smtp_server'], config['smtp_port']) if ssl: s.ehlo() s.starttls() s.ehlo() if config['smtp_user'] or config['smtp_password']: s.login(config['smtp_user'], config['smtp_password']) s.sendmail(email_from, flatten([email_to, email_cc, email_bcc]), msg.as_string() ) s.quit() except Exception, e: import netsvc netsvc.Logger().notifyChannel('email_send', netsvc.LOG_ERROR, e) return False return True
56acccc62cfa94e11619f0a9e484023e9f7a7ed3 /local1/tlutelli/issta_data/temp/all_python//python/2009_temp/2009/12853/56acccc62cfa94e11619f0a9e484023e9f7a7ed3/misc.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 2699, 67, 4661, 12, 3652, 67, 2080, 16, 2699, 67, 869, 16, 3221, 16, 1417, 16, 2699, 67, 952, 33, 7036, 16, 2699, 67, 31345, 33, 7036, 16, 4332, 67, 869, 33, 8381, 16, 3306, 33, 70...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 2699, 67, 4661, 12, 3652, 67, 2080, 16, 2699, 67, 869, 16, 3221, 16, 1417, 16, 2699, 67, 952, 33, 7036, 16, 2699, 67, 31345, 33, 7036, 16, 4332, 67, 869, 33, 8381, 16, 3306, 33, 70...
The same example with a rotation of angle pi/2::
The same example with a rotation of angle `\pi/2`::
def get_minmax_data(self): """ Returns a dictionary with the bounding box data.
4c5e1937fe73c05a208a1c8fdb96fca58580fae9 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/4c5e1937fe73c05a208a1c8fdb96fca58580fae9/ellipse.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 336, 67, 1154, 1896, 67, 892, 12, 2890, 4672, 3536, 2860, 279, 3880, 598, 326, 7552, 3919, 501, 18, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 336, 67, 1154, 1896, 67, 892, 12, 2890, 4672, 3536, 2860, 279, 3880, 598, 326, 7552, 3919, 501, 18, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100,...
""" global _sys_version_cache if _sys_version_cache is not None: return _sys_version_cache if sys.version[:10] == 'IronPython':
sys_version may be given to parse an alternative version string, e.g. if the version was read from a different Python interpreter. """ if sys_version is None: sys_version = sys.version result = _sys_version_cache.get(sys_version, None) if result is not None: return result if sys_version[:10] == 'IronPython':
def _sys_version(): """ Returns a parsed version of Python's sys.version as tuple (name, version, branch, revision, buildno, builddate, compiler) referring to the Python implementation name, version, branch, revision, build number, build date/time as string and the compiler identification string. Note that unlike the Python sys.version, the returned value for the Python version will always include the patchlevel (it defaults to '.0'). The function returns empty strings for tuple entries that cannot be determined. """ global _sys_version_cache if _sys_version_cache is not None: return _sys_version_cache if sys.version[:10] == 'IronPython': # IronPython name = 'IronPython' match = _ironpython_sys_version_parser.match(sys.version) if match is None: raise ValueError( 'failed to parse IronPython sys.version: %s' % repr(sys.version)) version, compiler = match.groups() branch = '' revision = '' buildno = '' builddate = '' elif sys.platform[:4] == 'java': # Jython name = 'Jython' match = _jython_sys_version_parser.match(sys.version) if match is None: raise ValueError( 'failed to parse Jython sys.version: %s' % repr(sys.version)) version, = match.groups() branch = '' revision = '' compiler = sys.platform buildno = '' builddate = '' else: # CPython match = _sys_version_parser.match(sys.version) if match is None: raise ValueError( 'failed to parse CPython sys.version: %s' % repr(sys.version)) version, buildno, builddate, buildtime, compiler = \ match.groups() if hasattr(sys, 'subversion'): name, branch, revision = sys.subversion else: name = 'CPython' branch = '' revision = '' builddate = builddate + ' ' + buildtime l = string.split(version, '.') if len(l) == 2: l.append('0') version = string.join(l, '.') _sys_version_cache = (name, version, branch, revision, buildno, builddate, compiler) return _sys_version_cache
2be9d43c18213be2387f3cdaf9d7bf02fdd37e8d /local1/tlutelli/issta_data/temp/all_python//python/2007_temp/2007/8546/2be9d43c18213be2387f3cdaf9d7bf02fdd37e8d/platform.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 389, 9499, 67, 1589, 13332, 225, 3536, 2860, 279, 2707, 1177, 434, 6600, 1807, 2589, 18, 1589, 487, 3193, 261, 529, 16, 1177, 16, 3803, 16, 6350, 16, 1361, 2135, 16, 25666, 330, 449, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 389, 9499, 67, 1589, 13332, 225, 3536, 2860, 279, 2707, 1177, 434, 6600, 1807, 2589, 18, 1589, 487, 3193, 261, 529, 16, 1177, 16, 3803, 16, 6350, 16, 1361, 2135, 16, 25666, 330, 449, 3...
import pdb ; pdb.set_trace()
def buildcopy(top, dummy, list): import macostools for src, dst in list: src = os.path.join(top, src) dst = os.path.join(top, dst) import pdb ; pdb.set_trace() macostools.copy(src, dst)
44a63e227e0cc24962cf30ed40c284e3e15ccbcf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/44a63e227e0cc24962cf30ed40c284e3e15ccbcf/ConfigurePython.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1361, 3530, 12, 3669, 16, 9609, 16, 666, 4672, 1930, 5318, 669, 8192, 364, 1705, 16, 3046, 316, 666, 30, 1705, 273, 1140, 18, 803, 18, 5701, 12, 3669, 16, 1705, 13, 3046, 273, 1140, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1361, 3530, 12, 3669, 16, 9609, 16, 666, 4672, 1930, 5318, 669, 8192, 364, 1705, 16, 3046, 316, 666, 30, 1705, 273, 1140, 18, 803, 18, 5701, 12, 3669, 16, 1705, 13, 3046, 273, 1140, ...
(func.__name__, arg, e.__class__.__name__, e)
(funcName(func), arg, e.__class__.__name__, e) def funcName(func): """Returns the name of a function or class""" try: return func.__name__ except AttributeError: return func.__class__.__name__
def failFunc(func, arg): """Call to test arguments that should fail""" try: junk = func(arg) print "error: %s(%r) = %r but should raise ValueError" % \ (func.__name__, arg, junk) except (ValueError, TypeError): pass except StandardError, e: print "%s(%r) should have raised ValueError or TypeError, but raised %s = %s" % \ (func.__name__, arg, e.__class__.__name__, e)
166d0aa4288cdb380258ce4a9ad33d61983f65a3 /local1/tlutelli/issta_data/temp/all_python//python/2007_temp/2007/6353/166d0aa4288cdb380258ce4a9ad33d61983f65a3/CnvUtil.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 2321, 2622, 12, 644, 16, 1501, 4672, 3536, 1477, 358, 1842, 1775, 716, 1410, 2321, 8395, 775, 30, 525, 1683, 273, 1326, 12, 3175, 13, 1172, 315, 1636, 30, 738, 87, 9275, 86, 13, 273, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 2321, 2622, 12, 644, 16, 1501, 4672, 3536, 1477, 358, 1842, 1775, 716, 1410, 2321, 8395, 775, 30, 525, 1683, 273, 1326, 12, 3175, 13, 1172, 315, 1636, 30, 738, 87, 9275, 86, 13, 273, ...
block = self.source.consume(self.blocksize())
block = self.source.consume(bs)
def load(self): assert self.value is not None, 'Parent must initialize self.value'
8a8309f170aafae02f16413f198aeeef60300c60 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/6676/8a8309f170aafae02f16413f198aeeef60300c60/ptype.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1262, 12, 2890, 4672, 1815, 365, 18, 1132, 353, 486, 599, 16, 296, 3054, 1297, 4046, 365, 18, 1132, 11, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1262, 12, 2890, 4672, 1815, 365, 18, 1132, 353, 486, 599, 16, 296, 3054, 1297, 4046, 365, 18, 1132, 11, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, ...
self.__class__.format=EMR_FORMAT(self.__class__.emr_id,self.__class__.emr_typedef)
self.__class__.format=_EMR_FORMAT(self.__class__.emr_id,self.__class__.emr_typedef)
if self.__class__.format==None or self.__class__.emr_typedef != self.format.typedef: print "creating format for %d" % self.__class__.emr_id self.__class__.format=EMR_FORMAT(self.__class__.emr_id,self.__class__.emr_typedef)
688318604ffe18a54bb261a3bde4bf6e1784a8de /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8136/688318604ffe18a54bb261a3bde4bf6e1784a8de/pyemf.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 309, 365, 16186, 1106, 25648, 2139, 631, 7036, 578, 365, 16186, 1106, 25648, 351, 86, 67, 723, 536, 480, 365, 18, 2139, 18, 723, 536, 30, 1172, 315, 23799, 740, 364, 738, 72, 6, 738, 365, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 309, 365, 16186, 1106, 25648, 2139, 631, 7036, 578, 365, 16186, 1106, 25648, 351, 86, 67, 723, 536, 480, 365, 18, 2139, 18, 723, 536, 30, 1172, 315, 23799, 740, 364, 738, 72, 6, 738, 365, ...
self.assertRaises(ValueError, time.strftime, '',
self.assertRaises(ValueError, func,
def test_strftime_bounds_checking(self): # Make sure that strftime() checks the bounds of the various parts #of the time tuple (0 is valid for *all* values).
cdc0bc5b7bb85b227d83a29f5689a20431308ec8 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8125/cdc0bc5b7bb85b227d83a29f5689a20431308ec8/test_time.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1842, 67, 701, 9982, 67, 10576, 67, 24609, 12, 2890, 4672, 468, 4344, 3071, 716, 10405, 1435, 4271, 326, 4972, 434, 326, 11191, 2140, 468, 792, 326, 813, 3193, 261, 20, 353, 923, 364, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1842, 67, 701, 9982, 67, 10576, 67, 24609, 12, 2890, 4672, 468, 4344, 3071, 716, 10405, 1435, 4271, 326, 4972, 434, 326, 11191, 2140, 468, 792, 326, 813, 3193, 261, 20, 353, 923, 364, ...
[ 1 + 5 + O(5^4) 1 + 4*5 + O(5^2) 2*5 + O(5^3)] [ 1 + 4*5 + O(5^2) 2 + 5^2 + 3*5^3 + O(5^4) 3 + 4*5^2 + 4*5^3 + O(5^4)] [ 2*5 + O(5^3) 3 + 4*5^2 + 4*5^3 + O(5^4) 4 + 5 + 3*5^2 + 3*5^3 + O(5^4)]
[ 1 + 5 + O(5^4) 1 + 4*5 + 2*5^3 + O(5^4) 2*5 + 3*5^3 + O(5^4)] [ 1 + 4*5 + 2*5^3 + O(5^4) 2 + 5^2 + 3*5^3 + O(5^4) 3 + 4*5^2 + 4*5^3 + O(5^4)] [ 2*5 + 3*5^3 + O(5^4) 3 + 4*5^2 + 4*5^3 + O(5^4) 4 + 5 + 3*5^2 + 3*5^3 + O(5^4)]
def padic_height_pairing_matrix(self, p, prec=20, height=None, check_hypotheses=True): r""" Computes the cyclotomic $p$-adic height pairing matrix of this curve with respect to the basis self.gens() for the Mordell-Weil group for a given odd prime p of good ordinary reduction.
dc02e67e52b9174198fb76d7b9504168026ea700 /local1/tlutelli/issta_data/temp/all_python//python/2007_temp/2007/9890/dc02e67e52b9174198fb76d7b9504168026ea700/ell_rational_field.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 4627, 335, 67, 4210, 67, 6017, 310, 67, 5667, 12, 2890, 16, 293, 16, 13382, 33, 3462, 16, 2072, 33, 7036, 16, 866, 67, 76, 879, 10370, 281, 281, 33, 5510, 4672, 436, 8395, 14169, 281...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 4627, 335, 67, 4210, 67, 6017, 310, 67, 5667, 12, 2890, 16, 293, 16, 13382, 33, 3462, 16, 2072, 33, 7036, 16, 866, 67, 76, 879, 10370, 281, 281, 33, 5510, 4672, 436, 8395, 14169, 281...
(s,) = LargePedigreeSample(self.pop, 50, minTotalSize=10, maxOffspring=5,
(s,) = LargePedigreeSample(self.largepop, minTotalSize=20, maxOffspring=5,
def testLargePedigreeSample(self): 'Testing large pedigree sampling (FIXME)' (s,) = LargePedigreeSample(self.pop, 50, minTotalSize=10, maxOffspring=5, minPedSize=3, minAffected=0) print s.subPopSizes() return assert s.subPopSize(0) <= 4 assert s.subPopSize(1) <= 6 for ind in s.individuals(0): self.assertEqual(ind.affected(), True) #old index? inpop = self.pop.individual(int(ind.info('oldindex'))) self.assertEqual(ind, inpop) for ind in s.individuals(1): self.assertEqual(ind.affected(), True) #old index? inpop = self.pop.individual(int(ind.info('oldindex'))) self.assertEqual(ind, inpop) # (s,) = AffectedSibpairSample(self.pop, 2) assert s.subPopSize(0) <= 4 for ind in s.individuals(): self.assertEqual(ind.affected(), True) #old index? inpop = self.pop.individual(int(ind.info('oldindex'))) self.assertEqual(ind, inpop) pass
2efe0044550e6c6e9384b6f5e485a71317d18cf9 /local1/tlutelli/issta_data/temp/all_python//python/2007_temp/2007/401/2efe0044550e6c6e9384b6f5e485a71317d18cf9/test_16_asertainment.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1842, 20020, 52, 329, 360, 992, 8504, 12, 2890, 4672, 296, 22218, 7876, 31840, 360, 992, 11558, 261, 25810, 2506, 261, 87, 16, 13, 273, 16236, 908, 52, 329, 360, 992, 8504, 12, 2890, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1842, 20020, 52, 329, 360, 992, 8504, 12, 2890, 4672, 296, 22218, 7876, 31840, 360, 992, 11558, 261, 25810, 2506, 261, 87, 16, 13, 273, 16236, 908, 52, 329, 360, 992, 8504, 12, 2890, 1...
index='member_catalog/KeywordIndex|TextIndex:brains',
index='member_catalog/KeywordIndex:brains',
def addMember(self, id, **kwargs): o = Member(id) self._setObject(id, o) o = getattr(self, id) o.initializeArchetype(**kwargs) o.getUser() o._setPassword(o._generatePassword())
8272bf9f28b87e1dc50adaedcc8625433afbe422 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/1807/8272bf9f28b87e1dc50adaedcc8625433afbe422/Member.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 527, 4419, 12, 2890, 16, 612, 16, 2826, 4333, 4672, 320, 273, 8596, 12, 350, 13, 365, 6315, 542, 921, 12, 350, 16, 320, 13, 320, 273, 3869, 12, 2890, 16, 612, 13, 320, 18, 11160, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 527, 4419, 12, 2890, 16, 612, 16, 2826, 4333, 4672, 320, 273, 8596, 12, 350, 13, 365, 6315, 542, 921, 12, 350, 16, 320, 13, 320, 273, 3869, 12, 2890, 16, 612, 13, 320, 18, 11160, 1...
'%s(`(:%s:|__?)?)%s' % (non_whitespace_escape_before, simplename, end_string_suffix)),
'%s(`(?P<suffix>:%s:|__?)?)%s' % (non_whitespace_escape_before, simplename, end_string_suffix)),
def parse(self, text, lineno, memo, parent): """ Return 2 lists: nodes (text and inline elements), and system_messages.
9aa86b66cf632d24cd8412c352ecb461084727da /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/1278/9aa86b66cf632d24cd8412c352ecb461084727da/states.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1109, 12, 2890, 16, 977, 16, 7586, 16, 11063, 16, 982, 4672, 3536, 2000, 576, 6035, 30, 2199, 261, 955, 471, 6370, 2186, 3631, 471, 2619, 67, 6833, 18, 2, 0, 0, 0, 0, 0, 0, 0, 0,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1109, 12, 2890, 16, 977, 16, 7586, 16, 11063, 16, 982, 4672, 3536, 2000, 576, 6035, 30, 2199, 261, 955, 471, 6370, 2186, 3631, 471, 2619, 67, 6833, 18, 2, -100, -100, -100, -100, -100,...
f = open(opts.galaxy_priors_dir+'/'+str(int(mineffD))+'Mpc.pkl','r')
f = open(opts.galaxy_priors_dir+'/galaxy_prior_'+str(int(mineffD))+'Mpc.pkl','r')
def get_unique_filename(name): """ use this to avoid name collisions """ counter = 1 base_name, ext = os.path.splitext(name) while os.path.isfile(name): name = base_name + '_' + str(counter) + ext counter += 1 return name
db0d3b22ca11434c802156342f5b91128afe7bab /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/5758/db0d3b22ca11434c802156342f5b91128afe7bab/run_skypoints.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 336, 67, 6270, 67, 3459, 12, 529, 4672, 3536, 999, 333, 358, 4543, 508, 27953, 3536, 3895, 273, 404, 1026, 67, 529, 16, 1110, 273, 1140, 18, 803, 18, 4939, 408, 12, 529, 13, 1323, 11...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 336, 67, 6270, 67, 3459, 12, 529, 4672, 3536, 999, 333, 358, 4543, 508, 27953, 3536, 3895, 273, 404, 1026, 67, 529, 16, 1110, 273, 1140, 18, 803, 18, 4939, 408, 12, 529, 13, 1323, 11...
try:
try:
def ChangeAuthCode(self, val):
1b212c49e32b081a217aa3484193f8b38d1b03b7 /local1/tlutelli/issta_data/temp/all_python//python/2009_temp/2009/4712/1b212c49e32b081a217aa3484193f8b38d1b03b7/gsm.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 7576, 1730, 1085, 12, 2890, 16, 1244, 4672, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 7576, 1730, 1085, 12, 2890, 16, 1244, 4672, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -10...
Calls ``self.random_all_graph_colorings()``. In the future, if
Calls ``self.random_all_graph_colorings()``. In the future, if
def random(self,tests = 1000): r""" Calls ``self.random_all_graph_colorings()``. In the future, if other methods are added, it should call them, too. TESTS::
51d78949a271e517bfec39aa3c803f9ec8e1f893 /local1/tlutelli/issta_data/temp/all_python//python/2009_temp/2009/9890/51d78949a271e517bfec39aa3c803f9ec8e1f893/graph_coloring.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 2744, 12, 2890, 16, 16341, 273, 4336, 4672, 436, 8395, 23665, 12176, 2890, 18, 9188, 67, 454, 67, 4660, 67, 3266, 899, 20338, 8338, 225, 657, 326, 3563, 16, 309, 1308, 2590, 854, 3096, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 2744, 12, 2890, 16, 16341, 273, 4336, 4672, 436, 8395, 23665, 12176, 2890, 18, 9188, 67, 454, 67, 4660, 67, 3266, 899, 20338, 8338, 225, 657, 326, 3563, 16, 309, 1308, 2590, 854, 3096, ...
if units: Units = Matrix(ZZ,[self.ideallog(u) for u in units])
if subgp_gens: Units = Matrix(ZZ,[self.ideallog(u) for u in subgp_gens])
def invertible_residues_mod_units(self, units=[], reduce=True): """ Returns a iterator through a list of invertible residues modulo this integral ideal and modulo the group generated by the given units.
ef0819690a4fd01b3d6fba60378c1b5b3e6c0cda /local1/tlutelli/issta_data/temp/all_python//python/2009_temp/2009/9890/ef0819690a4fd01b3d6fba60378c1b5b3e6c0cda/number_field_ideal.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 9848, 1523, 67, 15567, 3610, 67, 1711, 67, 7705, 12, 2890, 16, 4971, 22850, 6487, 5459, 33, 5510, 4672, 3536, 2860, 279, 2775, 3059, 279, 666, 434, 9848, 1523, 25435, 26109, 333, 21423, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 9848, 1523, 67, 15567, 3610, 67, 1711, 67, 7705, 12, 2890, 16, 4971, 22850, 6487, 5459, 33, 5510, 4672, 3536, 2860, 279, 2775, 3059, 279, 666, 434, 9848, 1523, 25435, 26109, 333, 21423, ...
linecache.checkcache(source_name) source = open(source_name)
linecache.checkcache(source_name) with open(source_name) as source:
def test_checkcache(self): getline = linecache.getline try: # Create a source file and cache its contents source_name = support.TESTFN + '.py' with open(source_name, 'w') as source: source.write(SOURCE_1) source.close() getline(source_name, 1)
044e4c9c6da3b4e39f47e76304c6d9c5e30271e1 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8125/044e4c9c6da3b4e39f47e76304c6d9c5e30271e1/test_linecache.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1842, 67, 1893, 2493, 12, 2890, 4672, 336, 1369, 273, 4739, 557, 807, 18, 588, 1369, 775, 30, 468, 1788, 279, 1084, 585, 471, 1247, 2097, 2939, 1084, 67, 529, 273, 2865, 18, 16961, 197...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1842, 67, 1893, 2493, 12, 2890, 4672, 336, 1369, 273, 4739, 557, 807, 18, 588, 1369, 775, 30, 468, 1788, 279, 1084, 585, 471, 1247, 2097, 2939, 1084, 67, 529, 273, 2865, 18, 16961, 197...
try:makedirs(CONFIG_PATH)
try: makedirs(CONFIG_PATH) copy2('../data/default_config.cfg', CONFIG_PATH+'poezio.cfg')
def setAndSave(self, option, value): self.set(option, value) self.save()
be17c6a6034cafbb89cbf967465a969e5ff42633 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9814/be17c6a6034cafbb89cbf967465a969e5ff42633/config.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 444, 1876, 4755, 12, 2890, 16, 1456, 16, 460, 4672, 365, 18, 542, 12, 3482, 16, 460, 13, 365, 18, 5688, 1435, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 444, 1876, 4755, 12, 2890, 16, 1456, 16, 460, 4672, 365, 18, 542, 12, 3482, 16, 460, 13, 365, 18, 5688, 1435, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100,...
config_opts['files']['/etc/hosts'] = "127.0.0.1 localhost localhost.localdomain\n"
config_opts['files']['etc/hosts'] = "127.0.0.1 localhost localhost.localdomain\n"
def setup_default_config_opts(config_opts): config_opts['basedir'] = '/var/lib/mock/' # root name is automatically added to this config_opts['chroot'] = '/usr/sbin/mock-helper chroot' config_opts['mount'] = '/usr/sbin/mock-helper mount' config_opts['orphanskill'] = '/usr/sbin/mock-helper orphanskill' config_opts['umount'] = '/usr/sbin/mock-helper umount' config_opts['rm'] = '/usr/sbin/mock-helper rm' config_opts['mknod'] = '/usr/sbin/mock-helper mknod' config_opts['yum'] = '/usr/sbin/mock-helper yum' config_opts['chmod'] = '/usr/sbin/mock-helper chmod' config_opts['chown'] = '/usr/sbin/mock-helper chown' config_opts['rpmbuild_timeout'] = 0 config_opts['runuser'] = '/sbin/runuser' config_opts['chroot_setup_cmd'] = 'install buildsys-build' config_opts['chrootuser'] = 'mockbuild' config_opts['chrootgroup'] = 'mockbuild' config_opts['use_host_resolv'] = True import grp config_opts['chrootuid'] = os.geteuid() config_opts['chrootgid'] = grp.getgrnam("mock")[2] config_opts['chroothome'] = '/builddir' config_opts['clean'] = True config_opts['debug'] = False config_opts['verbose'] = False config_opts['target_arch'] = 'i386' config_opts['files'] = {} config_opts['yum.conf'] = '' config_opts['macros'] = """
e87c3555958b7ce866993b7842663eee7167fede /local1/tlutelli/issta_data/temp/all_python//python/2007_temp/2007/7328/e87c3555958b7ce866993b7842663eee7167fede/mock.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 3875, 67, 1886, 67, 1425, 67, 4952, 12, 1425, 67, 4952, 4672, 642, 67, 4952, 3292, 31722, 3546, 273, 1173, 1401, 19, 2941, 19, 22851, 2473, 468, 1365, 508, 353, 6635, 3096, 358, 333, 6...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 3875, 67, 1886, 67, 1425, 67, 4952, 12, 1425, 67, 4952, 4672, 642, 67, 4952, 3292, 31722, 3546, 273, 1173, 1401, 19, 2941, 19, 22851, 2473, 468, 1365, 508, 353, 6635, 3096, 358, 333, 6...
def release(self): while self.counter == self.limit: self.relevent.wait()
def _do_unlock(self): if self._release_waiters and self._acquire_waiters: api.get_hub().schedule_call(0, self._do_acquire) waiter, _unused = self._release_waiters.popitem() waiter.switch() def _do_release(self): if self._release_waiters and self.counter<self.limit: waiter, _unused = self._release_waiters.popitem() waiter.switch() def _do_acquire(self): if self._acquire_waiters and self.counter>0: waiter, _unused = self._acquire_waiters.popitem() waiter.switch() def release(self, blocking=True): if not blocking and self.bounded(): return False if self.counter>=self.limit: if self._acquire_waiters: api.get_hub().schedule_call(0, self._do_unlock) self._release_waiters[api.getcurrent()] = None try: api.get_hub().switch() finally: self._release_waiters.pop(api.getcurrent(), None)
def release(self): # This logic handles the self.limit is None case because None != any integer. while self.counter == self.limit: self.relevent.wait() self.counter += 1 if self.counter == self.limit: self.relevent.reset() if self.counter == 1: # If self.counter was 0 before we incremented it, then wake up # anybody who was waiting self.acqevent.send()
961419045b357378af67f700b41d9403d322b26b /local1/tlutelli/issta_data/temp/all_python//python/2008_temp/2008/10078/961419045b357378af67f700b41d9403d322b26b/coros.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 3992, 12, 2890, 4672, 468, 1220, 4058, 7372, 326, 365, 18, 3595, 353, 599, 648, 2724, 599, 480, 1281, 3571, 18, 1323, 365, 18, 7476, 422, 365, 18, 3595, 30, 365, 18, 16599, 616, 18, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 3992, 12, 2890, 4672, 468, 1220, 4058, 7372, 326, 365, 18, 3595, 353, 599, 648, 2724, 599, 480, 1281, 3571, 18, 1323, 365, 18, 7476, 422, 365, 18, 3595, 30, 365, 18, 16599, 616, 18, ...
if module.allowed_sections_ints:
if module.allowed_sections:
def hide_choice_if_useless(field): """ Hide a choice field if there's only one choice """ if len(field.choices) == 1: hide_field(field, default=field.choices[0][0])
6bd836a2eb51d3fbe17c7ef5e33ed1190b99a3e1 /local1/tlutelli/issta_data/temp/all_python//python/2009_temp/2009/12041/6bd836a2eb51d3fbe17c7ef5e33ed1190b99a3e1/teacherreg.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 6853, 67, 11569, 67, 430, 67, 407, 12617, 12, 1518, 4672, 3536, 25180, 279, 6023, 652, 309, 1915, 1807, 1338, 1245, 6023, 3536, 309, 562, 12, 1518, 18, 11937, 13, 422, 404, 30, 6853, 6...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 6853, 67, 11569, 67, 430, 67, 407, 12617, 12, 1518, 4672, 3536, 25180, 279, 6023, 652, 309, 1915, 1807, 1338, 1245, 6023, 3536, 309, 562, 12, 1518, 18, 11937, 13, 422, 404, 30, 6853, 6...
self.check_sizeof(enumerate([]), size(h + 'l3P')) self.check_sizeof(reversed(''), size(h + 'PP'))
check(enumerate([]), size(h + 'l3P'))
def method(): pass
d2cd86ddd5c3d90911a98a1440563118297e45db /local1/tlutelli/issta_data/temp/all_python//python/2008_temp/2008/8546/d2cd86ddd5c3d90911a98a1440563118297e45db/test_sys.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 707, 13332, 1342, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 707, 13332, 1342, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, ...
perm.sort(lambda a,b: cmp(x[a],x[b]) or cmp(y[a],y[b]))
perm.sort(key=lambda a: (x[a], y[a]))
def mergesort(offs, length): exchcnt = 0 if length == 1: return 0 if length == 2: if y[perm[offs]] <= y[perm[offs+1]]: return 0 t = perm[offs] perm[offs] = perm[offs+1] perm[offs+1] = t return 1 length0 = length / 2 length1 = length - length0 middle = offs + length0 exchcnt += mergesort(offs, length0) exchcnt += mergesort(middle, length1) if y[perm[middle - 1]] < y[perm[middle]]: return exchcnt # merging i = j = k = 0 while j < length0 or k < length1: if k >= length1 or (j < length0 and y[perm[offs + j]] <= y[perm[middle + k]]): temp[i] = perm[offs + j] d = i - j j += 1 else: temp[i] = perm[middle + k] d = (offs + i) - (middle + k) k += 1 if d > 0: exchcnt += d; i += 1 perm[offs:offs+length] = temp[0:length] return exchcnt
083d0c7bf11af0499662c5c6b71dec4d93d82dbd /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12971/083d0c7bf11af0499662c5c6b71dec4d93d82dbd/stats.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 19037, 499, 12, 26600, 16, 769, 4672, 431, 343, 13085, 273, 374, 309, 769, 422, 404, 30, 327, 374, 309, 769, 422, 576, 30, 309, 677, 63, 12160, 63, 26600, 13563, 1648, 677, 63, 12160, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 19037, 499, 12, 26600, 16, 769, 4672, 431, 343, 13085, 273, 374, 309, 769, 422, 404, 30, 327, 374, 309, 769, 422, 576, 30, 309, 677, 63, 12160, 63, 26600, 13563, 1648, 677, 63, 12160, ...
if self.length == 0 or len(s) < amt: self.close()
def read(self, amt=None): if self.fp is None: return ''
89a1295a50df02bb8b6bace13d5a04bacc4f5436 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3187/89a1295a50df02bb8b6bace13d5a04bacc4f5436/httplib.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 855, 12, 2890, 16, 25123, 33, 7036, 4672, 309, 365, 18, 7944, 353, 599, 30, 327, 875, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 855, 12, 2890, 16, 25123, 33, 7036, 4672, 309, 365, 18, 7944, 353, 599, 30, 327, 875, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, ...
points::
points, though which one creates more points is heavily dependent upon the function being plotted. ::
def adaptive_refinement(f, p1, p2, adaptive_tolerance=0.01, adaptive_recursion=5, level=0): r""" The adaptive refinement algorithm for plotting a function f. See the docstring for plot for a description of the algorithm. INPUT: - ``f`` - a function of one variable - ``p1, p2`` - two points to refine between - ``adaptive_recursion`` - (default: 5) how many levels of recursion to go before giving up when doing adaptive refinement. Setting this to 0 disables adaptive refinement. - ``adaptive_tolerance`` - (default: 0.01) how large a difference should be before the adaptive refinement code considers it significant. See the documentation for plot() for more information. OUTPUT: - ``list`` - a list of points to insert between p1 and p2 to get a better linear approximation between them TESTS:: sage: from sage.plot.plot import adaptive_refinement sage: adaptive_refinement(sin, (0,0), (pi,0), adaptive_tolerance=0.01, adaptive_recursion=0) [] sage: adaptive_refinement(sin, (0,0), (pi,0), adaptive_tolerance=0.01) [(0.125*pi, 0.38268343236508978), (0.1875*pi, 0.55557023301960218), (0.25*pi, 0.707106781186547...), (0.3125*pi, 0.831469612302545...), (0.375*pi, 0.92387953251128674), (0.4375*pi, 0.98078528040323043), (0.5*pi, 1.0), (0.5625*pi, 0.98078528040323043), (0.625*pi, 0.92387953251128674), (0.6875*pi, 0.831469612302545...), (0.75*pi, 0.70710678118654757), (0.8125*pi, 0.55557023301960218), (0.875*pi, 0.3826834323650898...)] This shows that lowering adaptive_tolerance and raising adaptive_recursion both increase the number of subdivision points:: sage: x = var('x') sage: f(x) = sin(1/x) sage: n1 = len(adaptive_refinement(f, (0,0), (pi,0), adaptive_tolerance=0.01)); n1 15 sage: n2 = len(adaptive_refinement(f, (0,0), (pi,0), adaptive_recursion=10, adaptive_tolerance=0.01)); n2 79 sage: n3 = len(adaptive_refinement(f, (0,0), (pi,0), adaptive_tolerance=0.001)); n3 26 """ if level >= adaptive_recursion: return [] x = (p1[0] + p2[0])/2.0 try: y = float(f(x)) except (ZeroDivisionError, TypeError, ValueError, OverflowError), msg: sage.misc.misc.verbose("%s\nUnable to compute f(%s)"%(msg, x), 1) # give up for this branch return [] # this distance calculation is not perfect. if abs((p1[1] + p2[1])/2.0 - y) > adaptive_tolerance: return adaptive_refinement(f, p1, (x, y), adaptive_tolerance=adaptive_tolerance, adaptive_recursion=adaptive_recursion, level=level+1) \ + [(x, y)] + \ adaptive_refinement(f, (x, y), p2, adaptive_tolerance=adaptive_tolerance, adaptive_recursion=adaptive_recursion, level=level+1) else: return []
5a18232fc0cdbd019cc9c3bfc626cafbc7bf6b83 /local1/tlutelli/issta_data/temp/all_python//python/2009_temp/2009/9890/5a18232fc0cdbd019cc9c3bfc626cafbc7bf6b83/plot.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 5855, 688, 67, 266, 926, 820, 12, 74, 16, 293, 21, 16, 293, 22, 16, 5855, 688, 67, 25456, 33, 20, 18, 1611, 16, 5855, 688, 67, 31347, 33, 25, 16, 1801, 33, 20, 4672, 436, 8395, 1...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 5855, 688, 67, 266, 926, 820, 12, 74, 16, 293, 21, 16, 293, 22, 16, 5855, 688, 67, 25456, 33, 20, 18, 1611, 16, 5855, 688, 67, 31347, 33, 25, 16, 1801, 33, 20, 4672, 436, 8395, 1...
return LITERAL, chr(int(escape[-2:], 16) & 0xff) elif str(escape[1:2]) in DIGITS: return LITERAL, chr(int(escape[1:], 8) & 0xff) elif len(escape) == 2:
return LITERAL, chr(int(escape[-4:], 16) & 0xff) elif str(escape[1:2]) in OCTDIGITS: while source.next in OCTDIGITS: escape = escape + source.get() escape = escape[1:] return LITERAL, chr(int(escape[-6:], 8) & 0xff) if len(escape) == 2:
def _fixescape(escape, character_class=0): # convert escape to (type, value) if character_class: # inside a character class, we'll look in the character # escapes dictionary first code = ESCAPES.get(escape) if code: return code code = CATEGORIES.get(escape) else: code = CATEGORIES.get(escape) if code: return code code = ESCAPES.get(escape) if code: return code if not character_class: try: group = int(escape[1:]) # FIXME: only valid if group <= current number of groups return GROUP, group except ValueError: pass try: if escape[1:2] == "x": escape = escape[2:] return LITERAL, chr(int(escape[-2:], 16) & 0xff) elif str(escape[1:2]) in DIGITS: return LITERAL, chr(int(escape[1:], 8) & 0xff) elif len(escape) == 2: return LITERAL, escape[1] except ValueError: pass raise SyntaxError, "bogus escape: %s" % repr(escape)
b42c811cba34ab2f6d1db22aed5bc7f0dab153bb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8125/b42c811cba34ab2f6d1db22aed5bc7f0dab153bb/sre_parse.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 389, 904, 6939, 12, 6939, 16, 3351, 67, 1106, 33, 20, 4672, 468, 1765, 4114, 358, 261, 723, 16, 460, 13, 309, 3351, 67, 1106, 30, 468, 4832, 279, 3351, 667, 16, 732, 5614, 2324, 316,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 389, 904, 6939, 12, 6939, 16, 3351, 67, 1106, 33, 20, 4672, 468, 1765, 4114, 358, 261, 723, 16, 460, 13, 309, 3351, 67, 1106, 30, 468, 4832, 279, 3351, 667, 16, 732, 5614, 2324, 316,...
all_music_in_db = self.find_all_musics_path() all_music_in_db_path = [music_file_path for music_file_path in all_music_in_db]
all_music_in_db_path = self.find_all_musics_path()
def update_library(self, musics_path): all_music_in_db = self.find_all_musics_path() all_music_in_db_path = [music_file_path for music_file_path in all_music_in_db] to_be_added = [x for x in musics_path if x not in all_music_in_db_path] to_be_deleted = [x for x in all_music_in_db_path if x not in musics_path] new_musics = [] for file in to_be_added: try: music = Music(file) new_musics.append(music) except: pass for music in new_musics: self.save(music) for music_path in to_be_deleted: self.delete(music_path)
43a0f8d3d71fafa93f66b7de5c6311692b8b2ccd /local1/tlutelli/issta_data/temp/all_python//python/2008_temp/2008/5169/43a0f8d3d71fafa93f66b7de5c6311692b8b2ccd/aspyplayer.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1089, 67, 12083, 12, 2890, 16, 312, 407, 2102, 67, 803, 4672, 777, 67, 81, 14894, 67, 267, 67, 1966, 67, 803, 273, 365, 18, 4720, 67, 454, 67, 81, 407, 2102, 67, 803, 1435, 225, 35...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1089, 67, 12083, 12, 2890, 16, 312, 407, 2102, 67, 803, 4672, 777, 67, 81, 14894, 67, 267, 67, 1966, 67, 803, 273, 365, 18, 4720, 67, 454, 67, 81, 407, 2102, 67, 803, 1435, 225, 35...
self.classAd.set_expression('Requirements',requirements) else: self.classAd.set_expression('Requirements','True') release = gConfig.getValue('/LocalSite/ReleaseVersion',version) self.classAd.insertAttributeString('DIRACVersion',release)
self.classAd.set_expression( 'Requirements', requirements ) else: self.classAd.set_expression( 'Requirements', 'True' ) release = gConfig.getValue( '/LocalSite/ReleaseVersion', version ) self.classAd.insertAttributeString( 'DIRACVersion', release )
def getJDL(self): """Returns CE JDL as a string. """ # Add the CE parameters for option,value in self.ceParameters.items(): if type(option) == type( [] ): self.classAd.insertAttributeVectorString(option, value.split(', ')) elif type(value) == type(' '): jdlInt = self.__getInt(value) if type(jdlInt) == type(1): self.log.debug('Found JDL integer attribute: %s = %s' %(option,jdlInt)) self.classAd.insertAttributeInt(option, jdlInt) else: self.log.debug('Found string attribute: %s = %s' %(option,value)) self.classAd.insertAttributeString(option, value) elif type(value) == type(1): self.log.debug('Found integer attribute: %s = %s' %(option,value)) self.classAd.insertAttributeInt(option, value) else: self.log.warn('Type of option %s = %s not determined' %(option,value)) # Add the CE requirements if any requirements = '' for option,value in self.ceRequirementDict.items(): if type(value) == type(' '): jdlInt = self.__getInt(value) if type(jdlInt) == type(1): requirements += ' other.'+option+' == %d &&' %(jdlInt) self.log.debug('Found JDL reqt integer attribute: %s = %s' %(option,jdlInt)) self.classAd.insertAttributeInt(option, jdlInt) else: requirements += ' other.'+option+' == "%s" &&' %(value) self.log.debug('Found string reqt attribute: %s = %s' %(option,value)) self.classAd.insertAttributeString(option, value) elif type(value) == type(1): requirements += ' other.'+option+' == %d &&' %(value) self.log.debug('Found integer reqt attribute: %s = %s' %(option,value)) self.classAd.insertAttributeInt(option, value) else: self.log.warn('Could not determine type of: %s = %s' %(option,value))
3d103a1ec7530dcfac38e6ccc642be862e663b73 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12864/3d103a1ec7530dcfac38e6ccc642be862e663b73/ComputingElement.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 9285, 8914, 12, 2890, 4672, 3536, 1356, 29538, 804, 8914, 487, 279, 533, 18, 3536, 225, 468, 1436, 326, 29538, 1472, 364, 1456, 16, 1132, 316, 365, 18, 311, 2402, 18, 3319, 13332, 309, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 9285, 8914, 12, 2890, 4672, 3536, 1356, 29538, 804, 8914, 487, 279, 533, 18, 3536, 225, 468, 1436, 326, 29538, 1472, 364, 1456, 16, 1132, 316, 365, 18, 311, 2402, 18, 3319, 13332, 309, ...
if True:
if self.version != "040904B0":
def createFields(self): yield UInt16(self, "size", "Node size (in bytes)") yield UInt16(self, "data_size") yield Enum(UInt16(self, "type"), self.TYPE_NAME) yield CString(self, "name", charset="UTF-16-LE") if self["name"].value in ("040904b0", "040904B0"): self.version = self["name"].value
38277e8e5a8adc1c47cad6886750db7966092cd2 /local1/tlutelli/issta_data/temp/all_python//python/2007_temp/2007/9327/38277e8e5a8adc1c47cad6886750db7966092cd2/exe_res.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 752, 2314, 12, 2890, 4672, 2824, 29810, 2313, 12, 2890, 16, 315, 1467, 3113, 315, 907, 963, 261, 267, 1731, 2225, 13, 2824, 29810, 2313, 12, 2890, 16, 315, 892, 67, 1467, 7923, 2824, 6...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 752, 2314, 12, 2890, 4672, 2824, 29810, 2313, 12, 2890, 16, 315, 1467, 3113, 315, 907, 963, 261, 267, 1731, 2225, 13, 2824, 29810, 2313, 12, 2890, 16, 315, 892, 67, 1467, 7923, 2824, 6...
Finite subgroup with invariants [5, 10] over QQbar of Abelian variety factor of dimension 3 of J0(67)
Finite subgroup with invariants [5, 10] over QQbar of Abelian subvariety of dimension 3 of J0(67)
def __contains__(self, x): """ sage: J = J0(67); G = (J[0] + J[1]).intersection(J[1] + J[2]) sage: G[0] Finite subgroup with invariants [5, 10] over QQbar of Abelian variety factor of dimension 3 of J0(67) sage: a = G[0].0; a [(1/10, 1/10, 3/10, 1/2, 1/5, 4/5)] sage: a in J[0] False sage: a in (J[0]+J[1]) True sage: a in (J[1]+J[2]) True sage: C = G[1] # abelian variety in kernel sage: G[0].0 [(1/10, 1/10, 3/10, 1/2, 1/5, 4/5)] sage: 5*G[0].0 [(1/2, 1/2, 3/2, 5/2, 1, 4)] sage: 5*G[0].0 in C True """ if not isinstance(x, FiniteSubgroupElement): return False if x.parent().abelian_variety().groups() != self.groups(): return False v = x.ambient_element() n = v.denominator() nLambda = self.ambient_variety().lattice().scale(n) return n*v in self.lattice() + nLambda
f30f87afcce1c095974cd5259aa7272b60928586 /local1/tlutelli/issta_data/temp/all_python//python/2008_temp/2008/9890/f30f87afcce1c095974cd5259aa7272b60928586/abvar.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1001, 12298, 972, 12, 2890, 16, 619, 4672, 3536, 272, 410, 30, 804, 273, 804, 20, 12, 9599, 1769, 611, 273, 261, 46, 63, 20, 65, 397, 804, 63, 21, 65, 2934, 30231, 12, 46, 63, 21, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1001, 12298, 972, 12, 2890, 16, 619, 4672, 3536, 272, 410, 30, 804, 273, 804, 20, 12, 9599, 1769, 611, 273, 261, 46, 63, 20, 65, 397, 804, 63, 21, 65, 2934, 30231, 12, 46, 63, 21, ...
self.out = self.docinfo
self.push_output_collector(self.docinfo)
def visit_docinfo(self, node): self.out = self.docinfo
d1a332cc00a1b10df4c2b8fa6efdd3ca79dbf763 /local1/tlutelli/issta_data/temp/all_python//python/2009_temp/2009/1278/d1a332cc00a1b10df4c2b8fa6efdd3ca79dbf763/__init__.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 3757, 67, 2434, 1376, 12, 2890, 16, 756, 4672, 365, 18, 659, 273, 365, 18, 2434, 1376, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 3757, 67, 2434, 1376, 12, 2890, 16, 756, 4672, 365, 18, 659, 273, 365, 18, 2434, 1376, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, ...
sys.stdout.write("bridge ready." + EOL)
sys.stdout.write("Bridge ready. Type !EX to close session." + EOL)
def xmpp_presence(self, conn, presence_node): #print presence_node if presence_node.getFrom().bareMatch(self.remotejid): if presence_node.getType() == 'subscribe': replypres=xmpp.Presence(typ='subscribed',to=presence_node.getFrom()) conn.send(replypres) replypres.setType('subscribe') conn.send(replypres) elif presence_node.getType() == 'probe': replypres = xmpp.Presence(to=presence_node.getFrom(), show='chat', status=self.presencestr) conn.send(replypres) elif ((not presence_node.getShow() is None) and \ presence_node.getShow != '') : pass #sys.stdout.write("*** Status: " + presence_node.getShow() + "\n")
0cd4f458c819b41735c97ec8fb1a55a128bdebad /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/14053/0cd4f458c819b41735c97ec8fb1a55a128bdebad/ax25xmpp.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 619, 24109, 67, 21731, 12, 2890, 16, 1487, 16, 9805, 67, 2159, 4672, 468, 1188, 9805, 67, 2159, 309, 9805, 67, 2159, 18, 588, 1265, 7675, 70, 834, 2060, 12, 2890, 18, 7222, 18252, 4672...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 619, 24109, 67, 21731, 12, 2890, 16, 1487, 16, 9805, 67, 2159, 4672, 468, 1188, 9805, 67, 2159, 309, 9805, 67, 2159, 18, 588, 1265, 7675, 70, 834, 2060, 12, 2890, 18, 7222, 18252, 4672...
cr.execute('select id,number_next,number_increment,prefix,suffix,padding from ir_sequence where '+test+' and active=True FOR UPDATE', (sequence_id,)) res = cr.dictfetchone() if res: cr.execute('update ir_sequence set number_next=number_next+number_increment where id=%s and active=True', (res['id'],)) if res['number_next']: return self._process(res['prefix']) + '%%0%sd' % res['padding'] % res['number_next'] + self._process(res['suffix']) else: return self._process(res['prefix']) + self._process(res['suffix'])
try: cr.execute('lock table ir_sequence') cr.execute('select id,number_next,number_increment,prefix,suffix,padding from ir_sequence where '+test+' and active=True', (sequence_id,)) res = cr.dictfetchone() if res: cr.execute('update ir_sequence set number_next=number_next+number_increment where id=%s and active=True', (res['id'],)) if res['number_next']: return self._process(res['prefix']) + '%%0%sd' % res['padding'] % res['number_next'] + self._process(res['suffix']) else: return self._process(res['prefix']) + self._process(res['suffix']) finally: cr.commit()
def get_id(self, cr, uid, sequence_id, test='id=%s', context={}): cr.execute('select id,number_next,number_increment,prefix,suffix,padding from ir_sequence where '+test+' and active=True FOR UPDATE', (sequence_id,)) res = cr.dictfetchone() if res: cr.execute('update ir_sequence set number_next=number_next+number_increment where id=%s and active=True', (res['id'],)) if res['number_next']: return self._process(res['prefix']) + '%%0%sd' % res['padding'] % res['number_next'] + self._process(res['suffix']) else: return self._process(res['prefix']) + self._process(res['suffix']) return False
f31ce5813ba28150d2f9affc72311626a4ff94b0 /local1/tlutelli/issta_data/temp/all_python//python/2009_temp/2009/7397/f31ce5813ba28150d2f9affc72311626a4ff94b0/ir_sequence.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 336, 67, 350, 12, 2890, 16, 4422, 16, 4555, 16, 3102, 67, 350, 16, 1842, 2218, 350, 5095, 87, 2187, 819, 12938, 4672, 775, 30, 4422, 18, 8837, 2668, 739, 1014, 9482, 67, 6178, 6134, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 336, 67, 350, 12, 2890, 16, 4422, 16, 4555, 16, 3102, 67, 350, 16, 1842, 2218, 350, 5095, 87, 2187, 819, 12938, 4672, 775, 30, 4422, 18, 8837, 2668, 739, 1014, 9482, 67, 6178, 6134, ...
if not state.useDB and state.databaseFilename: self.push("<b>Saving...</b>") self.push(' ') state.bayes.store()
self.doSave()
def onShutdown(self, params): """Shutdown the server, saving the pickle if requested to do so.""" if params['how'].lower().find('save') >= 0: if not state.useDB and state.databaseFilename: self.push("<b>Saving...</b>") self.push(' ') # Acts as a flush for small buffers. state.bayes.store() self.push("<b>Shutdown</b>. Goodbye.</div></body></html>") self.push(' ') self.shutdown(2) self.close() raise SystemExit
b4db8e8cff9ae2da9617fcf4ec43e2aa8aa06995 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6126/b4db8e8cff9ae2da9617fcf4ec43e2aa8aa06995/pop3proxy.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 603, 10961, 12, 2890, 16, 859, 4672, 3536, 10961, 326, 1438, 16, 12392, 326, 13379, 309, 3764, 358, 741, 1427, 12123, 309, 859, 3292, 13606, 29489, 8167, 7675, 4720, 2668, 5688, 6134, 1545...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 603, 10961, 12, 2890, 16, 859, 4672, 3536, 10961, 326, 1438, 16, 12392, 326, 13379, 309, 3764, 358, 741, 1427, 12123, 309, 859, 3292, 13606, 29489, 8167, 7675, 4720, 2668, 5688, 6134, 1545...
except:
except TypeError:
def enum_projective_finite_field(X): """ Enumerates projective points on scheme X defined over a finite field INPUT: - ``X`` - a scheme defined over a finite field or set of abstract rational points of such a scheme OUTPUT: - a list containing the projective points of X over the finite field, sorted EXAMPLES:: sage: F = GF(53) sage: P.<X,Y,Z> = ProjectiveSpace(2,F) sage: from sage.schemes.generic.rational_point import enum_projective_finite_field sage: len(enum_projective_finite_field(P(F))) 2863 sage: 53^2+53+1 2863 :: sage: F = GF(9,'a') sage: P.<X,Y,Z> = ProjectiveSpace(2,F) sage: C = Curve(X^3-Y^3+Z^2*Y) sage: enum_projective_finite_field(C(F)) [(0 : 0 : 1), (0 : 1 : 1), (0 : 2 : 1), (1 : 1 : 0), (a + 1 : 2*a : 1), (a + 1 : 2*a + 1 : 1), (a + 1 : 2*a + 2 : 1), (2*a + 2 : a : 1), (2*a + 2 : a + 1 : 1), (2*a + 2 : a + 2 : 1)] :: sage: F = GF(5) sage: P2F.<X,Y,Z> = ProjectiveSpace(2,F) sage: enum_projective_finite_field(P2F) [(0 : 0 : 1), (0 : 1 : 0), (0 : 1 : 1), (0 : 2 : 1), (0 : 3 : 1), (0 : 4 : 1), (1 : 0 : 0), (1 : 0 : 1), (1 : 1 : 0), (1 : 1 : 1), (1 : 2 : 1), (1 : 3 : 1), (1 : 4 : 1), (2 : 0 : 1), (2 : 1 : 0), (2 : 1 : 1), (2 : 2 : 1), (2 : 3 : 1), (2 : 4 : 1), (3 : 0 : 1), (3 : 1 : 0), (3 : 1 : 1), (3 : 2 : 1), (3 : 3 : 1), (3 : 4 : 1), (4 : 0 : 1), (4 : 1 : 0), (4 : 1 : 1), (4 : 2 : 1), (4 : 3 : 1), (4 : 4 : 1)] ALGORITHM: Checks all points in projective space to see if they lie on X. NOTE: Warning:if X given as input is defined over an infinite field then this code will not finish! AUTHORS: John Cremona and Charlie Turner (06-2010) """ if is_Scheme(X): X = X(X.base_ring()) n = X.codomain().ambient_space().ngens()-1 F = X.value_ring() pts = [] for k in range(n+1): for c in cartesian_product_iterator([F for _ in range(k)]): try: pts.append(X(list(c)+[1]+[0]*(n-k))) except: pass pts.sort() return pts
7437114fd97818d63a9f0b766fecf0fb34f4f16c /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/9417/7437114fd97818d63a9f0b766fecf0fb34f4f16c/rational_point.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 2792, 67, 4406, 688, 67, 9551, 67, 1518, 12, 60, 4672, 3536, 6057, 264, 815, 1984, 688, 3143, 603, 4355, 1139, 2553, 1879, 279, 25922, 652, 225, 12943, 30, 225, 300, 12176, 60, 10335, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 2792, 67, 4406, 688, 67, 9551, 67, 1518, 12, 60, 4672, 3536, 6057, 264, 815, 1984, 688, 3143, 603, 4355, 1139, 2553, 1879, 279, 25922, 652, 225, 12943, 30, 225, 300, 12176, 60, 10335, ...
def __closeSession(self):
def __closeSession( self ):
def __closeSession(self): """Close the LFC client/server session""" if self.session: lfc.lfc_endsess() self.session = False
6280f3782654b93320f684f56a83a6624459bcec /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12864/6280f3782654b93320f684f56a83a6624459bcec/LcgFileCatalogClient.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1001, 4412, 2157, 12, 365, 262, 30, 3536, 4605, 326, 511, 4488, 1004, 19, 3567, 1339, 8395, 309, 365, 18, 3184, 30, 328, 7142, 18, 80, 7142, 67, 5839, 403, 1435, 365, 18, 3184, 273, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1001, 4412, 2157, 12, 365, 262, 30, 3536, 4605, 326, 511, 4488, 1004, 19, 3567, 1339, 8395, 309, 365, 18, 3184, 30, 328, 7142, 18, 80, 7142, 67, 5839, 403, 1435, 365, 18, 3184, 273, ...
def fixup_repo_options(options): """ Check options.comm_repo and options.mozilla_repo values; populate mozilla_repo if needed. options.comm_repo and options.mozilla_repo are normally None. This is fine-- our "hg pull" commands will omit the repo URL. The exception is the initial checkout, which does an "hg clone" for Mozilla. That command requires a repository URL.
def fixup_comm_repo_options(options): """Check options.comm_repo value. options.comm_repo is normally None. This is fine -- our "hg pull" command will omit the repo URL. The exception is the initial checkout, which does an "hg clone". That command requires a repository URL.
def fixup_repo_options(options): """ Check options.comm_repo and options.mozilla_repo values; populate mozilla_repo if needed. options.comm_repo and options.mozilla_repo are normally None. This is fine-- our "hg pull" commands will omit the repo URL. The exception is the initial checkout, which does an "hg clone" for Mozilla. That command requires a repository URL. """ if (options.comm_repo is None and not os.path.exists(os.path.join(topsrcdir, '.hg'))): o.print_help() print print "*** The -m option is required for the initial checkout." sys.exit(2) # Handle special case: initial checkout of Mozilla. if (options.mozilla_repo is None and not os.path.exists(os.path.join(topsrcdir, 'mozilla'))): options.mozilla_repo = DEFAULT_MOZILLA_REPO # Handle special case: initial checkout of inspector. if (options.inspector_repo is None and not os.path.exists(os.path.join(topsrcdir, 'mozilla', 'extensions', 'inspector'))): options.inspector_repo = DEFAULT_INSPECTOR_REPO # Handle special case: initial checkout of Venkman. if (options.venkman_repo is None and not os.path.exists(os.path.join(topsrcdir, 'mozilla', 'extensions', 'venkman'))): options.venkman_repo = DEFAULT_VENKMAN_REPO
868b723d746c09df1778ed86033687c7a2c9c004 /local1/tlutelli/issta_data/temp/all_python//python/2009_temp/2009/11044/868b723d746c09df1778ed86033687c7a2c9c004/client.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 2917, 416, 67, 5702, 67, 7422, 67, 2116, 12, 2116, 4672, 3536, 1564, 702, 18, 5702, 67, 7422, 460, 18, 225, 702, 18, 5702, 67, 7422, 353, 15849, 599, 18, 1220, 353, 11079, 1493, 3134, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 2917, 416, 67, 5702, 67, 7422, 67, 2116, 12, 2116, 4672, 3536, 1564, 702, 18, 5702, 67, 7422, 460, 18, 225, 702, 18, 5702, 67, 7422, 353, 15849, 599, 18, 1220, 353, 11079, 1493, 3134, ...
"artist album": "^([\\d\\w_\ \']+)\ -\ ([\\d\\w_\ \']+)$",
"artist album": "^([\\d\\w_\ \'\.]+)\ -\ ([\\d\\w_\ \'\.]+)$",
def _do_album_(self): regexs = { "artist album year":"^([\\d\\w_\ ]+)-([\\d\\w_\ ]+).+([\\d]{4})", "artist album":"^([\\d\\w_\ ]+)-([\\d\\w_\ ]+)$", "artist album": "^([\\d\\w_\ \']+)\ -\ ([\\d\\w_\ \']+)$", "album":"^([\\d\\w_\ ]+)$" }
9257284e75faf18e7fb811b79b080a79bdb533f1 /local1/tlutelli/issta_data/temp/all_python//python/2008_temp/2008/5115/9257284e75faf18e7fb811b79b080a79bdb533f1/regexp.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 389, 2896, 67, 25090, 67, 12, 2890, 4672, 3936, 87, 273, 288, 315, 25737, 14844, 3286, 15563, 66, 3816, 1695, 72, 1695, 91, 22202, 308, 6975, 17, 3816, 1695, 72, 1695, 91, 22202, 308, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 389, 2896, 67, 25090, 67, 12, 2890, 4672, 3936, 87, 273, 288, 315, 25737, 14844, 3286, 15563, 66, 3816, 1695, 72, 1695, 91, 22202, 308, 6975, 17, 3816, 1695, 72, 1695, 91, 22202, 308, ...
self.nb = ttk.Notebook()
self.nb = ttk.Notebook(padding=0)
def setUp(self): support.root_deiconify() self.nb = ttk.Notebook() self.child1 = ttk.Label() self.child2 = ttk.Label() self.nb.add(self.child1, text='a') self.nb.add(self.child2, text='b')
cb159881148812b6a842748ecc8c820402e9df65 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/8546/cb159881148812b6a842748ecc8c820402e9df65/test_widgets.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 24292, 12, 2890, 4672, 2865, 18, 3085, 67, 323, 3950, 1164, 1435, 365, 18, 6423, 273, 3574, 79, 18, 19751, 12, 9598, 33, 20, 13, 365, 18, 3624, 21, 273, 3574, 79, 18, 2224, 1435, 365...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 24292, 12, 2890, 4672, 2865, 18, 3085, 67, 323, 3950, 1164, 1435, 365, 18, 6423, 273, 3574, 79, 18, 19751, 12, 9598, 33, 20, 13, 365, 18, 3624, 21, 273, 3574, 79, 18, 2224, 1435, 365...
tixlib = os.environ.get('TIX_LIBRARY') if tixlib is not None: self.tk.eval('global auto_path; lappend auto_path {%s}' % tixlib) self.tk.eval('global tcl_pkgPath; lappend tcl_pkgPath {%s}' % tixlib)
tixlib = os.environ.get('TIX_LIBRARY') if tixlib is not None: self.tk.eval('global auto_path; lappend auto_path {%s}' % tixlib) self.tk.eval('global tcl_pkgPath; lappend tcl_pkgPath {%s}' % tixlib)
def __init__(self, screenName=None, baseName=None, className='Tk'): Tkinter.Tk.__init__(self, screenName, baseName, className)
b0e44d61d9e592e1acd6aa05eac9704ba5776f61 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8125/b0e44d61d9e592e1acd6aa05eac9704ba5776f61/Tix.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1001, 2738, 972, 12, 2890, 16, 5518, 461, 33, 7036, 16, 16162, 33, 7036, 16, 2658, 2218, 56, 79, 11, 4672, 399, 79, 2761, 18, 56, 79, 16186, 2738, 972, 12, 2890, 16, 5518, 461, 16, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1001, 2738, 972, 12, 2890, 16, 5518, 461, 33, 7036, 16, 16162, 33, 7036, 16, 2658, 2218, 56, 79, 11, 4672, 399, 79, 2761, 18, 56, 79, 16186, 2738, 972, 12, 2890, 16, 5518, 461, 16, ...
rpms = glob.glob(os.path.join(rpm_dir['RPMS'], "*/*.rpm")) debuginfo = glob.glob(os.path.join(rpm_dir['RPMS'], "*/*debuginfo*.rpm")) if debuginfo: rpms.remove(debuginfo[0]) assert len(rpms) == 1, \ "unexpected number of RPM files found: %s" % rpms dist_file = ('bdist_rpm', get_python_version(), self._dist_path(rpms[0])) self.distribution.dist_files.append(dist_file) self.move_file(rpms[0], self.dist_dir) if debuginfo: dist_file = ('bdist_rpm', get_python_version(), self._dist_path(debuginfo[0])) self.move_file(debuginfo[0], self.dist_dir)
for rpm in binary_rpms: rpm = os.path.join(rpm_dir['RPMS'], rpm) if os.path.exists(rpm): self.move_file(rpm, self.dist_dir)
def run (self):
602976c02bb4dbbb0e2d7c31484e6f0468e8b081 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8125/602976c02bb4dbbb0e2d7c31484e6f0468e8b081/bdist_rpm.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1086, 261, 2890, 4672, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1086, 261, 2890, 4672, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, ...
if self.__yalign == Widget.ALIGN_BOTTOM: y += self.__height - self._obj.get_height()
elif self.__yalign == Widget.ALIGN_BOTTOM: y += self.__height - self._obj.get_height() - self.__ypadding
def _candy_sync_layout(self): """ Layout the widget """ self._sync_layout = False x, y = self.__x, self.__y anchor_x = anchor_y = 0 if self.__xalign: if self.__xalign == Widget.ALIGN_CENTER: x += (self.__width - self._obj.get_width()) / 2 anchor_x = self._obj.get_width() / 2 if self.__xalign == Widget.ALIGN_RIGHT: x += self.__width - self._obj.get_width() anchor_x = self._obj.get_width() if self.__yalign: if self.__yalign == Widget.ALIGN_CENTER: y += (self.__height - self._obj.get_height()) / 2 anchor_y = self._obj.get_height() / 2 if self.__yalign == Widget.ALIGN_BOTTOM: y += self.__height - self._obj.get_height() anchor_y = self._obj.get_height() if self.__anchor: anchor_x, anchor_y = self.__anchor if anchor_x or anchor_y: self._obj.set_anchor_point(anchor_x, anchor_y) x += anchor_x y += anchor_y if self.__xpadding: x += self.__xpadding if self.__ypadding: y += self.__ypadding self._obj.set_position(x, y)
8340c13e8a7958b1c648e6fd3935f8cbe420924b /local1/tlutelli/issta_data/temp/all_python//python/2008_temp/2008/11702/8340c13e8a7958b1c648e6fd3935f8cbe420924b/widget.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 389, 71, 464, 93, 67, 8389, 67, 6741, 12, 2890, 4672, 3536, 9995, 326, 3604, 3536, 365, 6315, 8389, 67, 6741, 273, 1083, 619, 16, 677, 273, 365, 16186, 92, 16, 365, 16186, 93, 6984, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 389, 71, 464, 93, 67, 8389, 67, 6741, 12, 2890, 4672, 3536, 9995, 326, 3604, 3536, 365, 6315, 8389, 67, 6741, 273, 1083, 619, 16, 677, 273, 365, 16186, 92, 16, 365, 16186, 93, 6984, ...
Paste.query.filter(Paste.paste_id.in_(to_mark)) \ .update(values={'handled': True}) db.session.commit()
if to_mark: Paste.query.filter(Paste.paste_id.in_(to_mark)) \ .update(values={'handled': True}) db.session.commit()
def fetch_replies(): """Get the new replies for the ower of a request and flag them as handled. """ ids = db.session.query(Paste.paste_id) \ .filter(Paste.user_hash == local.request.user_hash)
f6f94a8a4762a70303b5283eb159c3d1fba9f583 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11759/f6f94a8a4762a70303b5283eb159c3d1fba9f583/models.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 2158, 67, 266, 5259, 13332, 3536, 967, 326, 394, 22009, 364, 326, 320, 2051, 434, 279, 590, 471, 2982, 2182, 487, 7681, 18, 3536, 3258, 273, 1319, 18, 3184, 18, 2271, 12, 52, 14725, 18...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 2158, 67, 266, 5259, 13332, 3536, 967, 326, 394, 22009, 364, 326, 320, 2051, 434, 279, 590, 471, 2982, 2182, 487, 7681, 18, 3536, 3258, 273, 1319, 18, 3184, 18, 2271, 12, 52, 14725, 18...
print "DEBUGGING INFORMATION" print print child child.close() raise TrueException.UnknownError
self.__debug(child)
def close(self): """ Unmounts the Container """ if not self.status == tcerr.mounted: return tcerr.umounted
45c7008ec468e016bc4c3c6a3e0cfc7e83553c19 /local1/tlutelli/issta_data/temp/all_python//python/2007_temp/2007/3000/45c7008ec468e016bc4c3c6a3e0cfc7e83553c19/truecrypt.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1746, 12, 2890, 4672, 3536, 1351, 4778, 87, 326, 4039, 3536, 309, 486, 365, 18, 2327, 422, 1715, 370, 18, 4778, 329, 30, 327, 1715, 370, 18, 379, 592, 329, 2, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1746, 12, 2890, 4672, 3536, 1351, 4778, 87, 326, 4039, 3536, 309, 486, 365, 18, 2327, 422, 1715, 370, 18, 4778, 329, 30, 327, 1715, 370, 18, 379, 592, 329, 2, -100, -100, -100, -100, ...
if tag in self.mandatory_build_tag and \ not tag in used_mandatory_build_tag: used_mandatory_build_tag.add(tag) build_tag_dict[tag](word_pair)
if tag in self.mandatory_build_tags and \ not tag in used_mandatory_build_tags: used_mandatory_build_tags.add(tag) build_tag_dict[tag](line, word_pair, None, type)
def parse(self, drill_file): """ Parse a .drill or .build file. """ self.current_drill_file = drill_file f = open(drill_file) head_tag_dict = self.head_tag_dict build_tag_dict = self.build_tag_dict used_mandatory_head_tags=set(None) used_mandatory_build_tags=set(None)
8f2fd4ba9422f87f7189ea146c49c96af4440646 /local1/tlutelli/issta_data/temp/all_python//python/2007_temp/2007/2313/8f2fd4ba9422f87f7189ea146c49c96af4440646/SaDrill.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1109, 12, 2890, 16, 5081, 737, 67, 768, 4672, 3536, 2884, 279, 263, 3069, 737, 578, 263, 3510, 585, 18, 3536, 365, 18, 2972, 67, 3069, 737, 67, 768, 273, 5081, 737, 67, 768, 284, 273...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1109, 12, 2890, 16, 5081, 737, 67, 768, 4672, 3536, 2884, 279, 263, 3069, 737, 578, 263, 3510, 585, 18, 3536, 365, 18, 2972, 67, 3069, 737, 67, 768, 273, 5081, 737, 67, 768, 284, 273...
self._wget(link, optMap, currDepth+1, maxDepth, nsavePath)
self._wget(link, optMap, currDepth+1)
def _wget(self, url, optMap, currDepth, maxDepth, savePath): # cycle check if url in self.urlIndex: return # already processed this url else: self.urlIndex.append(url)
9d1220abfbcbc31806deb9a0809fb045a329b4e4 /local1/tlutelli/issta_data/temp/all_python//python/2008_temp/2008/5718/9d1220abfbcbc31806deb9a0809fb045a329b4e4/Wget.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 389, 91, 588, 12, 2890, 16, 880, 16, 2153, 863, 16, 4306, 6148, 16, 22074, 16, 1923, 743, 4672, 468, 8589, 866, 309, 880, 316, 365, 18, 718, 1016, 30, 327, 225, 468, 1818, 5204, 333,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 389, 91, 588, 12, 2890, 16, 880, 16, 2153, 863, 16, 4306, 6148, 16, 22074, 16, 1923, 743, 4672, 468, 8589, 866, 309, 880, 316, 365, 18, 718, 1016, 30, 327, 225, 468, 1818, 5204, 333,...
MarkerInterface,\
def fromDom(self, node): self.setAttributes(node) contents = self.getContents(node) content = []
6c6678d8443cc0ac1425216db36bdd74c2f8cb7b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/13054/6c6678d8443cc0ac1425216db36bdd74c2f8cb7b/XMLSchema.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 628, 8832, 12, 2890, 16, 756, 4672, 365, 18, 542, 2498, 12, 2159, 13, 2939, 273, 365, 18, 588, 6323, 12, 2159, 13, 913, 273, 5378, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 628, 8832, 12, 2890, 16, 756, 4672, 365, 18, 542, 2498, 12, 2159, 13, 2939, 273, 365, 18, 588, 6323, 12, 2159, 13, 913, 273, 5378, 2, -100, -100, -100, -100, -100, -100, -100, -100, ...
'from': fields.float('From', digits=(16, int(config['price_accuracy']))), 'to': fields.float('To', digits=(16, int(config['price_accuracy']))),
'from_val': fields.float('From', digits=(16, int(config['price_accuracy']))), 'to_val': fields.float('To', digits=(16, int(config['price_accuracy']))),
def execute_function(self, cr, uid, id, value, context): line_pool = self.pool.get('hr.allounce.deduction.categoty.line') res = 0 ids = line_pool.search(cr, uid, [('category_id','=',id), ('to','>=',value),('from','<=',value)]) if not ids: ids = line_pool.search(cr, uid, [('category_id','=',id), ('from','<=',value)]) if not ids: res = 0 else: res = line_pool.browse(cr, uid, ids)[0].value return res
9cefb7520803ded7f648633ccca30e623a0dd192 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/7339/9cefb7520803ded7f648633ccca30e623a0dd192/hr_payroll.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1836, 67, 915, 12, 2890, 16, 4422, 16, 4555, 16, 612, 16, 460, 16, 819, 4672, 980, 67, 6011, 273, 365, 18, 6011, 18, 588, 2668, 7256, 18, 287, 383, 318, 311, 18, 785, 4062, 18, 71,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1836, 67, 915, 12, 2890, 16, 4422, 16, 4555, 16, 612, 16, 460, 16, 819, 4672, 980, 67, 6011, 273, 365, 18, 6011, 18, 588, 2668, 7256, 18, 287, 383, 318, 311, 18, 785, 4062, 18, 71,...
if find_token(file.preamble, text[0]) != -1:
if find_token(file.preamble, text[0], 0) != -1:
def add_to_preamble(file, text): if find_token(file.preamble, text[0]) != -1: return file.preamble.extend(text)
9826fde5c935d94a28cc2fe145b24f26be1f99fc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7514/9826fde5c935d94a28cc2fe145b24f26be1f99fc/lyx_1_4.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 527, 67, 869, 67, 84, 793, 7119, 12, 768, 16, 977, 4672, 309, 1104, 67, 2316, 12, 768, 18, 84, 793, 7119, 16, 977, 63, 20, 6487, 374, 13, 480, 300, 21, 30, 327, 225, 585, 18, 84,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 527, 67, 869, 67, 84, 793, 7119, 12, 768, 16, 977, 4672, 309, 1104, 67, 2316, 12, 768, 18, 84, 793, 7119, 16, 977, 63, 20, 6487, 374, 13, 480, 300, 21, 30, 327, 225, 585, 18, 84,...
if module[-4:]=='.zip': module = module[:-4]
def create_graph(module_list, force=None): if not force: force=[] graph = Graph() packages = [] for module in module_list: if module[-4:]=='.zip': module = module[:-4] try: mod_path = get_module_path(module) if not mod_path: continue except IOError: continue terp_file = get_module_resource(module, '__terp__.py') if not terp_file: continue if os.path.isfile(terp_file) or zipfile.is_zipfile(mod_path+'.zip'): try: info = eval(tools.file_open(terp_file).read()) except: logger.notifyChannel('init', netsvc.LOG_ERROR, 'addon:%s:eval file %s' % (module, terp_file)) raise if info.get('installable', True): packages.append((module, info.get('depends', []), info)) current,later = Set([p for p, dep, data in packages]), Set() while packages and current > later: package, deps, datas = packages[0] # if all dependencies of 'package' are already in the graph, add 'package' in the graph if reduce(lambda x,y: x and y in graph, deps, True): if not package in current: packages.pop(0) continue later.clear() current.remove(package) graph.addNode(package, deps) node = Node(package, graph) node.datas = datas for kind in ('init', 'demo', 'update'): if package in tools.config[kind] or 'all' in tools.config[kind] or kind in force: setattr(node, kind, True) else: later.add(package) packages.append((package, deps, datas)) packages.pop(0) for package in later: logger.notifyChannel('init', netsvc.LOG_ERROR, 'addon:%s:Unmet dependency' % package) return graph
0b8ba360af4b4441caa381ccfe450bf8f98452e6 /local1/tlutelli/issta_data/temp/all_python//python/2008_temp/2008/12853/0b8ba360af4b4441caa381ccfe450bf8f98452e6/__init__.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 752, 67, 4660, 12, 2978, 67, 1098, 16, 2944, 33, 7036, 4672, 309, 486, 2944, 30, 2944, 33, 8526, 2667, 273, 5601, 1435, 5907, 273, 5378, 225, 364, 1605, 316, 1605, 67, 1098, 30, 775, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 752, 67, 4660, 12, 2978, 67, 1098, 16, 2944, 33, 7036, 4672, 309, 486, 2944, 30, 2944, 33, 8526, 2667, 273, 5601, 1435, 5907, 273, 5378, 225, 364, 1605, 316, 1605, 67, 1098, 30, 775, ...
twoWeeks = self.start + timedelta(days=14) occurs = self.event.getOccurrencesBetween(twoWeeks + timedelta(minutes=30), datetime(2005, 8, 1, 14)) self.assertEqual(list(occurs)[0].startTime, twoWeeks) self.assertEqual(list(occurs)[1].startTime, datetime(2005, 8, 1, 13))
threeWeeks = self.start + timedelta(days=21) occurs = self.event.getOccurrencesBetween(threeWeeks + timedelta(minutes=30), datetime(2005, 8, 15, 14)) self.assertEqual(list(occurs)[0].startTime, threeWeeks) self.assertEqual(list(occurs)[1].startTime, datetime(2005, 8, 15, 13))
def testRuleChange(self): self.event.rruleset = self._createRuleSetItem('weekly') # self and an automatically generated backup occurrence should exist self.assertEqual(len(self.event.occurrences), 2)
ebd062a8c7f04ba8a4db5b3d794548e09ca279cf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9228/ebd062a8c7f04ba8a4db5b3d794548e09ca279cf/TestRecurringEvent.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1842, 2175, 3043, 12, 2890, 4672, 365, 18, 2575, 18, 523, 1513, 278, 273, 365, 6315, 2640, 21474, 1180, 2668, 10741, 715, 6134, 468, 365, 471, 392, 6635, 4374, 5114, 13083, 1410, 1005, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1842, 2175, 3043, 12, 2890, 4672, 365, 18, 2575, 18, 523, 1513, 278, 273, 365, 6315, 2640, 21474, 1180, 2668, 10741, 715, 6134, 468, 365, 471, 392, 6635, 4374, 5114, 13083, 1410, 1005, 3...
desc = nl2br(cgi.escape(changes[4])), date = time.asctime(time.gmtime(t)),
desc = changes[4], date = t,
def changelist(): parity = (start - end) & 1 cl = self.repo.changelog l = [] # build a list in forward order for efficiency for i in range(start, end + 1): n = cl.node(i) changes = cl.read(n) hn = hex(n) p1, p2 = cl.parents(n) t = float(changes[2].split(' ')[0])
67df6715c948c4f7c6d7d2e72c3c108141d13150 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11312/67df6715c948c4f7c6d7d2e72c3c108141d13150/hgweb.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 9435, 5449, 13332, 19904, 273, 261, 1937, 300, 679, 13, 473, 404, 927, 273, 365, 18, 7422, 18, 24083, 12970, 328, 273, 5378, 468, 1361, 279, 666, 316, 5104, 1353, 364, 30325, 364, 277, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 9435, 5449, 13332, 19904, 273, 261, 1937, 300, 679, 13, 473, 404, 927, 273, 365, 18, 7422, 18, 24083, 12970, 328, 273, 5378, 468, 1361, 279, 666, 316, 5104, 1353, 364, 30325, 364, 277, ...
%(date)s
%(date)s
def ApeSerializer(): return constructSerializer(%(class_name)s)
2707a5f2d62b6fe92cbe7e0be8698cc72db3c788 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11941/2707a5f2d62b6fe92cbe7e0be8698cc72db3c788/codesnippets.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 432, 347, 6306, 13332, 327, 4872, 6306, 9275, 12, 1106, 67, 529, 13, 87, 13, 225, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 432, 347, 6306, 13332, 327, 4872, 6306, 9275, 12, 1106, 67, 529, 13, 87, 13, 225, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100,...
try: f = getattr(input, method) value = apply(f, args) except: value = sys.exc_type exc = sys.exc_info()[:2] if value is input: if verbose: print 'no' print '*',f, `input`, `output`, `value` return if value != output or type(value) is not type(output): if verbose: print 'no' print '*',f, `input`, `output`, `value` if exc: print ' value == %s: %s' % (exc) else: if verbose: print 'yes' test('capitalize', u' hello ', u' hello ') test('capitalize', u'Hello ', u'Hello ') test('capitalize', u'hello ', u'Hello ') test('capitalize', u'aaaa', u'Aaaa') test('capitalize', u'AaAa', u'Aaaa') test('count', u'aaa', 3, u'a') test('count', u'aaa', 0, u'b') test('count', 'aaa', 3, u'a') test('count', 'aaa', 0, u'b') test('count', u'aaa', 3, 'a') test('count', u'aaa', 0, 'b') test('title', u' hello ', u' Hello ') test('title', u'Hello ', u'Hello ') test('title', u'hello ', u'Hello ') test('title', u"fOrMaT thIs aS titLe String", u'Format This As Title String') test('title', u"fOrMaT,thIs-aS*titLe;String", u'Format,This-As*Title;String') test('title', u"getInt", u'Getint') test('find', u'abcdefghiabc', 0, u'abc') test('find', u'abcdefghiabc', 9, u'abc', 1) test('find', u'abcdefghiabc', -1, u'def', 4) test('rfind', u'abcdefghiabc', 9, u'abc') test('rfind', 'abcdefghiabc', 9, u'abc') test('rfind', 'abcdefghiabc', 12, u'') test('rfind', u'abcdefghiabc', 12, '') test('rfind', u'abcdefghiabc', 12, u'') test('lower', u'HeLLo', u'hello') test('lower', u'hello', u'hello') test('upper', u'HeLLo', u'HELLO') test('upper', u'HELLO', u'HELLO') if 0: transtable = '\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037 !" test('maketrans', u'abc', transtable, u'xyz') test('maketrans', u'abc', ValueError, u'xyzq') test('split', u'this is the split function', [u'this', u'is', u'the', u'split', u'function']) test('split', u'a|b|c|d', [u'a', u'b', u'c', u'd'], u'|') test('split', u'a|b|c|d', [u'a', u'b', u'c|d'], u'|', 2) test('split', u'a b c d', [u'a', u'b c d'], None, 1) test('split', u'a b c d', [u'a', u'b', u'c d'], None, 2) test('split', u'a b c d', [u'a', u'b', u'c', u'd'], None, 3) test('split', u'a b c d', [u'a', u'b', u'c', u'd'], None, 4) test('split', u'a b c d', [u'a b c d'], None, 0) test('split', u'a b c d', [u'a', u'b', u'c d'], None, 2) test('split', u'a b c d ', [u'a', u'b', u'c', u'd']) test('split', u'a//b//c//d', [u'a', u'b', u'c', u'd'], u'//') test('split', u'a//b//c//d', [u'a', u'b', u'c', u'd'], '//') test('split', 'a//b//c//d', [u'a', u'b', u'c', u'd'], u'//') test('split', u'endcase test', [u'endcase ', u''], u'test') test('split', u'endcase test', [u'endcase ', u''], 'test') test('split', 'endcase test', [u'endcase ', u''], u'test') class Sequence: def __init__(self, seq): self.seq = seq def __len__(self): return len(self.seq) def __getitem__(self, i): return self.seq[i] test('join', u' ', u'a b c d', [u'a', u'b', u'c', u'd']) test('join', u' ', u'a b c d', ['a', 'b', u'c', u'd']) test('join', u'', u'abcd', (u'a', u'b', u'c', u'd')) test('join', u' ', u'w x y z', Sequence('wxyz')) test('join', u' ', TypeError, 7) test('join', u' ', TypeError, Sequence([7, u'hello', 123L])) test('join', ' ', u'a b c d', [u'a', u'b', u'c', u'd']) test('join', ' ', u'a b c d', ['a', 'b', u'c', u'd']) test('join', '', u'abcd', (u'a', u'b', u'c', u'd')) test('join', ' ', u'w x y z', Sequence(u'wxyz')) test('join', ' ', TypeError, 7) result = u'' for i in range(10): if i > 0: result = result + u':' result = result + u'x'*10 test('join', u':', result, [u'x' * 10] * 10) test('join', u':', result, (u'x' * 10,) * 10) test('strip', u' hello ', u'hello') test('lstrip', u' hello ', u'hello ') test('rstrip', u' hello ', u' hello') test('strip', u'hello', u'hello') test('strip', u' hello ', u'hello', None) test('lstrip', u' hello ', u'hello ', None) test('rstrip', u' hello ', u' hello', None) test('strip', u'hello', u'hello', None) test('strip', u'xyzzyhelloxyzzy', u'hello', u'xyz') test('lstrip', u'xyzzyhelloxyzzy', u'helloxyzzy', u'xyz') test('rstrip', u'xyzzyhelloxyzzy', u'xyzzyhello', u'xyz') test('strip', u'hello', u'hello', u'xyz') test('strip', u'xyzzyhelloxyzzy', u'hello', 'xyz') test('lstrip', u'xyzzyhelloxyzzy', u'helloxyzzy', 'xyz') test('rstrip', u'xyzzyhelloxyzzy', u'xyzzyhello', 'xyz') test('strip', u'hello', u'hello', 'xyz') test('swapcase', u'HeLLo cOmpUteRs', u'hEllO CoMPuTErS') if 0: test('translate', u'xyzabcdef', u'xyzxyz', transtable, u'def') table = string.maketrans('a', u'A') test('translate', u'abc', u'Abc', table) test('translate', u'xyz', u'xyz', table) test('replace', u'one!two!three!', u'one@two!three!', u'!', u'@', 1) test('replace', u'one!two!three!', u'onetwothree', '!', '') test('replace', u'one!two!three!', u'one@two@three!', u'!', u'@', 2) test('replace', u'one!two!three!', u'one@two@three@', u'!', u'@', 3) test('replace', u'one!two!three!', u'one@two@three@', u'!', u'@', 4) test('replace', u'one!two!three!', u'one!two!three!', u'!', u'@', 0) test('replace', u'one!two!three!', u'one@two@three@', u'!', u'@') test('replace', u'one!two!three!', u'one!two!three!', u'x', u'@') test('replace', u'one!two!three!', u'one!two!three!', u'x', u'@', 2) test('replace', u'abc', u'-a-b-c-', u'', u'-') test('replace', u'abc', u'-a-b-c', u'', u'-', 3) test('replace', u'abc', u'abc', u'', u'-', 0) test('replace', u'abc', u'abc', u'ab', u'--', 0) test('replace', u'abc', u'abc', u'xy', u'--') test('replace', u'', u'', u'', u'') test('startswith', u'hello', True, u'he') test('startswith', u'hello', True, u'hello') test('startswith', u'hello', False, u'hello world') test('startswith', u'hello', True, u'') test('startswith', u'hello', False, u'ello') test('startswith', u'hello', True, u'ello', 1) test('startswith', u'hello', True, u'o', 4) test('startswith', u'hello', False, u'o', 5) test('startswith', u'hello', True, u'', 5) test('startswith', u'hello', False, u'lo', 6) test('startswith', u'helloworld', True, u'lowo', 3) test('startswith', u'helloworld', True, u'lowo', 3, 7) test('startswith', u'helloworld', False, u'lowo', 3, 6) test('endswith', u'hello', True, u'lo') test('endswith', u'hello', False, u'he') test('endswith', u'hello', True, u'') test('endswith', u'hello', False, u'hello world') test('endswith', u'helloworld', False, u'worl') test('endswith', u'helloworld', True, u'worl', 3, 9) test('endswith', u'helloworld', True, u'world', 3, 12) test('endswith', u'helloworld', True, u'lowo', 1, 7) test('endswith', u'helloworld', True, u'lowo', 2, 7) test('endswith', u'helloworld', True, u'lowo', 3, 7) test('endswith', u'helloworld', False, u'lowo', 4, 7) test('endswith', u'helloworld', False, u'lowo', 3, 8) test('endswith', u'ab', False, u'ab', 0, 1) test('endswith', u'ab', False, u'ab', 0, 0) test('endswith', 'helloworld', True, u'd') test('endswith', 'helloworld', False, u'l') test('expandtabs', u'abc\rab\tdef\ng\thi', u'abc\rab def\ng hi') test('expandtabs', u'abc\rab\tdef\ng\thi', u'abc\rab def\ng hi', 8) test('expandtabs', u'abc\rab\tdef\ng\thi', u'abc\rab def\ng hi', 4) test('expandtabs', u'abc\r\nab\tdef\ng\thi', u'abc\r\nab def\ng hi', 4) test('expandtabs', u'abc\r\nab\r\ndef\ng\r\nhi', u'abc\r\nab\r\ndef\ng\r\nhi', 4) if 0: test('capwords', u'abc def ghi', u'Abc Def Ghi') test('capwords', u'abc\tdef\nghi', u'Abc Def Ghi') test('capwords', u'abc\t def \nghi', u'Abc Def Ghi') test('zfill', u'123', u'123', 2) test('zfill', u'123', u'123', 3) test('zfill', u'123', u'0123', 4) test('zfill', u'+123', u'+123', 3) test('zfill', u'+123', u'+123', 4) test('zfill', u'+123', u'+0123', 5) test('zfill', u'-123', u'-123', 3) test('zfill', u'-123', u'-123', 4) test('zfill', u'-123', u'-0123', 5) test('zfill', u'', u'000', 3) test('zfill', u'34', u'34', 1) test('zfill', u'34', u'00034', 5) print 'Testing Unicode comparisons...', verify(u'abc' == 'abc') verify('abc' == u'abc') verify(u'abc' == u'abc') verify(u'abcd' > 'abc') verify('abcd' > u'abc') verify(u'abcd' > u'abc') verify(u'abc' < 'abcd') verify('abc' < u'abcd') verify(u'abc' < u'abcd') print 'done.' if 0: print 'Testing UTF-16 code point order comparisons...', verify(u'\u0061' < u'\u20ac') verify(u'\u0061' < u'\ud800\udc02') def test_lecmp(s, s2): verify(s < s2 , "comparison failed on %s < %s" % (s, s2)) def test_fixup(s): s2 = u'\ud800\udc01' test_lecmp(s, s2) s2 = u'\ud900\udc01' test_lecmp(s, s2) s2 = u'\uda00\udc01' test_lecmp(s, s2) s2 = u'\udb00\udc01' test_lecmp(s, s2) s2 = u'\ud800\udd01' test_lecmp(s, s2) s2 = u'\ud900\udd01' test_lecmp(s, s2) s2 = u'\uda00\udd01' test_lecmp(s, s2) s2 = u'\udb00\udd01' test_lecmp(s, s2) s2 = u'\ud800\ude01' test_lecmp(s, s2) s2 = u'\ud900\ude01' test_lecmp(s, s2) s2 = u'\uda00\ude01' test_lecmp(s, s2) s2 = u'\udb00\ude01' test_lecmp(s, s2) s2 = u'\ud800\udfff' test_lecmp(s, s2) s2 = u'\ud900\udfff' test_lecmp(s, s2) s2 = u'\uda00\udfff' test_lecmp(s, s2) s2 = u'\udb00\udfff' test_lecmp(s, s2) test_fixup(u'\ue000') test_fixup(u'\uff61') verify(u'\ud800\udc02' < u'\ud84d\udc56') print 'done.' test('ljust', u'abc', u'abc ', 10) test('rjust', u'abc', u' abc', 10) test('center', u'abc', u' abc ', 10) test('ljust', u'abc', u'abc ', 6) test('rjust', u'abc', u' abc', 6) test('center', u'abc', u' abc ', 6) test('ljust', u'abc', u'abc', 2) test('rjust', u'abc', u'abc', 2) test('center', u'abc', u'abc', 2) test('islower', u'a', True) test('islower', u'A', False) test('islower', u'\n', False) test('islower', u'\u1FFc', False) test('islower', u'abc', True) test('islower', u'aBc', False) test('islower', u'abc\n', True) test('isupper', u'a', False) test('isupper', u'A', True) test('isupper', u'\n', False) if sys.platform[:4] != 'java': test('isupper', u'\u1FFc', False) test('isupper', u'ABC', True) test('isupper', u'AbC', False) test('isupper', u'ABC\n', True) test('istitle', u'a', False) test('istitle', u'A', True) test('istitle', u'\n', False) test('istitle', u'\u1FFc', True) test('istitle', u'A Titlecased Line', True) test('istitle', u'A\nTitlecased Line', True) test('istitle', u'A Titlecased, Line', True) test('istitle', u'Greek \u1FFcitlecases ...', True) test('istitle', u'Not a capitalized String', False) test('istitle', u'Not\ta Titlecase String', False) test('istitle', u'Not--a Titlecase String', False) test('isalpha', u'a', True) test('isalpha', u'A', True) test('isalpha', u'\n', False) test('isalpha', u'\u1FFc', True) test('isalpha', u'abc', True) test('isalpha', u'aBc123', False) test('isalpha', u'abc\n', False) test('isalnum', u'a', True) test('isalnum', u'A', True) test('isalnum', u'\n', False) test('isalnum', u'123abc456', True) test('isalnum', u'a1b3c', True) test('isalnum', u'aBc000 ', False) test('isalnum', u'abc\n', False) test('splitlines', u"abc\ndef\n\rghi", [u'abc', u'def', u'', u'ghi']) test('splitlines', u"abc\ndef\n\r\nghi", [u'abc', u'def', u'', u'ghi']) test('splitlines', u"abc\ndef\r\nghi", [u'abc', u'def', u'ghi']) test('splitlines', u"abc\ndef\r\nghi\n", [u'abc', u'def', u'ghi']) test('splitlines', u"abc\ndef\r\nghi\n\r", [u'abc', u'def', u'ghi', u'']) test('splitlines', u"\nabc\ndef\r\nghi\n\r", [u'', u'abc', u'def', u'ghi', u'']) test('splitlines', u"\nabc\ndef\r\nghi\n\r", [u'\n', u'abc\n', u'def\r\n', u'ghi\n', u'\r'], True) test('translate', u"abababc", u'bbbc', {ord('a'):None}) test('translate', u"abababc", u'iiic', {ord('a'):None, ord('b'):ord('i')}) test('translate', u"abababc", u'iiix', {ord('a'):None, ord('b'):ord('i'), ord('c'):u'x'}) test('translate', u"abababc", u'<i><i><i>c', {ord('a'):None, ord('b'):u'<i>'}) test('translate', u"abababc", u'c', {ord('a'):None, ord('b'):u''}) print 'Testing Unicode contains method...', vereq(('a' in u'abdb'), True) vereq(('a' in u'bdab'), True) vereq(('a' in u'bdaba'), True) vereq(('a' in u'bdba'), True) vereq(('a' in u'bdba'), True) vereq((u'a' in u'bdba'), True) vereq((u'a' in u'bdb'), False) vereq((u'a' in 'bdb'), False) vereq((u'a' in 'bdba'), True) vereq((u'a' in ('a',1,None)), True) vereq((u'a' in (1,None,'a')), True) vereq((u'a' in (1,None,u'a')), True) vereq(('a' in ('a',1,None)), True) vereq(('a' in (1,None,'a')), True) vereq(('a' in (1,None,u'a')), True) vereq(('a' in ('x',1,u'y')), False) vereq(('a' in ('x',1,None)), False) vereq(u'abcd' in u'abcxxxx', False) vereq((u'ab' in u'abcd'), True) vereq(('ab' in u'abc'), True) vereq((u'ab' in 'abc'), True) vereq((u'ab' in (1,None,u'ab')), True) vereq((u'' in u'abc'), True) vereq(('' in u'abc'), True) try: u'\xe2' in 'g\xe2teau' except UnicodeError: pass else: print '*** contains operator does not propagate UnicodeErrors' print 'done.' print 'Testing Unicode formatting strings...', verify(u"%s, %s" % (u"abc", "abc") == u'abc, abc') verify(u"%s, %s, %i, %f, %5.2f" % (u"abc", "abc", 1, 2, 3) == u'abc, abc, 1, 2.000000, 3.00') verify(u"%s, %s, %i, %f, %5.2f" % (u"abc", "abc", 1, -2, 3) == u'abc, abc, 1, -2.000000, 3.00') verify(u"%s, %s, %i, %f, %5.2f" % (u"abc", "abc", -1, -2, 3.5) == u'abc, abc, -1, -2.000000, 3.50') verify(u"%s, %s, %i, %f, %5.2f" % (u"abc", "abc", -1, -2, 3.57) == u'abc, abc, -1, -2.000000, 3.57') verify(u"%s, %s, %i, %f, %5.2f" % (u"abc", "abc", -1, -2, 1003.57) == u'abc, abc, -1, -2.000000, 1003.57') verify(u"%c" % (u"a",) == u'a') verify(u"%c" % ("a",) == u'a') verify(u"%c" % (34,) == u'"') verify(u"%c" % (36,) == u'$') verify(u"%d".__mod__(10) == u'10') if sys.platform[:4] != 'java': value = u"%r, %r" % (u"abc", "abc") if value != u"u'abc', 'abc'": print '*** formatting failed for "%s"' % 'u"%r, %r" % (u"abc", "abc")' verify(u"%(x)s, %(y)s" % {'x':u"abc", 'y':"def"} == u'abc, def') try: value = u"%(x)s, %()s" % {'x':u"abc", u'':"def"} except KeyError: print '*** formatting failed for "%s"' % "u'abc, def'" else: verify(value == u'abc, def') for ordinal in (-100, 0x200000): try: u"%c" % ordinal except ValueError: pass else: print '*** formatting u"%%c" %% %i should give a ValueError' % ordinal for prec in range(100): formatstring = u'%%.%if' % prec value = 0.01 for x in range(60): value = value * 3.141592655 / 3.0 * 10.0 try: result = formatstring % value except OverflowError: if x >= 50 or \ prec < 67: print '*** unexpected OverflowError for x=%i and prec=%i' % (x, prec)
f = getattr(input, method) value = f(*args) self.assertEqual(output, value) self.assert_(input is not value) def test_capitalize(self): self.checkmethod('capitalize', u' hello ', u' hello ') self.checkmethod('capitalize', u'Hello ', u'Hello ') self.checkmethod('capitalize', u'hello ', u'Hello ') self.checkmethod('capitalize', u'aaaa', u'Aaaa') self.checkmethod('capitalize', u'AaAa', u'Aaaa') self.assertRaises(TypeError, u'hello'.capitalize, 42) def test_count(self): self.checkmethod('count', u'aaa', 3, u'a') self.checkmethod('count', u'aaa', 0, u'b') self.checkmethod('count', 'aaa', 3, u'a') self.checkmethod('count', 'aaa', 0, u'b') self.checkmethod('count', u'aaa', 3, 'a') self.checkmethod('count', u'aaa', 0, 'b') self.assertRaises(TypeError, u'hello'.count) def test_title(self): self.checkmethod('title', u' hello ', u' Hello ') self.checkmethod('title', u'Hello ', u'Hello ') self.checkmethod('title', u'hello ', u'Hello ') self.checkmethod('title', u"fOrMaT thIs aS titLe String", u'Format This As Title String') self.checkmethod('title', u"fOrMaT,thIs-aS*titLe;String", u'Format,This-As*Title;String') self.checkmethod('title', u"getInt", u'Getint') self.assertRaises(TypeError, u'hello'.count, 42) def test_find(self): self.checkmethod('find', u'abcdefghiabc', 0, u'abc') self.checkmethod('find', u'abcdefghiabc', 9, u'abc', 1) self.checkmethod('find', u'abcdefghiabc', -1, u'def', 4) self.assertRaises(TypeError, u'hello'.find) self.assertRaises(TypeError, u'hello'.find, 42) def test_rfind(self): self.checkmethod('rfind', u'abcdefghiabc', 9, u'abc') self.checkmethod('rfind', 'abcdefghiabc', 9, u'abc') self.checkmethod('rfind', 'abcdefghiabc', 12, u'') self.checkmethod('rfind', u'abcdefghiabc', 12, '') self.checkmethod('rfind', u'abcdefghiabc', 12, u'') self.assertRaises(TypeError, u'hello'.rfind) self.assertRaises(TypeError, u'hello'.rfind, 42) def test_index(self): self.checkmethod('index', u'abcdefghiabc', 0, u'') self.checkmethod('index', u'abcdefghiabc', 3, u'def') self.checkmethod('index', u'abcdefghiabc', 0, u'abc') self.checkmethod('index', u'abcdefghiabc', 9, u'abc', 1) self.assertRaises(ValueError, u'abcdefghiabc'.index, u'hib') self.assertRaises(ValueError, u'abcdefghiab'.index, u'abc', 1) self.assertRaises(ValueError, u'abcdefghi'.index, u'ghi', 8) self.assertRaises(ValueError, u'abcdefghi'.index, u'ghi', -1) self.assertRaises(TypeError, u'hello'.index) self.assertRaises(TypeError, u'hello'.index, 42) def test_rindex(self): self.checkmethod('rindex', u'abcdefghiabc', 12, u'') self.checkmethod('rindex', u'abcdefghiabc', 3, u'def') self.checkmethod('rindex', u'abcdefghiabc', 9, u'abc') self.checkmethod('rindex', u'abcdefghiabc', 0, u'abc', 0, -1) self.assertRaises(ValueError, u'abcdefghiabc'.rindex, u'hib') self.assertRaises(ValueError, u'defghiabc'.rindex, u'def', 1) self.assertRaises(ValueError, u'defghiabc'.rindex, u'abc', 0, -1) self.assertRaises(ValueError, u'abcdefghi'.rindex, u'ghi', 0, 8) self.assertRaises(ValueError, u'abcdefghi'.rindex, u'ghi', 0, -1) self.assertRaises(TypeError, u'hello'.rindex) self.assertRaises(TypeError, u'hello'.rindex, 42) def test_lower(self): self.checkmethod('lower', u'HeLLo', u'hello') self.checkmethod('lower', u'hello', u'hello') self.assertRaises(TypeError, u"hello".lower, 42) def test_upper(self): self.checkmethod('upper', u'HeLLo', u'HELLO') self.checkmethod('upper', u'HELLO', u'HELLO') self.assertRaises(TypeError, u'hello'.upper, 42) def test_translate(self): if 0: transtable = '\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037 !" self.checkmethod('maketrans', u'abc', transtable, u'xyz') self.checkmethod('maketrans', u'abc', ValueError, u'xyzq') self.checkmethod('translate', u'xyzabcdef', u'xyzxyz', transtable, u'def') table = string.maketrans('a', u'A') self.checkmethod('translate', u'abc', u'Abc', table) self.checkmethod('translate', u'xyz', u'xyz', table) self.checkmethod('translate', u"abababc", u'bbbc', {ord('a'):None}) self.checkmethod('translate', u"abababc", u'iiic', {ord('a'):None, ord('b'):ord('i')}) self.checkmethod('translate', u"abababc", u'iiix', {ord('a'):None, ord('b'):ord('i'), ord('c'):u'x'}) self.checkmethod('translate', u"abababc", u'<i><i><i>c', {ord('a'):None, ord('b'):u'<i>'}) self.checkmethod('translate', u"abababc", u'c', {ord('a'):None, ord('b'):u''}) self.assertRaises(TypeError, u'hello'.translate) def test_split(self): self.checkmethod( 'split', u'this is the split function', [u'this', u'is', u'the', u'split', u'function'] ) self.checkmethod('split', u'a|b|c|d', [u'a', u'b', u'c', u'd'], u'|') self.checkmethod('split', u'a|b|c|d', [u'a', u'b', u'c|d'], u'|', 2) self.checkmethod('split', u'a b c d', [u'a', u'b c d'], None, 1) self.checkmethod('split', u'a b c d', [u'a', u'b', u'c d'], None, 2) self.checkmethod('split', u'a b c d', [u'a', u'b', u'c', u'd'], None, 3) self.checkmethod('split', u'a b c d', [u'a', u'b', u'c', u'd'], None, 4) self.checkmethod('split', u'a b c d', [u'a b c d'], None, 0) self.checkmethod('split', u'a b c d', [u'a', u'b', u'c d'], None, 2) self.checkmethod('split', u'a b c d ', [u'a', u'b', u'c', u'd']) self.checkmethod('split', u'a//b//c//d', [u'a', u'b', u'c', u'd'], u'//') self.checkmethod('split', u'a//b//c//d', [u'a', u'b', u'c', u'd'], '//') self.checkmethod('split', 'a//b//c//d', [u'a', u'b', u'c', u'd'], u'//') self.checkmethod('split', u'endcase test', [u'endcase ', u''], u'test') self.checkmethod('split', u'endcase test', [u'endcase ', u''], 'test') self.checkmethod('split', 'endcase test', [u'endcase ', u''], u'test') self.assertRaises(TypeError, u"hello".split, 42, 42, 42) def test_join(self): class Sequence: def __init__(self, seq): self.seq = seq def __len__(self): return len(self.seq) def __getitem__(self, i): return self.seq[i] self.checkmethod('join', u' ', u'a b c d', [u'a', u'b', u'c', u'd']) self.checkmethod('join', u' ', u'a b c d', ['a', 'b', u'c', u'd']) self.checkmethod('join', u'', u'abcd', (u'a', u'b', u'c', u'd')) self.checkmethod('join', u' ', u'w x y z', Sequence('wxyz')) self.assertRaises(TypeError, u' '.join, 7) self.assertRaises(TypeError, u' '.join, Sequence([7, u'hello', 123L])) self.checkmethod('join', ' ', u'a b c d', [u'a', u'b', u'c', u'd']) self.checkmethod('join', ' ', u'a b c d', ['a', 'b', u'c', u'd']) self.checkmethod('join', '', u'abcd', (u'a', u'b', u'c', u'd')) self.checkmethod('join', ' ', u'w x y z', Sequence(u'wxyz')) self.assertRaises(TypeError, ' '.join, TypeError) result = u'' for i in range(10): if i > 0: result = result + u':' result = result + u'x'*10 self.checkmethod('join', u':', result, [u'x' * 10] * 10) self.checkmethod('join', u':', result, (u'x' * 10,) * 10) self.assertRaises(TypeError, u"hello".join) def test_strip(self): self.checkmethod('strip', u' hello ', u'hello') self.checkmethod('lstrip', u' hello ', u'hello ') self.checkmethod('rstrip', u' hello ', u' hello') self.checkmethod('strip', u'hello', u'hello') self.checkmethod('strip', u' hello ', u'hello', None) self.checkmethod('lstrip', u' hello ', u'hello ', None) self.checkmethod('rstrip', u' hello ', u' hello', None) self.checkmethod('strip', u'hello', u'hello', None) self.checkmethod('strip', u'xyzzyhelloxyzzy', u'hello', u'xyz') self.checkmethod('lstrip', u'xyzzyhelloxyzzy', u'helloxyzzy', u'xyz') self.checkmethod('rstrip', u'xyzzyhelloxyzzy', u'xyzzyhello', u'xyz') self.checkmethod('strip', u'hello', u'hello', u'xyz') self.checkmethod('strip', u'xyzzyhelloxyzzy', u'hello', 'xyz') self.checkmethod('lstrip', u'xyzzyhelloxyzzy', u'helloxyzzy', 'xyz') self.checkmethod('rstrip', u'xyzzyhelloxyzzy', u'xyzzyhello', 'xyz') self.checkmethod('strip', u'hello', u'hello', 'xyz') self.assertRaises(TypeError, u"hello".strip, 42, 42) self.assertRaises(UnicodeError, u"hello".strip, "\xff") def test_swapcase(self): self.checkmethod('swapcase', u'HeLLo cOmpUteRs', u'hEllO CoMPuTErS') self.assertRaises(TypeError, u"hello".swapcase, 42) def test_replace(self): self.checkmethod('replace', u'one!two!three!', u'one@two!three!', u'!', u'@', 1) self.checkmethod('replace', u'one!two!three!', u'onetwothree', '!', '') self.checkmethod('replace', u'one!two!three!', u'one@two@three!', u'!', u'@', 2) self.checkmethod('replace', u'one!two!three!', u'one@two@three@', u'!', u'@', 3) self.checkmethod('replace', u'one!two!three!', u'one@two@three@', u'!', u'@', 4) self.checkmethod('replace', u'one!two!three!', u'one!two!three!', u'!', u'@', 0) self.checkmethod('replace', u'one!two!three!', u'one@two@three@', u'!', u'@') self.checkmethod('replace', u'one!two!three!', u'one!two!three!', u'x', u'@') self.checkmethod('replace', u'one!two!three!', u'one!two!three!', u'x', u'@', 2) self.checkmethod('replace', u'abc', u'-a-b-c-', u'', u'-') self.checkmethod('replace', u'abc', u'-a-b-c', u'', u'-', 3) self.checkmethod('replace', u'abc', u'abc', u'', u'-', 0) self.checkmethod('replace', u'abc', u'abc', u'ab', u'--', 0) self.checkmethod('replace', u'abc', u'abc', u'xy', u'--') self.checkmethod('replace', u'', u'', u'', u'') self.checkmethod('replace', 'one!two!three!', u'one@two!three!', u'!', u'@', 1) self.assertRaises(TypeError, 'replace'.replace, 42) self.assertRaises(TypeError, 'replace'.replace, u"r", 42) self.assertRaises(TypeError, u"hello".replace) self.assertRaises(TypeError, u"hello".replace, 42, u"h") self.assertRaises(TypeError, u"hello".replace, u"h", 42) def test_startswith(self): self.checkmethod('startswith', u'hello', True, u'he') self.checkmethod('startswith', u'hello', True, u'hello') self.checkmethod('startswith', u'hello', False, u'hello world') self.checkmethod('startswith', u'hello', True, u'') self.checkmethod('startswith', u'hello', False, u'ello') self.checkmethod('startswith', u'hello', True, u'ello', 1) self.checkmethod('startswith', u'hello', True, u'o', 4) self.checkmethod('startswith', u'hello', False, u'o', 5) self.checkmethod('startswith', u'hello', True, u'', 5) self.checkmethod('startswith', u'hello', False, u'lo', 6) self.checkmethod('startswith', u'helloworld', True, u'lowo', 3) self.checkmethod('startswith', u'helloworld', True, u'lowo', 3, 7) self.checkmethod('startswith', u'helloworld', False, u'lowo', 3, 6) self.assertRaises(TypeError, u"hello".startswith) self.assertRaises(TypeError, u"hello".startswith, 42) def test_endswith(self): self.checkmethod('endswith', u'hello', True, u'lo') self.checkmethod('endswith', u'hello', False, u'he') self.checkmethod('endswith', u'hello', True, u'') self.checkmethod('endswith', u'hello', False, u'hello world') self.checkmethod('endswith', u'helloworld', False, u'worl') self.checkmethod('endswith', u'helloworld', True, u'worl', 3, 9) self.checkmethod('endswith', u'helloworld', True, u'world', 3, 12) self.checkmethod('endswith', u'helloworld', True, u'lowo', 1, 7) self.checkmethod('endswith', u'helloworld', True, u'lowo', 2, 7) self.checkmethod('endswith', u'helloworld', True, u'lowo', 3, 7) self.checkmethod('endswith', u'helloworld', False, u'lowo', 4, 7) self.checkmethod('endswith', u'helloworld', False, u'lowo', 3, 8) self.checkmethod('endswith', u'ab', False, u'ab', 0, 1) self.checkmethod('endswith', u'ab', False, u'ab', 0, 0) self.checkmethod('endswith', 'helloworld', True, u'd') self.checkmethod('endswith', 'helloworld', False, u'l') self.assertRaises(TypeError, u"hello".endswith) self.assertRaises(TypeError, u"hello".endswith, 42) def test_expandtabs(self): self.checkmethod('expandtabs', u'abc\rab\tdef\ng\thi', u'abc\rab def\ng hi') self.checkmethod('expandtabs', u'abc\rab\tdef\ng\thi', u'abc\rab def\ng hi', 8) self.checkmethod('expandtabs', u'abc\rab\tdef\ng\thi', u'abc\rab def\ng hi', 4) self.checkmethod('expandtabs', u'abc\r\nab\tdef\ng\thi', u'abc\r\nab def\ng hi', 4) self.checkmethod('expandtabs', u'abc\r\nab\r\ndef\ng\r\nhi', u'abc\r\nab\r\ndef\ng\r\nhi', 4) self.assertRaises(TypeError, u"hello".expandtabs, 42, 42) def test_capwords(self): if 0: self.checkmethod('capwords', u'abc def ghi', u'Abc Def Ghi') self.checkmethod('capwords', u'abc\tdef\nghi', u'Abc Def Ghi') self.checkmethod('capwords', u'abc\t def \nghi', u'Abc Def Ghi') def test_zfill(self): self.checkmethod('zfill', u'123', u'123', 2) self.checkmethod('zfill', u'123', u'123', 3) self.checkmethod('zfill', u'123', u'0123', 4) self.checkmethod('zfill', u'+123', u'+123', 3) self.checkmethod('zfill', u'+123', u'+123', 4) self.checkmethod('zfill', u'+123', u'+0123', 5) self.checkmethod('zfill', u'-123', u'-123', 3) self.checkmethod('zfill', u'-123', u'-123', 4) self.checkmethod('zfill', u'-123', u'-0123', 5) self.checkmethod('zfill', u'', u'000', 3) self.checkmethod('zfill', u'34', u'34', 1) self.checkmethod('zfill', u'34', u'00034', 5) self.assertRaises(TypeError, u"123".zfill) def test_comparison(self): self.assertEqual(u'abc', 'abc') self.assertEqual('abc', u'abc') self.assertEqual(u'abc', u'abc') self.assert_(u'abcd' > 'abc') self.assert_('abcd' > u'abc') self.assert_(u'abcd' > u'abc') self.assert_(u'abc' < 'abcd') self.assert_('abc' < u'abcd') self.assert_(u'abc' < u'abcd') if 0: self.assert_(u'\u0061' < u'\u20ac') self.assert_(u'\u0061' < u'\ud800\udc02') def test_lecmp(s, s2): self.assert_(s < s2) def test_fixup(s): s2 = u'\ud800\udc01' test_lecmp(s, s2) s2 = u'\ud900\udc01' test_lecmp(s, s2) s2 = u'\uda00\udc01' test_lecmp(s, s2) s2 = u'\udb00\udc01' test_lecmp(s, s2) s2 = u'\ud800\udd01' test_lecmp(s, s2) s2 = u'\ud900\udd01' test_lecmp(s, s2) s2 = u'\uda00\udd01' test_lecmp(s, s2) s2 = u'\udb00\udd01' test_lecmp(s, s2) s2 = u'\ud800\ude01' test_lecmp(s, s2) s2 = u'\ud900\ude01' test_lecmp(s, s2) s2 = u'\uda00\ude01' test_lecmp(s, s2) s2 = u'\udb00\ude01' test_lecmp(s, s2) s2 = u'\ud800\udfff' test_lecmp(s, s2) s2 = u'\ud900\udfff' test_lecmp(s, s2) s2 = u'\uda00\udfff' test_lecmp(s, s2) s2 = u'\udb00\udfff' test_lecmp(s, s2) test_fixup(u'\ue000') test_fixup(u'\uff61') self.assert_(u'\ud800\udc02' < u'\ud84d\udc56') def test_ljust(self): self.checkmethod('ljust', u'abc', u'abc ', 10) self.checkmethod('ljust', u'abc', u'abc ', 6) self.checkmethod('ljust', u'abc', u'abc', 2) self.assertRaises(TypeError, u"abc".ljust) def test_rjust(self): self.checkmethod('rjust', u'abc', u' abc', 10) self.checkmethod('rjust', u'abc', u' abc', 6) self.checkmethod('rjust', u'abc', u'abc', 2) self.assertRaises(TypeError, u"abc".rjust) def test_center(self): self.checkmethod('center', u'abc', u' abc ', 10) self.checkmethod('center', u'abc', u' abc ', 6) self.checkmethod('center', u'abc', u'abc', 2) self.assertRaises(TypeError, u"abc".center) def test_islower(self): self.checkmethod('islower', u'', False) self.checkmethod('islower', u'a', True) self.checkmethod('islower', u'A', False) self.checkmethod('islower', u'\n', False) self.checkmethod('islower', u'\u1FFc', False) self.checkmethod('islower', u'abc', True) self.checkmethod('islower', u'aBc', False) self.checkmethod('islower', u'abc\n', True) self.assertRaises(TypeError, u"abc".islower, 42) def test_isupper(self): self.checkmethod('isupper', u'', False) self.checkmethod('isupper', u'a', False) self.checkmethod('isupper', u'A', True) self.checkmethod('isupper', u'\n', False) if sys.platform[:4] != 'java': self.checkmethod('isupper', u'\u1FFc', False) self.checkmethod('isupper', u'ABC', True) self.checkmethod('isupper', u'AbC', False) self.checkmethod('isupper', u'ABC\n', True) self.assertRaises(TypeError, u"abc".isupper, 42) def test_istitle(self): self.checkmethod('istitle', u'', False) self.checkmethod('istitle', u'a', False) self.checkmethod('istitle', u'A', True) self.checkmethod('istitle', u'\n', False) self.checkmethod('istitle', u'\u1FFc', True) self.checkmethod('istitle', u'A Titlecased Line', True) self.checkmethod('istitle', u'A\nTitlecased Line', True) self.checkmethod('istitle', u'A Titlecased, Line', True) self.checkmethod('istitle', u'Greek \u1FFcitlecases ...', True) self.checkmethod('istitle', u'Not a capitalized String', False) self.checkmethod('istitle', u'Not\ta Titlecase String', False) self.checkmethod('istitle', u'Not--a Titlecase String', False) self.checkmethod('istitle', u'NOT', False) self.assertRaises(TypeError, u"abc".istitle, 42) def test_isspace(self): self.checkmethod('isspace', u'', False) self.checkmethod('isspace', u'a', False) self.checkmethod('isspace', u' ', True) self.checkmethod('isspace', u'\t', True) self.checkmethod('isspace', u'\r', True) self.checkmethod('isspace', u'\n', True) self.checkmethod('isspace', u' \t\r\n', True) self.checkmethod('isspace', u' \t\r\na', False) self.assertRaises(TypeError, u"abc".isspace, 42) def test_isalpha(self): self.checkmethod('isalpha', u'', False) self.checkmethod('isalpha', u'a', True) self.checkmethod('isalpha', u'A', True) self.checkmethod('isalpha', u'\n', False) self.checkmethod('isalpha', u'\u1FFc', True) self.checkmethod('isalpha', u'abc', True) self.checkmethod('isalpha', u'aBc123', False) self.checkmethod('isalpha', u'abc\n', False) self.assertRaises(TypeError, u"abc".isalpha, 42) def test_isalnum(self): self.checkmethod('isalnum', u'', False) self.checkmethod('isalnum', u'a', True) self.checkmethod('isalnum', u'A', True) self.checkmethod('isalnum', u'\n', False) self.checkmethod('isalnum', u'123abc456', True) self.checkmethod('isalnum', u'a1b3c', True) self.checkmethod('isalnum', u'aBc000 ', False) self.checkmethod('isalnum', u'abc\n', False) self.assertRaises(TypeError, u"abc".isalnum, 42) def test_isdecimal(self): self.checkmethod('isdecimal', u'', False) self.checkmethod('isdecimal', u'a', False) self.checkmethod('isdecimal', u'0', True) self.checkmethod('isdecimal', u'\u2460', False) self.checkmethod('isdecimal', u'\xbc', False) self.checkmethod('isdecimal', u'\u0660', True) self.checkmethod('isdecimal', u'0123456789', True) self.checkmethod('isdecimal', u'0123456789a', False) self.assertRaises(TypeError, u"abc".isdecimal, 42) def test_isdigit(self): self.checkmethod('isdigit', u'', False) self.checkmethod('isdigit', u'a', False) self.checkmethod('isdigit', u'0', True) self.checkmethod('isdigit', u'\u2460', True) self.checkmethod('isdigit', u'\xbc', False) self.checkmethod('isdigit', u'\u0660', True) self.checkmethod('isdigit', u'0123456789', True) self.checkmethod('isdigit', u'0123456789a', False) self.assertRaises(TypeError, u"abc".isdigit, 42) def test_isnumeric(self): self.checkmethod('isnumeric', u'', False) self.checkmethod('isnumeric', u'a', False) self.checkmethod('isnumeric', u'0', True) self.checkmethod('isnumeric', u'\u2460', True) self.checkmethod('isnumeric', u'\xbc', True) self.checkmethod('isnumeric', u'\u0660', True) self.checkmethod('isnumeric', u'0123456789', True) self.checkmethod('isnumeric', u'0123456789a', False) self.assertRaises(TypeError, u"abc".isnumeric, 42) def test_splitlines(self): self.checkmethod('splitlines', u"abc\ndef\n\rghi", [u'abc', u'def', u'', u'ghi']) self.checkmethod('splitlines', u"abc\ndef\n\r\nghi", [u'abc', u'def', u'', u'ghi']) self.checkmethod('splitlines', u"abc\ndef\r\nghi", [u'abc', u'def', u'ghi']) self.checkmethod('splitlines', u"abc\ndef\r\nghi\n", [u'abc', u'def', u'ghi']) self.checkmethod('splitlines', u"abc\ndef\r\nghi\n\r", [u'abc', u'def', u'ghi', u'']) self.checkmethod('splitlines', u"\nabc\ndef\r\nghi\n\r", [u'', u'abc', u'def', u'ghi', u'']) self.checkmethod('splitlines', u"\nabc\ndef\r\nghi\n\r", [u'\n', u'abc\n', u'def\r\n', u'ghi\n', u'\r'], True) self.assertRaises(TypeError, u"abc".splitlines, 42, 42) def test_contains(self): self.assert_('a' in u'abdb') self.assert_('a' in u'bdab') self.assert_('a' in u'bdaba') self.assert_('a' in u'bdba') self.assert_('a' in u'bdba') self.assert_(u'a' in u'bdba') self.assert_(u'a' not in u'bdb') self.assert_(u'a' not in 'bdb') self.assert_(u'a' in 'bdba') self.assert_(u'a' in ('a',1,None)) self.assert_(u'a' in (1,None,'a')) self.assert_(u'a' in (1,None,u'a')) self.assert_('a' in ('a',1,None)) self.assert_('a' in (1,None,'a')) self.assert_('a' in (1,None,u'a')) self.assert_('a' not in ('x',1,u'y')) self.assert_('a' not in ('x',1,None)) self.assert_(u'abcd' not in u'abcxxxx') self.assert_(u'ab' in u'abcd') self.assert_('ab' in u'abc') self.assert_(u'ab' in 'abc') self.assert_(u'ab' in (1,None,u'ab')) self.assert_(u'' in u'abc') self.assert_('' in u'abc') self.assertRaises(UnicodeError, 'g\xe2teau'.__contains__, u'\xe2') self.assert_(u'' in '') self.assert_('' in u'') self.assert_(u'' in u'') self.assert_(u'' in 'abc') self.assert_('' in u'abc') self.assert_(u'' in u'abc') self.assert_(u'\0' not in 'abc') self.assert_('\0' not in u'abc') self.assert_(u'\0' not in u'abc') self.assert_(u'\0' in '\0abc') self.assert_('\0' in u'\0abc') self.assert_(u'\0' in u'\0abc') self.assert_(u'\0' in 'abc\0') self.assert_('\0' in u'abc\0') self.assert_(u'\0' in u'abc\0') self.assert_(u'a' in '\0abc') self.assert_('a' in u'\0abc') self.assert_(u'a' in u'\0abc') self.assert_(u'asdf' in 'asdf') self.assert_('asdf' in u'asdf') self.assert_(u'asdf' in u'asdf') self.assert_(u'asdf' not in 'asd') self.assert_('asdf' not in u'asd') self.assert_(u'asdf' not in u'asd') self.assert_(u'asdf' not in '') self.assert_('asdf' not in u'') self.assert_(u'asdf' not in u'') self.assertRaises(TypeError, u"abc".__contains__) def test_formatting(self): self.assertEqual(u"%s, %s" % (u"abc", "abc"), u'abc, abc') self.assertEqual(u"%s, %s, %i, %f, %5.2f" % (u"abc", "abc", 1, 2, 3), u'abc, abc, 1, 2.000000, 3.00') self.assertEqual(u"%s, %s, %i, %f, %5.2f" % (u"abc", "abc", 1, -2, 3), u'abc, abc, 1, -2.000000, 3.00') self.assertEqual(u"%s, %s, %i, %f, %5.2f" % (u"abc", "abc", -1, -2, 3.5), u'abc, abc, -1, -2.000000, 3.50') self.assertEqual(u"%s, %s, %i, %f, %5.2f" % (u"abc", "abc", -1, -2, 3.57), u'abc, abc, -1, -2.000000, 3.57') self.assertEqual(u"%s, %s, %i, %f, %5.2f" % (u"abc", "abc", -1, -2, 1003.57), u'abc, abc, -1, -2.000000, 1003.57') self.assertEqual(u"%c" % (u"a",), u'a') self.assertEqual(u"%c" % ("a",), u'a') self.assertEqual(u"%c" % (34,), u'"') self.assertEqual(u"%c" % (36,), u'$') self.assertEqual(u"%d".__mod__(10), u'10') if not sys.platform.startswith('java'): self.assertEqual(u"%r, %r" % (u"abc", "abc"), u"u'abc', 'abc'") self.assertEqual(u"%(x)s, %(y)s" % {'x':u"abc", 'y':"def"}, u'abc, def') self.assertEqual(u"%(x)s, %()s" % {'x':u"abc", u'':"def"}, u'abc, def') for ordinal in (-100, 0x200000): self.assertRaises(ValueError, u"%c".__mod__, ordinal) for prec in xrange(100): format = u'%%.%if' % prec value = 0.01 for x in xrange(60): value = value * 3.141592655 / 3.0 * 10.0 if x < 50 and prec >= 67: self.assertRaises(OverflowError, format.__mod__, value) else: format % value self.assertEqual('...%(foo)s...' % {'foo':u"abc"}, u'...abc...') self.assertEqual('...%(foo)s...' % {'foo':"abc"}, '...abc...') self.assertEqual('...%(foo)s...' % {u'foo':"abc"}, '...abc...') self.assertEqual('...%(foo)s...' % {u'foo':u"abc"}, u'...abc...') self.assertEqual('...%(foo)s...' % {u'foo':u"abc",'def':123}, u'...abc...') self.assertEqual('...%(foo)s...' % {u'foo':u"abc",u'def':123}, u'...abc...') self.assertEqual('...%s...%s...%s...%s...' % (1,2,3,u"abc"), u'...1...2...3...abc...') self.assertEqual('...%%...%%s...%s...%s...%s...%s...' % (1,2,3,u"abc"), u'...%...%s...1...2...3...abc...') self.assertEqual('...%s...' % u"abc", u'...abc...') self.assertEqual('%*s' % (5,u'abc',), u' abc') self.assertEqual('%*s' % (-5,u'abc',), u'abc ') self.assertEqual('%*.*s' % (5,2,u'abc',), u' ab') self.assertEqual('%*.*s' % (5,3,u'abc',), u' abc') self.assertEqual('%i %*.*s' % (10, 5,3,u'abc',), u'10 abc') self.assertEqual('%i%s %*.*s' % (10, 3, 5,3,u'abc',), u'103 abc') self.assertEqual(u'%3ld' % 42, u' 42') self.assertEqual(u'%07.2f' % 42, u'0042.00') self.assertRaises(TypeError, u"abc".__mod__) self.assertRaises(TypeError, u"%(foo)s".__mod__, 42) self.assertRaises(TypeError, u"%s%s".__mod__, (42,)) self.assertRaises(TypeError, u"%c".__mod__, (None,)) self.assertRaises(ValueError, u"%c".__mod__, (sys.maxunicode+1,)) self.assertRaises(ValueError, u"%(foo".__mod__, {}) self.assertRaises(TypeError, u"%(foo)s %(bar)s".__mod__, (u"foo", 42)) self.assertEqual(u"%((foo))s" % {u"(foo)": u"bar"}, u"bar") self.assertEqual(u"%sx" % (103*u"a"), 103*u"a"+u"x") self.assertRaises(TypeError, u"%*s".__mod__, (u"foo", u"bar")) self.assertRaises(TypeError, u"%10.*f".__mod__, (u"foo", 42.)) self.assertRaises(ValueError, u"%10".__mod__, (42,)) def test_constructor(self): self.assertEqual( unicode(u'unicode remains unicode'), u'unicode remains unicode' ) class UnicodeSubclass(unicode): pass self.assertEqual( unicode(UnicodeSubclass('unicode subclass becomes unicode')), u'unicode subclass becomes unicode' ) self.assertEqual( unicode('strings are converted to unicode'), u'strings are converted to unicode' ) class UnicodeCompat: def __init__(self, x): self.x = x def __unicode__(self): return self.x self.assertEqual( unicode(UnicodeCompat('__unicode__ compatible objects are recognized')), u'__unicode__ compatible objects are recognized') class StringCompat: def __init__(self, x): self.x = x def __str__(self): return self.x self.assertEqual( unicode(StringCompat('__str__ compatible objects are recognized')), u'__str__ compatible objects are recognized' ) o = StringCompat('unicode(obj) is compatible to str()') self.assertEqual(unicode(o), u'unicode(obj) is compatible to str()') self.assertEqual(str(o), 'unicode(obj) is compatible to str()') for obj in (123, 123.45, 123L): self.assertEqual(unicode(obj), unicode(str(obj))) if not sys.platform.startswith('java'): self.assertRaises( TypeError, unicode, u'decoding unicode is not supported', 'utf-8', 'strict' ) self.assertEqual( unicode('strings are decoded to unicode', 'utf-8', 'strict'), u'strings are decoded to unicode' ) if not sys.platform.startswith('java'): self.assertEqual( unicode( buffer('character buffers are decoded to unicode'), 'utf-8', 'strict' ), u'character buffers are decoded to unicode' ) self.assertRaises(TypeError, unicode, 42, 42, 42) def test_codecs_utf7(self): utfTests = [ (u'A\u2262\u0391.', 'A+ImIDkQ.'), (u'Hi Mom -\u263a-!', 'Hi Mom -+Jjo--!'), (u'\u65E5\u672C\u8A9E', '+ZeVnLIqe-'), (u'Item 3 is \u00a31.', 'Item 3 is +AKM-1.'), (u'+', '+-'), (u'+-', '+--'), (u'+?', '+-?'), (u'\?', '+AFw?'), (u'+?', '+-?'), (ur'\\?', '+AFwAXA?'), (ur'\\\?', '+AFwAXABc?'), (ur'++--', '+-+---') ] for (x, y) in utfTests: self.assertEqual(x.encode('utf-7'), y) self.assertRaises(UnicodeError, unicode, '+3ADYAA-', 'utf-7') self.assertEqual(unicode('+3ADYAA-', 'utf-7', 'replace'), u'\ufffd') def test_codecs_utf8(self): self.assertEqual(u''.encode('utf-8'), '') self.assertEqual(u'\u20ac'.encode('utf-8'), '\xe2\x82\xac') self.assertEqual(u'\ud800\udc02'.encode('utf-8'), '\xf0\x90\x80\x82') self.assertEqual(u'\ud84d\udc56'.encode('utf-8'), '\xf0\xa3\x91\x96') self.assertEqual(u'\ud800'.encode('utf-8'), '\xed\xa0\x80') self.assertEqual(u'\udc00'.encode('utf-8'), '\xed\xb0\x80') self.assertEqual( (u'\ud800\udc02'*1000).encode('utf-8'), '\xf0\x90\x80\x82'*1000 ) self.assertEqual( u'\u6b63\u78ba\u306b\u8a00\u3046\u3068\u7ffb\u8a33\u306f' u'\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002\u4e00' u'\u90e8\u306f\u30c9\u30a4\u30c4\u8a9e\u3067\u3059\u304c' u'\u3001\u3042\u3068\u306f\u3067\u305f\u3089\u3081\u3067' u'\u3059\u3002\u5b9f\u969b\u306b\u306f\u300cWenn ist das' u' Nunstuck git und'.encode('utf-8'), '\xe6\xad\xa3\xe7\xa2\xba\xe3\x81\xab\xe8\xa8\x80\xe3\x81' '\x86\xe3\x81\xa8\xe7\xbf\xbb\xe8\xa8\xb3\xe3\x81\xaf\xe3' '\x81\x95\xe3\x82\x8c\xe3\x81\xa6\xe3\x81\x84\xe3\x81\xbe' '\xe3\x81\x9b\xe3\x82\x93\xe3\x80\x82\xe4\xb8\x80\xe9\x83' '\xa8\xe3\x81\xaf\xe3\x83\x89\xe3\x82\xa4\xe3\x83\x84\xe8' '\xaa\x9e\xe3\x81\xa7\xe3\x81\x99\xe3\x81\x8c\xe3\x80\x81' '\xe3\x81\x82\xe3\x81\xa8\xe3\x81\xaf\xe3\x81\xa7\xe3\x81' '\x9f\xe3\x82\x89\xe3\x82\x81\xe3\x81\xa7\xe3\x81\x99\xe3' '\x80\x82\xe5\xae\x9f\xe9\x9a\x9b\xe3\x81\xab\xe3\x81\xaf' '\xe3\x80\x8cWenn ist das Nunstuck git und' ) self.assertEqual(unicode('\xf0\xa3\x91\x96', 'utf-8'), u'\U00023456' ) self.assertEqual(unicode('\xf0\x90\x80\x82', 'utf-8'), u'\U00010002' ) self.assertEqual(unicode('\xe2\x82\xac', 'utf-8'), u'\u20ac' ) def test_codecs_errors(self): self.assertRaises(UnicodeError, u'Andr\202 x'.encode, 'ascii') self.assertRaises(UnicodeError, u'Andr\202 x'.encode, 'ascii','strict') self.assertEqual(u'Andr\202 x'.encode('ascii','ignore'), "Andr x") self.assertEqual(u'Andr\202 x'.encode('ascii','replace'), "Andr? x") self.assertRaises(UnicodeError, unicode, 'Andr\202 x', 'ascii') self.assertRaises(UnicodeError, unicode, 'Andr\202 x', 'ascii','strict') self.assertEqual(unicode('Andr\202 x','ascii','ignore'), u"Andr x") self.assertEqual(unicode('Andr\202 x','ascii','replace'), u'Andr\uFFFD x') self.assertEqual("\\N{foo}xx".decode("unicode-escape", "ignore"), u"xx") self.assertRaises(UnicodeError, "\\".decode, "unicode-escape") def search_function(encoding): def decode1(input, errors="strict"): return 42 def encode1(input, errors="strict"): return 42 def encode2(input, errors="strict"): return (42, 42) def decode2(input, errors="strict"): return (42, 42) if encoding=="test.unicode1": return (encode1, decode1, None, None) elif encoding=="test.unicode2": return (encode2, decode2, None, None)
def __repr__(self): return 'usub(%r)' % unicode.__repr__(self)
3b26a0ad23771835c0b085882a678560c5bc2291 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8125/3b26a0ad23771835c0b085882a678560c5bc2291/test_unicode.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1001, 12715, 972, 12, 2890, 4672, 327, 296, 407, 373, 9275, 86, 2506, 738, 5252, 16186, 12715, 972, 12, 2890, 13, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1001, 12715, 972, 12, 2890, 4672, 327, 296, 407, 373, 9275, 86, 2506, 738, 5252, 16186, 12715, 972, 12, 2890, 13, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -10...
m = re.match(r'(?si)(?:\s+|<!--.*?-->)*(<\?xml\s[^>]*>\s*)', html) if not m: return html
if not re.match('1\.[0-9]+\Z', default_version): raise ValueError("Bad default XML declaration version") if encoding: enc = encoding
def fix_xmldecl(html): """Looks for an XML declaration near the start of html, cleans it up, and returns the adjusted version of html. Doesn't add a declaration if none was found.""" # FIXME: a) Unfinished, b) Won't work. Needs rewriting to start as a more # lenient sniff_encoding(). m = re.match(r'(?si)(?:\s+|<!--.*?-->)*(<\?xml\s[^>]*>\s*)', html) if not m: return html else: before, decl, after = html[:m.start(1)], m.group(1), html[m.end(1):] m = re.search( r'''(?ui)\sversion\s*=\s*'([^']*)'|"([^"]*)"|([^\s<>]*)''', decl) if m: if m.group(1) is not None: g = 1 elif m.group(2) is not None: g = 2 else: g = 3 if re.match(r'1\.[0-9]+\Z', m.group(g)): version = m.group() else: raise ValidationError('Bad version in XML declaration', 0, 1, 1, []) return decl + before + after
7a06e148144d149fb4de5633ab51c94ff9e7a8fb /local1/tlutelli/issta_data/temp/all_python//python/2009_temp/2009/10679/7a06e148144d149fb4de5633ab51c94ff9e7a8fb/xhtmlify.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 2917, 67, 2902, 8840, 12, 2620, 4672, 3536, 20475, 364, 392, 3167, 8266, 13378, 326, 787, 434, 1729, 16, 1619, 634, 518, 731, 16, 471, 1135, 326, 13940, 1177, 434, 1729, 18, 9637, 82, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 2917, 67, 2902, 8840, 12, 2620, 4672, 3536, 20475, 364, 392, 3167, 8266, 13378, 326, 787, 434, 1729, 16, 1619, 634, 518, 731, 16, 471, 1135, 326, 13940, 1177, 434, 1729, 18, 9637, 82, ...
try: mod_path = get_module_path(module) if not mod_path: continue except IOError:
mod_path = get_module_path(module) terp_file = get_module_resource(module, '__terp__.py') if not mod_path or not terp_file: cr.execute("update ir_module_module set state=%s where name=%s", ('uninstallable', module))
def upgrade_graph(graph, module_list, force=None): if force is None: force = [] packages = [] len_graph = len(graph) for module in module_list: try: mod_path = get_module_path(module) if not mod_path: continue except IOError: continue terp_file = get_module_resource(module, '__terp__.py') if not terp_file: continue if os.path.isfile(terp_file) or zipfile.is_zipfile(mod_path+'.zip'): try: info = eval(tools.file_open(terp_file).read()) except: logger.notifyChannel('init', netsvc.LOG_ERROR, 'module %s: eval file %s' % (module, terp_file)) raise if info.get('installable', True): packages.append((module, info.get('depends', []), info)) dependencies = dict([(p, deps) for p, deps, data in packages]) current, later = Set([p for p, dep, data in packages]), Set() while packages and current > later: package, deps, data = packages[0] # if all dependencies of 'package' are already in the graph, add 'package' in the graph if reduce(lambda x, y: x and y in graph, deps, True): if not package in current: packages.pop(0) continue later.clear() current.remove(package) graph.addNode(package, deps) node = Node(package, graph) node.data = data for kind in ('init', 'demo', 'update'): if package in tools.config[kind] or 'all' in tools.config[kind] or kind in force: setattr(node, kind, True) else: later.add(package) packages.append((package, deps, data)) packages.pop(0) for package in later: unmet_deps = filter(lambda p: p not in graph, dependencies[package]) logger.notifyChannel('init', netsvc.LOG_ERROR, 'module %s: Unmet dependencies: %s' % (package, ', '.join(unmet_deps))) result = len(graph) - len_graph if result != len(module_list): logger.notifyChannel('init', netsvc.LOG_WARNING, 'Not all modules have loaded.') return result
f5724590ce894a156c7e5fb63648f1b355d22f58 /local1/tlutelli/issta_data/temp/all_python//python/2009_temp/2009/7397/f5724590ce894a156c7e5fb63648f1b355d22f58/__init__.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 8400, 67, 4660, 12, 4660, 16, 1605, 67, 1098, 16, 2944, 33, 7036, 4672, 309, 2944, 353, 599, 30, 2944, 273, 5378, 5907, 273, 5378, 562, 67, 4660, 273, 562, 12, 4660, 13, 364, 1605, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 8400, 67, 4660, 12, 4660, 16, 1605, 67, 1098, 16, 2944, 33, 7036, 4672, 309, 2944, 353, 599, 30, 2944, 273, 5378, 5907, 273, 5378, 562, 67, 4660, 273, 562, 12, 4660, 13, 364, 1605, 3...
config = core_state["config"] = generateConfiguration (base_path)
config = core_state["config"] = generateConfiguration ()
def hyltMain (meta_screen, starting_filename): """The core Hylt functionality. Contains the main input and display loops, lots of initialization, and so on. """ curses.curs_set(0) # Remember: Parameters are in the order of (y, x). meta_y, meta_x = meta_screen.getmaxyx() core_state = {"y": meta_y, "x": meta_x} # Keep the "base path", as all Hylt links are relative. base_path = core_state["base_path"] = os.path.dirname (starting_filename) filename = os.path.basename (starting_filename) core_state["curr_base_path"] = core_state["base_path"] # There are three windows: a top status bar, a primary screen, and a bottom # status bar. There is also the main screen, of course. Create them. top = meta_screen.subwin (1, meta_x, 0, 0) main = meta_screen.subwin (meta_y - 2, meta_x, 1, 0) bottom = meta_screen.subwin (1, meta_x, meta_y - 1, 0) # Read in the configuration. config = core_state["config"] = generateConfiguration (base_path) core_state["history"] = [] fresh_page = True done = False curses.def_prog_mode () main_needs_redraw = True while not done: if fresh_page: core_state["curr_base_path"] = os.path.dirname (filename) readHyltFile (filename, core_state)
3d935dc1773bd71731a9550b77a62ca6c32a7bb4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/2254/3d935dc1773bd71731a9550b77a62ca6c32a7bb4/hylt.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 4855, 5618, 6376, 261, 3901, 67, 9252, 16, 5023, 67, 3459, 4672, 3536, 1986, 2922, 14881, 5618, 14176, 18, 225, 8398, 326, 2774, 810, 471, 2562, 14075, 16, 328, 6968, 434, 10313, 16, 471...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 4855, 5618, 6376, 261, 3901, 67, 9252, 16, 5023, 67, 3459, 4672, 3536, 1986, 2922, 14881, 5618, 14176, 18, 225, 8398, 326, 2774, 810, 471, 2562, 14075, 16, 328, 6968, 434, 10313, 16, 471...
res = self.integrityClient.getTransformationProblematics(int(transID)) if not res['OK']: gLogger.error("Failed to determine waiting problematics for transformation", res['Message'])
res = self.integrityClient.getTransformationProblematics( int( transID ) ) if not res['OK']: gLogger.error( "Failed to determine waiting problematics for transformation", res['Message'] )
def updateWaitingIntegrity(self): gLogger.info( "Looking for transformations in the WaitingIntegrity status to update" ) res = self.transClient.getTransformations({'Status':'WaitingIntegrity'}) if not res['OK']: gLogger.error( "Failed to get WaitingIntegrity transformations", res['Message'] ) return res transDicts = res['Value'] if not transDicts: gLogger.info( "No transformations found in WaitingIntegrity status" ) return S_OK() gLogger.info( "Found %s transformations in WaitingIntegrity status" % len( transDicts ) ) for transDict in transDicts: transID = transDict['TransformationID'] gLogger.info( "-" * 40 ) res = self.integrityClient.getTransformationProblematics(int(transID)) if not res['OK']: gLogger.error("Failed to determine waiting problematics for transformation", res['Message']) elif not res['Value']: res = self.transClient.setTransformationParameter(transID,'Status','ValidatedOutput') if not res['OK']: gLogger.error("Failed to update status of transformation %s to ValidatedOutput" % (transID)) else: gLogger.info("Updated status of transformation %s to ValidatedOutput" % (transID)) else: gLogger.info("%d problematic files for transformation %s were found" % (len(res['Value']), transID)) return
18fc97d84d5da730b753dba630ee26614f9d37b6 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12864/18fc97d84d5da730b753dba630ee26614f9d37b6/ValidateOutputDataAgent.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1089, 15946, 30669, 12, 2890, 4672, 314, 3328, 18, 1376, 12, 315, 9794, 310, 364, 19245, 316, 326, 23333, 30669, 1267, 358, 1089, 6, 262, 400, 273, 365, 18, 2338, 1227, 18, 588, 4059, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1089, 15946, 30669, 12, 2890, 4672, 314, 3328, 18, 1376, 12, 315, 9794, 310, 364, 19245, 316, 326, 23333, 30669, 1267, 358, 1089, 6, 262, 400, 273, 365, 18, 2338, 1227, 18, 588, 4059, ...
nrow = nrow + 1 ds.Add(xLabel(dp,"Max Speed"), (nrow,0), (1,1), _textstyle,_textpadding) ds.Add(self.motor_ctrl(dp,'max_speed'), (nrow,1), (1,1), wx.ALIGN_CENTER)
print 'ready'
def __init__(self, parent=None, motor=None): wx.Frame.__init__(self, parent, wx.ID_ANY, style=wx.DEFAULT_FRAME_STYLE,size=(500,775) ) self.SetFont(wx.Font(11,wx.SWISS,wx.NORMAL,wx.BOLD,False))
afe0af9ce20213d58b33e8c4b281e7f67e47c2f0 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/12945/afe0af9ce20213d58b33e8c4b281e7f67e47c2f0/pv_multiple_callbacks.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1001, 2738, 972, 12, 2890, 16, 982, 33, 7036, 16, 23573, 33, 7036, 4672, 225, 7075, 18, 3219, 16186, 2738, 972, 12, 2890, 16, 982, 16, 7075, 18, 734, 67, 15409, 16, 2154, 33, 27226, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1001, 2738, 972, 12, 2890, 16, 982, 33, 7036, 16, 23573, 33, 7036, 4672, 225, 7075, 18, 3219, 16186, 2738, 972, 12, 2890, 16, 982, 16, 7075, 18, 734, 67, 15409, 16, 2154, 33, 27226, ...
Return the inner product matrix associated to this free module.
Return the inner product matrix associated to this module. By definition this is the inner product matrix of the ambient space, hence may be of degree greater than the rank of the module. N.B. The inner product does not have to be symmetric (see examples). TODO: Differentiate the image ring of the inner product from the base ring of the module and/or ambient space. E.g. On an integral module over ZZ the inner product pairing could naturally take values in ZZ, QQ, RR, or CC.
def inner_product_matrix(self): """ Return the inner product matrix associated to this free module. EXAMPLES: sage: M = FreeModule(ZZ, 3) sage: M.inner_product_matrix() [1 0 0] [0 1 0] [0 0 1] sage: FreeModule(ZZ,2,inner_product_matrix=[[1,-1],[2,5]]).inner_product_matrix() [ 1 -1] [ 2 5] """ if self._inner_product_matrix is None: # Not set, so induced by the ambient space or the identity matrix # if this space is ambient. if isinstance(self, FreeModule_ambient): M = sage.matrix.matrix_space.MatrixSpace( self.base_ring(), self.rank(), sparse=True)(1) else: # TODO: probably much better way to do this using matrix multiplication! A = self.ambient_vector_space() I = [A(v).inner_product(A(w)) for v in self.basis() for w in self.basis()] M = sage.matrix.matrix_space.MatrixSpace( \ self.base_field(), self.rank(), sparse=False)(I) self._inner_product_matrix = M return self._inner_product_matrix
89ba8998792aff6d6975d46de29ece3d76712b0f /local1/tlutelli/issta_data/temp/all_python//python/2007_temp/2007/9890/89ba8998792aff6d6975d46de29ece3d76712b0f/free_module.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 3443, 67, 5896, 67, 5667, 12, 2890, 4672, 3536, 2000, 326, 3443, 3017, 3148, 3627, 358, 333, 1605, 18, 2525, 2379, 333, 353, 326, 3443, 3017, 3148, 434, 326, 13232, 1979, 3476, 16, 20356...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 3443, 67, 5896, 67, 5667, 12, 2890, 4672, 3536, 2000, 326, 3443, 3017, 3148, 3627, 358, 333, 1605, 18, 2525, 2379, 333, 353, 326, 3443, 3017, 3148, 434, 326, 13232, 1979, 3476, 16, 20356...
'attachment/ticket/123/foo.txt?format=raw" '
'raw-attachment/ticket/123/foo.txt" '
def test_wiki_link_foreign(self): attachment = Attachment(self.env, 'ticket', 123) attachment.insert('foo.txt', tempfile.TemporaryFile(), 0)
5212b3d75f41c5849287b8b689aab1f5fa9d36fe /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9317/5212b3d75f41c5849287b8b689aab1f5fa9d36fe/attachment.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1842, 67, 13044, 67, 1232, 67, 12774, 12, 2890, 4672, 6042, 273, 15939, 12, 2890, 18, 3074, 16, 296, 16282, 2187, 17335, 13, 6042, 18, 6387, 2668, 11351, 18, 5830, 2187, 13275, 18, 23808...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1842, 67, 13044, 67, 1232, 67, 12774, 12, 2890, 4672, 6042, 273, 15939, 12, 2890, 18, 3074, 16, 296, 16282, 2187, 17335, 13, 6042, 18, 6387, 2668, 11351, 18, 5830, 2187, 13275, 18, 23808...
coinc_event_id
''', recovery_table, '''.coinc_event_id
def create_sim_rec_map_table(connection, simulation_table, recovery_table, ranking_stat): """ Creates a temporary table in the sqlite database called sim_rec_map. This table creates a direct mapping between simulation_ids in the simulation table and coinc_event_ids from the recovery_table, along with a ranking stat from the recovery_table. The columns in the sim_rec_map table are: * rec_id: coinc_event_ids of matching events from the recovery table * sim_id: the simulation_id from the sim_inspiral table * ranking_stat: any stat from the recovery table by which to rank * intermediate_id: the coinc_event_id of the sim_id (not really important for these uses) In addition, indices on the sim and rec ids are put on the table. Note that because this is a temporary table, as soon as the connection is closed, it will be deleted. @connection: connection to a sqlite database @recovery_table: any lsctable with a coinc_event_id column; e.g., coinc_inspiral @ranking_stat: the name of the ranking stat in the recovery table to use """ # if it isn't already, append the recovery_table name to the ranking_stat to ensure uniqueness if not ranking_stat.strip().startswith(recovery_table): ranking_stat = '.'.join([recovery_table.strip(), ranking_stat.strip()]) # create the sim_rec_map table; initially, this contains all mapped triggers in the database sqlscript = ''.join([""" CREATE TEMP TABLE sim_rec_map AS SELECT coinc_event_id AS intermediate_id, event_id AS rec_id, NULL AS sim_id, NULL AS ranking_stat FROM coinc_event_map WHERE table_name == "coinc_event" AND event_id IN ( SELECT coinc_event_id FROM ? """, join_experiment_tables_to_coinc_table(recovery_table), """ WHERE experiment_summary.datatype == "simulation"); -- populate the sim_id using the intermediate_id UPDATE sim_rec_map SET sim_id = ( SELECT event_id FROM coinc_event_map WHERE table_name == ? AND coinc_event_id == sim_rec_map.intermediate_id); -- create the indices CREATE INDEX srm_sid_index ON sim_rec_map (sim_id); CREATE INDEX srm_rid_index ON sim_rec_map (rec_id); -- populate ranking_stat UPDATE sim_rec_map SET ranking_stat = ( SELECT ? FROM ? WHERE """, recovery_table, """.coinc_event_id == sim_rec_map.rec_id ); """ ]) connection.cursor().executescript(sqlscript,(recovery_table, simulation_table, ranking_stat, recovery_table))
83b535c1c72c071da09fd95ea54958e1521ea1f7 /local1/tlutelli/issta_data/temp/all_python//python/2009_temp/2009/3592/83b535c1c72c071da09fd95ea54958e1521ea1f7/ligolw_sqlutils.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 752, 67, 9812, 67, 3927, 67, 1458, 67, 2121, 12, 4071, 16, 14754, 67, 2121, 16, 11044, 67, 2121, 16, 23087, 67, 5642, 4672, 3536, 10210, 279, 6269, 1014, 316, 326, 16184, 2063, 2566, 3...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 752, 67, 9812, 67, 3927, 67, 1458, 67, 2121, 12, 4071, 16, 14754, 67, 2121, 16, 11044, 67, 2121, 16, 23087, 67, 5642, 4672, 3536, 10210, 279, 6269, 1014, 316, 326, 16184, 2063, 2566, 3...
if op2.sign == 1:
if op2.sign == 0:
def __add__(self, other, context=None): """Returns self + other.
17931de110ac84e6b0eb88d77a95798f8670765a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/17931de110ac84e6b0eb88d77a95798f8670765a/decimal.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1001, 1289, 972, 12, 2890, 16, 1308, 16, 819, 33, 7036, 4672, 3536, 1356, 365, 397, 1308, 18, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1001, 1289, 972, 12, 2890, 16, 1308, 16, 819, 33, 7036, 4672, 3536, 1356, 365, 397, 1308, 18, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100,...
str = self.__rmjunk.sub('', str)
for pattern, replacement in REPLACEMENTS: str = pattern.sub(replacement, str)
def __init__(self, link, str, seqno): self.links = [link] self.seqno = seqno # remove <#\d+#> left in by moving the data out of LaTeX2HTML str = self.__rmjunk.sub('', str) # build up the text self.text = split_entry_text(str) self.key = split_entry_key(str)
1edb5935a113fa21a2c107644c79baa0211e80be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1edb5935a113fa21a2c107644c79baa0211e80be/buildindex.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1001, 2738, 972, 12, 2890, 16, 1692, 16, 609, 16, 30734, 4672, 365, 18, 7135, 273, 306, 1232, 65, 365, 18, 5436, 2135, 273, 30734, 468, 1206, 411, 7, 64, 72, 15, 7, 34, 2002, 316, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1001, 2738, 972, 12, 2890, 16, 1692, 16, 609, 16, 30734, 4672, 365, 18, 7135, 273, 306, 1232, 65, 365, 18, 5436, 2135, 273, 30734, 468, 1206, 411, 7, 64, 72, 15, 7, 34, 2002, 316, ...
status = xia2['xia2_status'][0].value('status')
termination_status = xia2['xia2_status'][0].value('status')
def get_relative_path(filename): """Attempt to get the path relative to cwd If 'filename' refers to a file or directory below the current working directory (cwd) then this function returns the relative path to cwd. Otherwise it returns 'filename'.""" pwd = os.getcwd() common_prefix = os.path.commonprefix([pwd,filename]) if common_prefix == pwd: # File is relative to cwd - strip off cwd and return return str(filename).replace(common_prefix,'',1).lstrip(os.sep) else: # File is not relative to cwd - return as is return filename
e1340f1bff904e82fb6a1fdf58de2ed7622eee81 /local1/tlutelli/issta_data/temp/all_python//python/2009_temp/2009/3290/e1340f1bff904e82fb6a1fdf58de2ed7622eee81/Xia2html.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 336, 67, 11626, 67, 803, 12, 3459, 4672, 3536, 7744, 358, 336, 326, 589, 3632, 358, 7239, 225, 971, 296, 3459, 11, 21368, 358, 279, 585, 578, 1867, 5712, 326, 783, 5960, 1867, 261, 110...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 336, 67, 11626, 67, 803, 12, 3459, 4672, 3536, 7744, 358, 336, 326, 589, 3632, 358, 7239, 225, 971, 296, 3459, 11, 21368, 358, 279, 585, 578, 1867, 5712, 326, 783, 5960, 1867, 261, 110...
enabled = True
enabled = False
def extract_tracker_specific_data(xml_data, ret_dict): # Make modifications to ret_dict using provided metadata # Check for the bitesized keyword keywords_text = mysite.customs.bugtrackers.bugzilla.get_tag_text_from_xml(xml_data, 'keywords') keywords = map(lambda s: s.strip(), keywords_text.split(',')) ret_dict['good_for_newcomers'] = ('janitor' in keywords) # Then pass ret_dict back return ret_dict
1bdbe25f6231b5475122c93e4812890ea30f4bc7 /local1/tlutelli/issta_data/temp/all_python//python/2010_temp/2010/11976/1bdbe25f6231b5475122c93e4812890ea30f4bc7/bugzilla_instances.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 2608, 67, 16543, 67, 12524, 67, 892, 12, 2902, 67, 892, 16, 325, 67, 1576, 4672, 468, 4344, 17953, 358, 325, 67, 1576, 1450, 2112, 1982, 468, 2073, 364, 326, 2831, 281, 1235, 4932, 709...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 2608, 67, 16543, 67, 12524, 67, 892, 12, 2902, 67, 892, 16, 325, 67, 1576, 4672, 468, 4344, 17953, 358, 325, 67, 1576, 1450, 2112, 1982, 468, 2073, 364, 326, 2831, 281, 1235, 4932, 709...
self.database.load( u"foo", self.scheduler.thread )
self.database.load( u"Some_object foo", self.scheduler.thread )
def gen(): basic_obj = Some_object( object_id = "5", value = 1, secondary_id = u"foo" )
35e06bccefda7333ac8943bebdf6d1f6440b0634 /local1/tlutelli/issta_data/temp/all_python//python/2007_temp/2007/6754/35e06bccefda7333ac8943bebdf6d1f6440b0634/Test_database.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 3157, 13332, 5337, 67, 2603, 273, 10548, 67, 1612, 12, 733, 67, 350, 273, 315, 25, 3113, 460, 273, 404, 16, 9946, 67, 350, 273, 582, 6, 11351, 6, 262, 2, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 3157, 13332, 5337, 67, 2603, 273, 10548, 67, 1612, 12, 733, 67, 350, 273, 315, 25, 3113, 460, 273, 404, 16, 9946, 67, 350, 273, 582, 6, 11351, 6, 262, 2, -100, -100, -100, -100, -100...
DebugPrint(1, " Removing log files older than ", nDays, " days from " , backupDir)
DebugPrint(1, "Removing log files older than ", nDays, " days from " , logDir)
def RemoveOldLogs(nDays = 31): backupDir = Config.get_LogFolder() cutoff = time.time() - nDays * 24 * 3600 DebugPrint(1, " Removing log files older than ", nDays, " days from " , backupDir) # Get the list of all files in the PSACCT File Backup Repository files = glob.glob(os.path.join(backupDir,"*")+".log") DebugPrint(3, " Will check the files: ",files) for f in files: if os.path.getmtime(f) < cutoff: DebugPrint(2, "Will remove: " + f) #os.remove(f) files = None
00c9dfb20e90a66ac68c84f17baafcb687e56269 /local1/tlutelli/issta_data/temp/all_python//python/2007_temp/2007/637/00c9dfb20e90a66ac68c84f17baafcb687e56269/Gratia.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 3581, 7617, 7777, 12, 82, 9384, 273, 8231, 4672, 225, 5114, 1621, 273, 1903, 18, 588, 67, 1343, 3899, 1435, 13383, 273, 813, 18, 957, 1435, 300, 290, 9384, 380, 4248, 380, 12396, 225, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 3581, 7617, 7777, 12, 82, 9384, 273, 8231, 4672, 225, 5114, 1621, 273, 1903, 18, 588, 67, 1343, 3899, 1435, 13383, 273, 813, 18, 957, 1435, 300, 290, 9384, 380, 4248, 380, 12396, 225, ...
def addStubMember(memberId, member):
def addStubMember(memberId, member, traceable):
def addStubMember(memberId, member): # Check that the member is ok. if member.kind not in ('method', 'attribute'): raise UserError("Member %s is %r, not a method or attribute." % (memberId, member.kind)) if member.noscript: raise UserError("%s %s is noscript." % (member.kind.capitalize(), memberId)) if member.notxpcom: raise UserError( "%s %s: notxpcom methods are not supported." % (member.kind.capitalize(), memberId)) if (member.kind == 'attribute' and not member.readonly and isSpecificInterfaceType(member.realtype, 'nsIVariant')): raise UserError( "Attribute %s: Non-readonly attributes of type nsIVariant " "are not supported." % memberId) # Check for unknown properties. for attrname, value in vars(member).items(): if value is True and attrname not in ('readonly',): raise UserError("%s %s: unrecognized property %r" % (member.kind.capitalize(), memberId, attrname)) if member.kind == 'method': for param in member.params: for attrname, value in vars(param).items(): if value is True and attrname not in ('optional',): raise UserError("Method %s, parameter %s: " "unrecognized property %r" % (memberId, param.name, attrname)) # Add this member to the list. member.iface.stubMembers.append(member)
a7814d982cc71cb09073f84f532a92897bf7d2bd /local1/tlutelli/issta_data/temp/all_python//python/2009_temp/2009/11102/a7814d982cc71cb09073f84f532a92897bf7d2bd/qsgen.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 527, 11974, 4419, 12, 5990, 548, 16, 3140, 16, 2606, 429, 4672, 468, 2073, 716, 326, 3140, 353, 1529, 18, 309, 3140, 18, 9224, 486, 316, 7707, 2039, 2187, 296, 4589, 11, 4672, 1002, 21...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 527, 11974, 4419, 12, 5990, 548, 16, 3140, 16, 2606, 429, 4672, 468, 2073, 716, 326, 3140, 353, 1529, 18, 309, 3140, 18, 9224, 486, 316, 7707, 2039, 2187, 296, 4589, 11, 4672, 1002, 21...
if self.force or (output_file and newer(source, output_file)):
if self.force or output_file is None or newer(source, output_file)):
def preprocess (self, source, output_file=None, macros=None, include_dirs=None, extra_preargs=None, extra_postargs=None):
286b107bea83c10075e263f02a1795beb7de8e70 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/286b107bea83c10075e263f02a1795beb7de8e70/unixccompiler.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 17942, 261, 2890, 16, 1084, 16, 876, 67, 768, 33, 7036, 16, 24302, 33, 7036, 16, 2341, 67, 8291, 33, 7036, 16, 2870, 67, 1484, 1968, 33, 7036, 16, 2870, 67, 2767, 1968, 33, 7036, 467...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 17942, 261, 2890, 16, 1084, 16, 876, 67, 768, 33, 7036, 16, 24302, 33, 7036, 16, 2341, 67, 8291, 33, 7036, 16, 2870, 67, 1484, 1968, 33, 7036, 16, 2870, 67, 2767, 1968, 33, 7036, 467...
return LIGOTimeGPS(self.seconds - other.seconds, self.nanoseconds - other.nanoseconds)
return LIGOTimeGPS(self.__seconds - other.seconds, self.__nanoseconds - other.nanoseconds)
def __sub__(self, other): """ Subtract a value from a LIGOTimeGPS. If the value being subtracted from the LIGOTimeGPS is not also a LIGOTimeGPS, then an attempt is made to convert it to a LIGOTimeGPS.
64e3217d9e86a7f50114bba7adfdee1638e21ac0 /local1/tlutelli/issta_data/temp/all_python//python/2009_temp/2009/3589/64e3217d9e86a7f50114bba7adfdee1638e21ac0/lal.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1001, 1717, 972, 12, 2890, 16, 1308, 4672, 3536, 2592, 1575, 279, 460, 628, 279, 511, 3047, 51, 950, 28983, 18, 225, 971, 326, 460, 3832, 10418, 329, 628, 326, 511, 3047, 51, 950, 2898...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1001, 1717, 972, 12, 2890, 16, 1308, 4672, 3536, 2592, 1575, 279, 460, 628, 279, 511, 3047, 51, 950, 28983, 18, 225, 971, 326, 460, 3832, 10418, 329, 628, 326, 511, 3047, 51, 950, 2898...
return [inws.writefile(f,f.isExecutable()) for f in sandbox_files]
return [inws.writefile(f,f.isExecutable()) for f in sandbox_files]
def createInputSandbox(sandbox_files,inws): """Put all sandbox_files into the input workspace. This function is called by Ganga client at the submission time. Arguments: 'sandbox_files': a list of File or FileBuffer objects. 'inws': a InputFileWorkspace object Return: a list of paths to sanbdox files in the input workspace """ # from Ganga.Core import FileWorkspace return [inws.writefile(f,f.isExecutable()) for f in sandbox_files]
3975c813beb1813bd20f0bfbca2b9570fe12bca8 /local1/tlutelli/issta_data/temp/all_python//python/2009_temp/2009/1488/3975c813beb1813bd20f0bfbca2b9570fe12bca8/Sandbox.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 752, 1210, 17881, 12, 27004, 67, 2354, 16, 267, 4749, 4672, 3536, 6426, 777, 15202, 67, 2354, 1368, 326, 810, 6003, 18, 1220, 445, 353, 2566, 635, 611, 539, 69, 1004, 622, 326, 8515, 8...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 752, 1210, 17881, 12, 27004, 67, 2354, 16, 267, 4749, 4672, 3536, 6426, 777, 15202, 67, 2354, 1368, 326, 810, 6003, 18, 1220, 445, 353, 2566, 635, 611, 539, 69, 1004, 622, 326, 8515, 8...
jobMaxRetries=0
try: jobMaxRetries=WEjobState['max_retries'] except: jobMaxRetries=10
def archiveJob(self,success,jobId): """ _archiveJob_ copy(self.reportfilename,newPath)
5ec7f1e22b50c5d2ee92e9484803f11ef0d2538b /local1/tlutelli/issta_data/temp/all_python//python/2007_temp/2007/8887/5ec7f1e22b50c5d2ee92e9484803f11ef0d2538b/TrackingComponent.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 5052, 2278, 12, 2890, 16, 4768, 16, 4688, 548, 4672, 3536, 389, 10686, 2278, 67, 1610, 12, 2890, 18, 6006, 3459, 16, 2704, 743, 13, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 5052, 2278, 12, 2890, 16, 4768, 16, 4688, 548, 4672, 3536, 389, 10686, 2278, 67, 1610, 12, 2890, 18, 6006, 3459, 16, 2704, 743, 13, 2, -100, -100, -100, -100, -100, -100, -100, -100, -...
self.tk.call(self._w, 'enable', name)
self.tk.call(self._w, 'enable', name)
def enable(self, name):
86af7ef7e3f4448abc89aa941517a84075d99a38 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/3187/86af7ef7e3f4448abc89aa941517a84075d99a38/Tix.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 4237, 12, 2890, 16, 508, 4672, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 4237, 12, 2890, 16, 508, 4672, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100...
self.entries = entries
def __init__(self, *args, **kwargs): entries = kwargs.pop('entries', []) user = kwargs.pop('user', None) super(Transaction, self).__init__(*args, **kwargs) self.entries = entries self.user = user
293fbd6a0fc508fba28054b1bcad1179c32d18bb /local1/tlutelli/issta_data/temp/all_python//python/2007_temp/2007/12178/293fbd6a0fc508fba28054b1bcad1179c32d18bb/models.py
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1001, 2738, 972, 12, 2890, 16, 380, 1968, 16, 2826, 4333, 4672, 3222, 273, 1205, 18, 5120, 2668, 8219, 2187, 5378, 13, 729, 273, 1205, 18, 5120, 2668, 1355, 2187, 599, 13, 2240, 12, 33...
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0...
[ 1, 8585, 326, 22398, 316, 326, 981, 30, 1652, 1001, 2738, 972, 12, 2890, 16, 380, 1968, 16, 2826, 4333, 4672, 3222, 273, 1205, 18, 5120, 2668, 8219, 2187, 5378, 13, 729, 273, 1205, 18, 5120, 2668, 1355, 2187, 599, 13, 2240, 12, 33...