rem
stringlengths 1
322k
| add
stringlengths 0
2.05M
| context
stringlengths 4
228k
| meta
stringlengths 156
215
|
---|---|---|---|
a = self.dispatch['return'](self, self.cur[4], t) | a = self.dispatch['return'](self, self.cur[-2], t) | def simulate_cmd_complete(self): get_time = self.get_time t = get_time() - self.t while self.cur[5]: # We *can* cause assertion errors here if # dispatch_trace_return checks for a frame match! a = self.dispatch['return'](self, self.cur[4], t) t = 0 self.t = get_time() - t | df5cfd884d5da8a9a0b620b232f9ecfea6f77224 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/df5cfd884d5da8a9a0b620b232f9ecfea6f77224/profile.py |
Triple = group("'''", '"""', "r'''", 'r"""') | Triple = group("[rR]?'''", '[rR]?"""') | def maybe(*choices): return apply(group, choices) + '?' | fefc922cef9d89bb6e3d12dc3d2f16e3f49d7250 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/fefc922cef9d89bb6e3d12dc3d2f16e3f49d7250/tokenize.py |
ContStr = group("r?'" + any(r'\\.', r"[^\n'\\]") + group("'", r'\\\r?\n'), 'r?"' + any(r'\\.', r'[^\n"\\]') + group('"', r'\\\r?\n')) | ContStr = group("[rR]?'" + any(r'\\.', r"[^\n'\\]") + group("'", r'\\\r?\n'), '[rR]?"' + any(r'\\.', r'[^\n"\\]') + group('"', r'\\\r?\n')) | def maybe(*choices): return apply(group, choices) + '?' | fefc922cef9d89bb6e3d12dc3d2f16e3f49d7250 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/fefc922cef9d89bb6e3d12dc3d2f16e3f49d7250/tokenize.py |
endprogs = {"'": re.compile(Single), '"': re.compile(Double), 'r': None, | endprogs = {"'": re.compile(Single), '"': re.compile(Double), | def maybe(*choices): return apply(group, choices) + '?' | fefc922cef9d89bb6e3d12dc3d2f16e3f49d7250 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/fefc922cef9d89bb6e3d12dc3d2f16e3f49d7250/tokenize.py |
"r'''": single3prog, 'r"""': double3prog} | "r'''": single3prog, 'r"""': double3prog, "R'''": single3prog, 'R"""': double3prog, 'r': None, 'R': None} | def maybe(*choices): return apply(group, choices) + '?' | fefc922cef9d89bb6e3d12dc3d2f16e3f49d7250 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/fefc922cef9d89bb6e3d12dc3d2f16e3f49d7250/tokenize.py |
elif token in ("'''",'"""',"r'''",'r"""'): | elif token in ("'''", '"""', "r'''", 'r"""', "R'''", 'R"""'): | def tokenize(readline, tokeneater=printtoken): lnum = parenlev = continued = 0 namechars, numchars = string.letters + '_', string.digits contstr, needcont = '', 0 indents = [0] while 1: # loop over lines in stream line = readline() lnum = lnum + 1 pos, max = 0, len(line) if contstr: # continued string if not line: raise TokenError, ("EOF in multi-line string", strstart) endmatch = endprog.match(line) if endmatch: pos = end = endmatch.end(0) tokeneater(STRING, contstr + line[:end], strstart, (lnum, end), line) contstr, needcont = '', 0 elif needcont and line[-2:] != '\\\n' and line[-3:] != '\\\r\n': tokeneater(ERRORTOKEN, contstr + line, strstart, (lnum, len(line)), line) contstr = '' continue else: contstr = contstr + line continue elif parenlev == 0 and not continued: # new statement if not line: break column = 0 while pos < max: # measure leading whitespace if line[pos] == ' ': column = column + 1 elif line[pos] == '\t': column = (column/tabsize + 1)*tabsize elif line[pos] == '\f': column = 0 else: break pos = pos + 1 if pos == max: break if line[pos] in '#\r\n': # skip comments or blank lines tokeneater((NEWLINE, COMMENT)[line[pos] == '#'], line[pos:], (lnum, pos), (lnum, len(line)), line) continue if column > indents[-1]: # count indents or dedents indents.append(column) tokeneater(INDENT, line[:pos], (lnum, 0), (lnum, pos), line) while column < indents[-1]: indents = indents[:-1] tokeneater(DEDENT, '', (lnum, pos), (lnum, pos), line) else: # continued statement if not line: raise TokenError, ("EOF in multi-line statement", (lnum, 0)) continued = 0 while pos < max: pseudomatch = pseudoprog.match(line, pos) if pseudomatch: # scan for tokens start, end = pseudomatch.span(1) spos, epos, pos = (lnum, start), (lnum, end), end token, initial = line[start:end], line[start] if initial in numchars \ or (initial == '.' and token != '.'): # ordinary number tokeneater(NUMBER, token, spos, epos, line) elif initial in '\r\n': tokeneater(NEWLINE, token, spos, epos, line) elif initial == '#': tokeneater(COMMENT, token, spos, epos, line) elif token in ("'''",'"""',"r'''",'r"""'): # triple-quoted endprog = endprogs[token] endmatch = endprog.match(line, pos) if endmatch: # all on one line pos = endmatch.end(0) token = line[start:pos] tokeneater(STRING, token, spos, (lnum, pos), line) else: strstart = (lnum, start) # multiple lines contstr = line[start:] break elif initial in ("'", '"') or token[:2] in ("r'", 'r"'): if token[-1] == '\n': # continued string strstart = (lnum, start) endprog = endprogs[initial] or endprogs[token[1]] contstr, needcont = line[start:], 1 break else: # ordinary string tokeneater(STRING, token, spos, epos, line) elif initial in namechars: # ordinary name tokeneater(NAME, token, spos, epos, line) elif initial == '\\': # continued stmt continued = 1 else: if initial in '([{': parenlev = parenlev + 1 elif initial in ')]}': parenlev = parenlev - 1 tokeneater(OP, token, spos, epos, line) else: tokeneater(ERRORTOKEN, line[pos], (lnum, pos), (lnum, pos+1), line) pos = pos + 1 for indent in indents[1:]: # pop remaining indent levels tokeneater(DEDENT, '', (lnum, 0), (lnum, 0), '') tokeneater(ENDMARKER, '', (lnum, 0), (lnum, 0), '') | fefc922cef9d89bb6e3d12dc3d2f16e3f49d7250 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/fefc922cef9d89bb6e3d12dc3d2f16e3f49d7250/tokenize.py |
elif initial in ("'", '"') or token[:2] in ("r'", 'r"'): | elif initial in ("'", '"') or \ token[:2] in ("r'", 'r"', "R'", 'R"'): | def tokenize(readline, tokeneater=printtoken): lnum = parenlev = continued = 0 namechars, numchars = string.letters + '_', string.digits contstr, needcont = '', 0 indents = [0] while 1: # loop over lines in stream line = readline() lnum = lnum + 1 pos, max = 0, len(line) if contstr: # continued string if not line: raise TokenError, ("EOF in multi-line string", strstart) endmatch = endprog.match(line) if endmatch: pos = end = endmatch.end(0) tokeneater(STRING, contstr + line[:end], strstart, (lnum, end), line) contstr, needcont = '', 0 elif needcont and line[-2:] != '\\\n' and line[-3:] != '\\\r\n': tokeneater(ERRORTOKEN, contstr + line, strstart, (lnum, len(line)), line) contstr = '' continue else: contstr = contstr + line continue elif parenlev == 0 and not continued: # new statement if not line: break column = 0 while pos < max: # measure leading whitespace if line[pos] == ' ': column = column + 1 elif line[pos] == '\t': column = (column/tabsize + 1)*tabsize elif line[pos] == '\f': column = 0 else: break pos = pos + 1 if pos == max: break if line[pos] in '#\r\n': # skip comments or blank lines tokeneater((NEWLINE, COMMENT)[line[pos] == '#'], line[pos:], (lnum, pos), (lnum, len(line)), line) continue if column > indents[-1]: # count indents or dedents indents.append(column) tokeneater(INDENT, line[:pos], (lnum, 0), (lnum, pos), line) while column < indents[-1]: indents = indents[:-1] tokeneater(DEDENT, '', (lnum, pos), (lnum, pos), line) else: # continued statement if not line: raise TokenError, ("EOF in multi-line statement", (lnum, 0)) continued = 0 while pos < max: pseudomatch = pseudoprog.match(line, pos) if pseudomatch: # scan for tokens start, end = pseudomatch.span(1) spos, epos, pos = (lnum, start), (lnum, end), end token, initial = line[start:end], line[start] if initial in numchars \ or (initial == '.' and token != '.'): # ordinary number tokeneater(NUMBER, token, spos, epos, line) elif initial in '\r\n': tokeneater(NEWLINE, token, spos, epos, line) elif initial == '#': tokeneater(COMMENT, token, spos, epos, line) elif token in ("'''",'"""',"r'''",'r"""'): # triple-quoted endprog = endprogs[token] endmatch = endprog.match(line, pos) if endmatch: # all on one line pos = endmatch.end(0) token = line[start:pos] tokeneater(STRING, token, spos, (lnum, pos), line) else: strstart = (lnum, start) # multiple lines contstr = line[start:] break elif initial in ("'", '"') or token[:2] in ("r'", 'r"'): if token[-1] == '\n': # continued string strstart = (lnum, start) endprog = endprogs[initial] or endprogs[token[1]] contstr, needcont = line[start:], 1 break else: # ordinary string tokeneater(STRING, token, spos, epos, line) elif initial in namechars: # ordinary name tokeneater(NAME, token, spos, epos, line) elif initial == '\\': # continued stmt continued = 1 else: if initial in '([{': parenlev = parenlev + 1 elif initial in ')]}': parenlev = parenlev - 1 tokeneater(OP, token, spos, epos, line) else: tokeneater(ERRORTOKEN, line[pos], (lnum, pos), (lnum, pos+1), line) pos = pos + 1 for indent in indents[1:]: # pop remaining indent levels tokeneater(DEDENT, '', (lnum, 0), (lnum, 0), '') tokeneater(ENDMARKER, '', (lnum, 0), (lnum, 0), '') | fefc922cef9d89bb6e3d12dc3d2f16e3f49d7250 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/fefc922cef9d89bb6e3d12dc3d2f16e3f49d7250/tokenize.py |
exts.append( Extension('unicodedata', ['unicodedata.c', 'unicodedatabase.c']) ) | exts.append( Extension('unicodedata', ['unicodedata.c']) ) | def detect_modules(self): # Ensure that /usr/local is always used if '/usr/local/lib' not in self.compiler.library_dirs: self.compiler.library_dirs.append('/usr/local/lib') if '/usr/local/include' not in self.compiler.include_dirs: self.compiler.include_dirs.append( '/usr/local/include' ) | 14970bea8ff40dc8c89af036aeba089fd0bd5680 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/14970bea8ff40dc8c89af036aeba089fd0bd5680/setup.py |
if sys.platform.startswith("win"): lookfor = " denied" | if sys.platform == 'win32': expected_exit_code = 2 | def test_directories(self): # Does this test make sense? The message for "< ." may depend on # the command shell, and the message for "." depends on the OS. if sys.platform.startswith("win"): # On WinXP w/ cmd.exe, # "< ." gives "Access is denied.\n" # "." gives "C:\\Code\\python\\PCbuild\\python.exe: " + # "can't open file '.':" + # "[Errno 13] Permission denied\n" lookfor = " denied" # common to both cases else: # This is what the test looked for originally, on all platforms. lookfor = "is a directory" self.assertTrue(lookfor in self.start_python('.')) self.assertTrue(lookfor in self.start_python('< .')) | 9356fb9881ac774e496f08f12a9e166c417feabe /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9356fb9881ac774e496f08f12a9e166c417feabe/test_cmd_line.py |
lookfor = "is a directory" self.assertTrue(lookfor in self.start_python('.')) self.assertTrue(lookfor in self.start_python('< .')) | expected_exit_code = 0 self.assertEqual(self.exit_code('.'), expected_exit_code) self.assertTrue(self.exit_code('< .') != 0) | def test_directories(self): # Does this test make sense? The message for "< ." may depend on # the command shell, and the message for "." depends on the OS. if sys.platform.startswith("win"): # On WinXP w/ cmd.exe, # "< ." gives "Access is denied.\n" # "." gives "C:\\Code\\python\\PCbuild\\python.exe: " + # "can't open file '.':" + # "[Errno 13] Permission denied\n" lookfor = " denied" # common to both cases else: # This is what the test looked for originally, on all platforms. lookfor = "is a directory" self.assertTrue(lookfor in self.start_python('.')) self.assertTrue(lookfor in self.start_python('< .')) | 9356fb9881ac774e496f08f12a9e166c417feabe /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9356fb9881ac774e496f08f12a9e166c417feabe/test_cmd_line.py |
self.__frame = Frame(parent) self.__frame.pack(expand=YES, fill=BOTH) | self.__frame = Frame(parent, relief=GROOVE, borderwidth=2) self.__frame.pack() | def __init__(self, switchboard, parent=None): self.__sb = switchboard self.__frame = Frame(parent) self.__frame.pack(expand=YES, fill=BOTH) # create the chip that will display the currently selected color # exactly self.__sframe = Frame(self.__frame) self.__sframe.grid(row=0, column=0) self.__selected = ChipWidget(self.__sframe, text='Selected') # create the chip that will display the nearest real X11 color # database color name self.__nframe = Frame(self.__frame) self.__nframe.grid(row=0, column=1) self.__nearest = ChipWidget(self.__nframe, text='Nearest', presscmd = self.__buttonpress, releasecmd = self.__buttonrelease) | aa40b556fd12b358a634389a25dc0bef60744893 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/aa40b556fd12b358a634389a25dc0bef60744893/ChipViewer.py |
self.msg('IAC %s %d', c == DO and 'DO' or 'DONT', ord(c)) self.sock.send(IAC + WONT + opt) | self.msg('IAC %s %d', c == DO and 'DO' or 'DONT', ord(opt)) if self.option_callback: self.option_callback(self.sock, c, opt) else: self.sock.send(IAC + WONT + opt) | def process_rawq(self): """Transfer from raw queue to cooked queue. | b0162f9afc115b925475dd76311ce3ea6256257d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b0162f9afc115b925475dd76311ce3ea6256257d/telnetlib.py |
c == WILL and 'WILL' or 'WONT', ord(c)) self.sock.send(IAC + DONT + opt) | c == WILL and 'WILL' or 'WONT', ord(opt)) if self.option_callback: self.option_callback(self.sock, c, opt) else: self.sock.send(IAC + DONT + opt) | def process_rawq(self): """Transfer from raw queue to cooked queue. | b0162f9afc115b925475dd76311ce3ea6256257d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b0162f9afc115b925475dd76311ce3ea6256257d/telnetlib.py |
self.msg('IAC %s not recognized' % `c`) | self.msg('IAC %d not recognized' % ord(opt)) | def process_rawq(self): """Transfer from raw queue to cooked queue. | b0162f9afc115b925475dd76311ce3ea6256257d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b0162f9afc115b925475dd76311ce3ea6256257d/telnetlib.py |
self.repr = "{}" | self.repr = "set()" | def setUp(self): self.case = "empty set" self.values = [] self.set = set(self.values) self.dup = set(self.values) self.length = 0 self.repr = "{}" | c4996ba794d9438be8e472ad5f6c3c55fbf751e8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c4996ba794d9438be8e472ad5f6c3c55fbf751e8/test_set.py |
path, lastcomp = os.path.split(path) if not path: break removed[0:0] = [lastcomp] path = patharg while 1: | def match(self, patharg): removed = [] # First check the include directory path = patharg while 1: if self.idict.has_key(path): # We know of this path (or initial piece of path) dstpath = self.idict[path] # We do want it distributed. Tack on the tail. while removed: dstpath = os.path.join(dstpath, removed[0]) removed = removed[1:] # Finally, if the resultant string ends in a separator # tack on our input filename if dstpath[-1] == os.sep: dir, file = os.path.split(path) dstpath = os.path.join(dstpath, file) if DEBUG: print 'include', patharg, dstpath return dstpath path, lastcomp = os.path.split(path) if not path: break removed[0:0] = [lastcomp] # Next check the exclude directory path = patharg while 1: if self.edict.has_key(path): if DEBUG: print 'exclude', patharg, path return '' path, lastcomp = os.path.split(path) if not path: break removed[0:0] = [lastcomp] if DEBUG: print 'nomatch', patharg return None | eb43b30aee1c71b03dfaf7e1516bd610f9dd83d0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/eb43b30aee1c71b03dfaf7e1516bd610f9dd83d0/MkDistr.py |
|
(?P<escaped>%(delim)s{2}) | %(delim)s(?P<named>%(id)s) | %(delim)s{(?P<braced>%(id)s)} | (?P<invalid>%(delim)s) | %(delim)s(?: (?P<escaped>%(delim)s) | (?P<named>%(id)s) | {(?P<braced>%(id)s)} | (?P<invalid>) ) | def __getitem__(self, key): try: return self._primary[key] except KeyError: return self._secondary[key] | 55593c3ef530ea01b1cfb1f7c81ee34fd994d0ef /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/55593c3ef530ea01b1cfb1f7c81ee34fd994d0ef/string.py |
self.assertRaises(ValueError, msg.get_content_maintype) | self.assertEqual(msg.get_content_maintype(), 'text') | def test_get_content_maintype_error(self): msg = Message() msg['Content-Type'] = 'no-slash-in-this-string' self.assertRaises(ValueError, msg.get_content_maintype) | 3328136e3ccc89da6f042d1e58e2277d71b34855 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3328136e3ccc89da6f042d1e58e2277d71b34855/test_email.py |
self.assertRaises(ValueError, msg.get_content_subtype) | self.assertEqual(msg.get_content_subtype(), 'plain') | def test_get_content_subtype_error(self): msg = Message() msg['Content-Type'] = 'no-slash-in-this-string' self.assertRaises(ValueError, msg.get_content_subtype) | 3328136e3ccc89da6f042d1e58e2277d71b34855 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3328136e3ccc89da6f042d1e58e2277d71b34855/test_email.py |
if filename == '<string>' and mainpyfile: filename = mainpyfile | if filename == '<string>' and self.mainpyfile: filename = self.mainpyfile | def defaultFile(self): """Produce a reasonable default.""" filename = self.curframe.f_code.co_filename if filename == '<string>' and mainpyfile: filename = mainpyfile return filename | 25b38c89690e79e8f3bc78245b73017eed07f42e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/25b38c89690e79e8f3bc78245b73017eed07f42e/pdb.py |
"""Helper function for break/clear parsing -- may be overridden.""" | """Helper function for break/clear parsing -- may be overridden. lookupmodule() translates (possibly incomplete) file or module name into an absolute file name. """ if os.path.isabs(filename) and os.path.exists(filename): return filename f = os.path.join(sys.path[0], filename) if os.path.exists(f) and self.canonic(f) == self.mainpyfile: return f | def lookupmodule(self, filename): """Helper function for break/clear parsing -- may be overridden.""" root, ext = os.path.splitext(filename) if ext == '': filename = filename + '.py' if os.path.isabs(filename): return filename for dirname in sys.path: while os.path.islink(dirname): dirname = os.readlink(dirname) fullname = os.path.join(dirname, filename) if os.path.exists(fullname): return fullname return None | 25b38c89690e79e8f3bc78245b73017eed07f42e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/25b38c89690e79e8f3bc78245b73017eed07f42e/pdb.py |
mainmodule = '' mainpyfile = '' if __name__=='__main__': | def main(): | def help(): for dirname in sys.path: fullname = os.path.join(dirname, 'pdb.doc') if os.path.exists(fullname): sts = os.system('${PAGER-more} '+fullname) if sts: print '*** Pager exit status:', sts break else: print 'Sorry, can\'t find the help file "pdb.doc"', print 'along the Python search path' | 25b38c89690e79e8f3bc78245b73017eed07f42e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/25b38c89690e79e8f3bc78245b73017eed07f42e/pdb.py |
mainpyfile = filename = sys.argv[1] if not os.path.exists(filename): print 'Error:', repr(filename), 'does not exist' | mainpyfile = sys.argv[1] if not os.path.exists(mainpyfile): print 'Error:', mainpyfile, 'does not exist' | def help(): for dirname in sys.path: fullname = os.path.join(dirname, 'pdb.doc') if os.path.exists(fullname): sts = os.system('${PAGER-more} '+fullname) if sts: print '*** Pager exit status:', sts break else: print 'Sorry, can\'t find the help file "pdb.doc"', print 'along the Python search path' | 25b38c89690e79e8f3bc78245b73017eed07f42e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/25b38c89690e79e8f3bc78245b73017eed07f42e/pdb.py |
mainmodule = os.path.basename(filename) | def help(): for dirname in sys.path: fullname = os.path.join(dirname, 'pdb.doc') if os.path.exists(fullname): sts = os.system('${PAGER-more} '+fullname) if sts: print '*** Pager exit status:', sts break else: print 'Sorry, can\'t find the help file "pdb.doc"', print 'along the Python search path' | 25b38c89690e79e8f3bc78245b73017eed07f42e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/25b38c89690e79e8f3bc78245b73017eed07f42e/pdb.py |
|
sys.path.insert(0, os.path.dirname(filename)) run('execfile(%r)' % (filename,)) | sys.path[0] = os.path.dirname(mainpyfile) pdb = Pdb() while 1: try: pdb._runscript(mainpyfile) if pdb._user_requested_quit: break print "The program finished and will be restarted" except SystemExit: print "The program exited via sys.exit(). Exit status: ", print sys.exc_info()[1] except: traceback.print_exc() print "Uncaught exception. Entering post mortem debugging" print "Running 'cont' or 'step' will restart the program" t = sys.exc_info()[2] while t.tb_next is not None: t = t.tb_next pdb.interaction(t.tb_frame,t) print "Post mortem debugger finished. The "+mainpyfile+" will be restarted" if __name__=='__main__': main() | def help(): for dirname in sys.path: fullname = os.path.join(dirname, 'pdb.doc') if os.path.exists(fullname): sts = os.system('${PAGER-more} '+fullname) if sts: print '*** Pager exit status:', sts break else: print 'Sorry, can\'t find the help file "pdb.doc"', print 'along the Python search path' | 25b38c89690e79e8f3bc78245b73017eed07f42e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/25b38c89690e79e8f3bc78245b73017eed07f42e/pdb.py |
"""Testing recfrom() over UDP.""" | """Testing recvfrom() over UDP.""" | def testRecvFrom(self): """Testing recfrom() over UDP.""" msg, addr = self.serv.recvfrom(len(MSG)) hostname, port = addr ##self.assertEqual(hostname, socket.gethostbyname('localhost')) self.assertEqual(msg, MSG) | dfad1a9039df367c9a403e2b777fe2690f3b5b88 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/dfad1a9039df367c9a403e2b777fe2690f3b5b88/test_socket.py |
def getdefaultlocale(envvars=('LANGUAGE', 'LC_ALL', 'LC_CTYPE', 'LANG')): | def getdefaultlocale(envvars=('LC_ALL', 'LC_CTYPE', 'LANG', 'LANGUAGE')): | def getdefaultlocale(envvars=('LANGUAGE', 'LC_ALL', 'LC_CTYPE', 'LANG')): """ Tries to determine the default locale settings and returns them as tuple (language code, encoding). According to POSIX, a program which has not called setlocale(LC_ALL, "") runs using the portable 'C' locale. Calling setlocale(LC_ALL, "") lets it use the default locale as defined by the LANG variable. Since we don't want to interfere with the current locale setting we thus emulate the behavior in the way described above. To maintain compatibility with other platforms, not only the LANG variable is tested, but a list of variables given as envvars parameter. The first found to be defined will be used. envvars defaults to the search path used in GNU gettext; it must always contain the variable name 'LANG'. Except for the code 'C', the language code corresponds to RFC 1766. code and encoding can be None in case the values cannot be determined. """ try: # check if it's supported by the _locale module import _locale code, encoding = _locale._getdefaultlocale() except (ImportError, AttributeError): pass else: # make sure the code/encoding values are valid if sys.platform == "win32" and code and code[:2] == "0x": # map windows language identifier to language name code = windows_locale.get(int(code, 0)) # ...add other platform-specific processing here, if # necessary... return code, encoding # fall back on POSIX behaviour import os lookup = os.environ.get for variable in envvars: localename = lookup(variable,None) if localename: break else: localename = 'C' return _parse_localename(localename) | f3f231f60cd59e9e1bceccde11a1997054a73113 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f3f231f60cd59e9e1bceccde11a1997054a73113/locale.py |
start += stop | start += step | def frange(start, stop, step): while start <= stop: yield start start += stop | cf4863831c729a105d31c26af14909c16f6bdbd9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/cf4863831c729a105d31c26af14909c16f6bdbd9/test_colorsys.py |
line = line.lstrip() | def _ascii_split(self, s, charset, firstline): # Attempt to split the line at the highest-level syntactic break # possible. Note that we don't have a lot of smarts about field # syntax; we just try to break on semi-colons, then whitespace. rtn = [] lines = s.splitlines() while lines: line = lines.pop(0) if firstline: maxlinelen = self._firstlinelen firstline = 0 else: line = line.lstrip() maxlinelen = self._maxlinelen # Short lines can remain unchanged if len(line.replace('\t', SPACE8)) <= maxlinelen: rtn.append(line) else: oldlen = len(line) # Try to break the line on semicolons, but if that doesn't # work, try to split on folding whitespace. while len(line) > maxlinelen: i = line.rfind(';', 0, maxlinelen) if i < 0: break rtn.append(line[:i] + ';') line = line[i+1:] # Is the remaining stuff still longer than maxlinelen? if len(line) <= maxlinelen: # Splitting on semis worked rtn.append(line) continue # Splitting on semis didn't finish the job. If it did any # work at all, stick the remaining junk on the front of the # `lines' sequence and let the next pass do its thing. if len(line) <> oldlen: lines.insert(0, line) continue # Otherwise, splitting on semis didn't help at all. parts = re.split(r'(\s+)', line) if len(parts) == 1 or (len(parts) == 3 and parts[0].endswith(':')): # This line can't be split on whitespace. There's now # little we can do to get this into maxlinelen. BAW: # We're still potentially breaking the RFC by possibly # allowing lines longer than the absolute maximum of 998 # characters. For now, let it slide. # # len(parts) will be 1 if this line has no `Field: ' # prefix, otherwise it will be len(3). rtn.append(line) continue # There is whitespace we can split on. first = parts.pop(0) sublines = [first] acc = len(first) while parts: len0 = len(parts[0]) len1 = len(parts[1]) if acc + len0 + len1 <= maxlinelen: sublines.append(parts.pop(0)) sublines.append(parts.pop(0)) acc += len0 + len1 else: # Split it here, but don't forget to ignore the # next whitespace-only part if first <> '': rtn.append(EMPTYSTRING.join(sublines)) del parts[0] first = parts.pop(0) sublines = [first] acc = len(first) rtn.append(EMPTYSTRING.join(sublines)) return [(chunk, charset) for chunk in rtn] | 45d9bde6c1053cde2a73043785778e5e0262103d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/45d9bde6c1053cde2a73043785778e5e0262103d/Header.py |
|
_keep_alive(args, memo) | def _deepcopy_inst(x, memo): if hasattr(x, '__deepcopy__'): return x.__deepcopy__(memo) if hasattr(x, '__getinitargs__'): args = x.__getinitargs__() _keep_alive(args, memo) args = deepcopy(args, memo) y = apply(x.__class__, args) else: y = _EmptyClass() y.__class__ = x.__class__ memo[id(x)] = y if hasattr(x, '__getstate__'): state = x.__getstate__() _keep_alive(state, memo) else: state = x.__dict__ state = deepcopy(state, memo) if hasattr(y, '__setstate__'): y.__setstate__(state) else: y.__dict__.update(state) return y | 611546005ba27bdaf81eb14f625fde0a362ba261 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/611546005ba27bdaf81eb14f625fde0a362ba261/copy.py |
|
_keep_alive(state, memo) | def _deepcopy_inst(x, memo): if hasattr(x, '__deepcopy__'): return x.__deepcopy__(memo) if hasattr(x, '__getinitargs__'): args = x.__getinitargs__() _keep_alive(args, memo) args = deepcopy(args, memo) y = apply(x.__class__, args) else: y = _EmptyClass() y.__class__ = x.__class__ memo[id(x)] = y if hasattr(x, '__getstate__'): state = x.__getstate__() _keep_alive(state, memo) else: state = x.__dict__ state = deepcopy(state, memo) if hasattr(y, '__setstate__'): y.__setstate__(state) else: y.__dict__.update(state) return y | 611546005ba27bdaf81eb14f625fde0a362ba261 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/611546005ba27bdaf81eb14f625fde0a362ba261/copy.py |
|
def read(self, wtd): | def read(self, totalwtd): | def read(self, wtd): | 685e16d7d64a75a3703f25888d3f192ad5c25f70 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/685e16d7d64a75a3703f25888d3f192ad5c25f70/binhex.py |
wtd = wtd - len(decdata) | wtd = totalwtd - len(decdata) | def read(self, wtd): | 685e16d7d64a75a3703f25888d3f192ad5c25f70 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/685e16d7d64a75a3703f25888d3f192ad5c25f70/binhex.py |
if filecrc != self.crc: raise Error, 'CRC error, computed %x, read %x'%(self.crc, filecrc) | def _checkcrc(self): | 685e16d7d64a75a3703f25888d3f192ad5c25f70 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/685e16d7d64a75a3703f25888d3f192ad5c25f70/binhex.py |
|
(0, 50001), RuntimeError) | (0, 50001)) | def bump_num(matchobj): int_value = int(matchobj.group(0)) return str(int_value + 1) | fa25a7d51fdc4c21ac569d9f62825e337a7a6b4a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/fa25a7d51fdc4c21ac569d9f62825e337a7a6b4a/test_sre.py |
in setRollover(). | in doRollover(). | def emit(self, record): """ Emit a record. | e21f6066574cfecbf0f5783ae924309a1afba0b0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e21f6066574cfecbf0f5783ae924309a1afba0b0/handlers.py |
self.bytecompile(outfiles) | if outfiles is not None: self.bytecompile(outfiles) | def run (self): | 3e6d43801b9d8ec5e73588f52bac660e14257160 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3e6d43801b9d8ec5e73588f52bac660e14257160/install_lib.py |
return beta * self.stdgamma(alpha) def stdgamma(self, alpha, *args): | if alpha <= 0.0 or beta <= 0.0: raise ValueError, 'gammavariate: alpha and beta must be > 0.0' | def gammavariate(self, alpha, beta): # beta times standard gamma return beta * self.stdgamma(alpha) | b760efb08d509bb2acfdef8f4e59dfafa20ca57f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b760efb08d509bb2acfdef8f4e59dfafa20ca57f/random.py |
if alpha <= 0.0: raise ValueError, 'stdgamma: alpha must be > 0.0' | def stdgamma(self, alpha, *args): # *args for Py2.2 compatiblity random = self.random if alpha <= 0.0: raise ValueError, 'stdgamma: alpha must be > 0.0' | b760efb08d509bb2acfdef8f4e59dfafa20ca57f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b760efb08d509bb2acfdef8f4e59dfafa20ca57f/random.py |
|
return x | return x * beta | def stdgamma(self, alpha, *args): # *args for Py2.2 compatiblity random = self.random if alpha <= 0.0: raise ValueError, 'stdgamma: alpha must be > 0.0' | b760efb08d509bb2acfdef8f4e59dfafa20ca57f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b760efb08d509bb2acfdef8f4e59dfafa20ca57f/random.py |
return -_log(u) | return -_log(u) * beta | def stdgamma(self, alpha, *args): # *args for Py2.2 compatiblity random = self.random if alpha <= 0.0: raise ValueError, 'stdgamma: alpha must be > 0.0' | b760efb08d509bb2acfdef8f4e59dfafa20ca57f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b760efb08d509bb2acfdef8f4e59dfafa20ca57f/random.py |
return x | return x * beta def stdgamma(self, alpha, ainv, bbb, ccc): import warnings warnings.warn("The stdgamma function is deprecated; " "use gammavariate() instead", DeprecationWarning) return self.gammavariate(alpha, 1.0) | def stdgamma(self, alpha, *args): # *args for Py2.2 compatiblity random = self.random if alpha <= 0.0: raise ValueError, 'stdgamma: alpha must be > 0.0' | b760efb08d509bb2acfdef8f4e59dfafa20ca57f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b760efb08d509bb2acfdef8f4e59dfafa20ca57f/random.py |
def _test(N=200): | def _test(N=20000): | def _test(N=200): print 'TWOPI =', TWOPI print 'LOG4 =', LOG4 print 'NV_MAGICCONST =', NV_MAGICCONST print 'SG_MAGICCONST =', SG_MAGICCONST _test_generator(N, 'random()') _test_generator(N, 'normalvariate(0.0, 1.0)') _test_generator(N, 'lognormvariate(0.0, 1.0)') _test_generator(N, 'cunifvariate(0.0, 1.0)') _test_generator(N, 'expovariate(1.0)') _test_generator(N, 'vonmisesvariate(0.0, 1.0)') _test_generator(N, 'gammavariate(0.5, 1.0)') _test_generator(N, 'gammavariate(0.9, 1.0)') _test_generator(N, 'gammavariate(1.0, 1.0)') _test_generator(N, 'gammavariate(2.0, 1.0)') _test_generator(N, 'gammavariate(20.0, 1.0)') _test_generator(N, 'gammavariate(200.0, 1.0)') _test_generator(N, 'gauss(0.0, 1.0)') _test_generator(N, 'betavariate(3.0, 3.0)') _test_generator(N, 'paretovariate(1.0)') _test_generator(N, 'weibullvariate(1.0, 1.0)') # Test jumpahead. s = getstate() jumpahead(N) r1 = random() # now do it the slow way setstate(s) for i in range(N): random() r2 = random() if r1 != r2: raise ValueError("jumpahead test failed " + `(N, r1, r2)`) | b760efb08d509bb2acfdef8f4e59dfafa20ca57f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b760efb08d509bb2acfdef8f4e59dfafa20ca57f/random.py |
SGI and Linux/BSD version.""" | SGI and generic BSD version, for when openpty() fails.""" | def master_open(): """Open pty master and return (master_fd, tty_name). SGI and Linux/BSD version.""" try: import sgi except ImportError: pass else: try: tty_name, master_fd = sgi._getpty(FCNTL.O_RDWR, 0666, 0) except IOError, msg: raise os.error, msg return master_fd, tty_name for x in 'pqrstuvwxyzPQRST': for y in '0123456789abcdef': pty_name = '/dev/pty' + x + y try: fd = os.open(pty_name, FCNTL.O_RDWR) except os.error: continue return (fd, '/dev/tty' + x + y) raise os.error, 'out of pty devices' | 8cef4cf737878bd8eec648426eebe9b9019b18be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8cef4cf737878bd8eec648426eebe9b9019b18be/pty.py |
"""Open the pty slave and acquire the controlling terminal. Return the file descriptor. Linux version.""" | """slave_open(tty_name) -> slave_fd Open the pty slave and acquire the controlling terminal, returning opened filedescriptor. Deprecated, use openpty() instead.""" | def slave_open(tty_name): """Open the pty slave and acquire the controlling terminal. Return the file descriptor. Linux version.""" # (Should be universal? --Guido) return os.open(tty_name, FCNTL.O_RDWR) | 8cef4cf737878bd8eec648426eebe9b9019b18be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8cef4cf737878bd8eec648426eebe9b9019b18be/pty.py |
"""Fork and make the child a session leader with a controlling terminal. Return (pid, master_fd).""" master_fd, tty_name = master_open() | """fork() -> (pid, master_fd) Fork and make the child a session leader with a controlling terminal.""" try: pid, fd = os.forkpty() except (AttributeError, OSError): pass else: if pid == CHILD: try: os.setsid() except OSError: pass return pid, fd master_fd, slave_fd = openpty() | def fork(): """Fork and make the child a session leader with a controlling terminal. Return (pid, master_fd).""" master_fd, tty_name = master_open() pid = os.fork() if pid == CHILD: # Establish a new session. os.setsid() # Acquire controlling terminal. slave_fd = slave_open(tty_name) os.close(master_fd) # Slave becomes stdin/stdout/stderr of child. os.dup2(slave_fd, STDIN_FILENO) os.dup2(slave_fd, STDOUT_FILENO) os.dup2(slave_fd, STDERR_FILENO) if (slave_fd > STDERR_FILENO): os.close (slave_fd) # Parent and child process. return pid, master_fd | 8cef4cf737878bd8eec648426eebe9b9019b18be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8cef4cf737878bd8eec648426eebe9b9019b18be/pty.py |
slave_fd = slave_open(tty_name) | def fork(): """Fork and make the child a session leader with a controlling terminal. Return (pid, master_fd).""" master_fd, tty_name = master_open() pid = os.fork() if pid == CHILD: # Establish a new session. os.setsid() # Acquire controlling terminal. slave_fd = slave_open(tty_name) os.close(master_fd) # Slave becomes stdin/stdout/stderr of child. os.dup2(slave_fd, STDIN_FILENO) os.dup2(slave_fd, STDOUT_FILENO) os.dup2(slave_fd, STDERR_FILENO) if (slave_fd > STDERR_FILENO): os.close (slave_fd) # Parent and child process. return pid, master_fd | 8cef4cf737878bd8eec648426eebe9b9019b18be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8cef4cf737878bd8eec648426eebe9b9019b18be/pty.py |
|
def writen(fd, data): | def _writen(fd, data): | def writen(fd, data): """Write all the data to a descriptor.""" while data != '': n = os.write(fd, data) data = data[n:] | 8cef4cf737878bd8eec648426eebe9b9019b18be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8cef4cf737878bd8eec648426eebe9b9019b18be/pty.py |
def read(fd): | def _read(fd): | def read(fd): """Default read function.""" return os.read(fd, 1024) | 8cef4cf737878bd8eec648426eebe9b9019b18be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8cef4cf737878bd8eec648426eebe9b9019b18be/pty.py |
def copy(master_fd, master_read=read, stdin_read=read): | def _copy(master_fd, master_read=_read, stdin_read=_read): | def copy(master_fd, master_read=read, stdin_read=read): """Parent copy loop. Copies pty master -> standard output (master_read) standard input -> pty master (stdin_read)""" while 1: rfds, wfds, xfds = select( [master_fd, STDIN_FILENO], [], []) if master_fd in rfds: data = master_read(master_fd) os.write(STDOUT_FILENO, data) if STDIN_FILENO in rfds: data = stdin_read(STDIN_FILENO) writen(master_fd, data) | 8cef4cf737878bd8eec648426eebe9b9019b18be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8cef4cf737878bd8eec648426eebe9b9019b18be/pty.py |
writen(master_fd, data) | _writen(master_fd, data) | def copy(master_fd, master_read=read, stdin_read=read): """Parent copy loop. Copies pty master -> standard output (master_read) standard input -> pty master (stdin_read)""" while 1: rfds, wfds, xfds = select( [master_fd, STDIN_FILENO], [], []) if master_fd in rfds: data = master_read(master_fd) os.write(STDOUT_FILENO, data) if STDIN_FILENO in rfds: data = stdin_read(STDIN_FILENO) writen(master_fd, data) | 8cef4cf737878bd8eec648426eebe9b9019b18be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8cef4cf737878bd8eec648426eebe9b9019b18be/pty.py |
s.stdin = FileWrapper(sys.stdin) s.stdout = FileWrapper(sys.stdout) s.stderr = FileWrapper(sys.stderr) sys.stdin = FileDelegate(s, 'stdin') sys.stdout = FileDelegate(s, 'stdout') sys.stderr = FileDelegate(s, 'stderr') | s.stdin = self.restricted_stdin s.stdout = self.restricted_stdout s.stderr = self.restricted_stdout sys.stdin = self.delegate_stdin sys.stdout = self.delegate_stdout sys.stderr = self.delegate_stderr def reset_files(self): self.restore_files() s = self.modules['sys'] self.restricted_stdin = s.stdin self.restricted_stdout = s.stdout self.restricted_stdout = s.stderr | def set_files(self): s = self.modules['sys'] s.stdin = FileWrapper(sys.stdin) s.stdout = FileWrapper(sys.stdout) s.stderr = FileWrapper(sys.stderr) | cd6aab91a5fb9607ba8b731f906c5738a2409384 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/cd6aab91a5fb9607ba8b731f906c5738a2409384/rexec.py |
def restore_files(files): sys.stdin = self.save_sydin | def restore_files(self): sys.stdin = self.save_stdin | def restore_files(files): | cd6aab91a5fb9607ba8b731f906c5738a2409384 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/cd6aab91a5fb9607ba8b731f906c5738a2409384/rexec.py |
"""Test whether a path is a mount point""" return isabs(splitdrive(path)[1]) | """Test whether a path is a mount point (defined as root of drive)""" p = splitdrive(path)[1] return len(p)==1 and p[0] in '/\\' | def ismount(path): """Test whether a path is a mount point""" return isabs(splitdrive(path)[1]) | ca99c2ce75ec3b64fa483e800c6739a7851b468d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ca99c2ce75ec3b64fa483e800c6739a7851b468d/ntpath.py |
del self._current_context[-1] | self._current_context = self._ns_contexts[-1] del self._ns_contexts[-1] | def endPrefixMapping(self, prefix): del self._current_context[-1] | fc643c339d5dd23e7090a3fcfb1ee92f7e5dc8e4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/fc643c339d5dd23e7090a3fcfb1ee92f7e5dc8e4/saxutils.py |
class XMLFilterBase: | class XMLFilterBase(xmlreader.XMLReader): | def processingInstruction(self, target, data): self._out.write('<?%s %s?>' % (target, data)) | fc643c339d5dd23e7090a3fcfb1ee92f7e5dc8e4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/fc643c339d5dd23e7090a3fcfb1ee92f7e5dc8e4/saxutils.py |
def ignorableWhitespace(self, chars, start, end): self._cont_handler.ignorableWhitespace(chars, start, end) | def ignorableWhitespace(self, chars): self._cont_handler.ignorableWhitespace(chars) | def ignorableWhitespace(self, chars, start, end): self._cont_handler.ignorableWhitespace(chars, start, end) | fc643c339d5dd23e7090a3fcfb1ee92f7e5dc8e4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/fc643c339d5dd23e7090a3fcfb1ee92f7e5dc8e4/saxutils.py |
def __init__ (self, verbose=0, dry_run=0, force=0): | 21664d854fe60005e3a8094e2f4f54f0b805e366 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/21664d854fe60005e3a8094e2f4f54f0b805e366/cygwinccompiler.py |
||
linker_so=('%s -mcygwin -mdll' % self.linker_dll)) | linker_so=('%s -mcygwin %s' % (self.linker_dll, shared_option))) | def __init__ (self, verbose=0, dry_run=0, force=0): | 21664d854fe60005e3a8094e2f4f54f0b805e366 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/21664d854fe60005e3a8094e2f4f54f0b805e366/cygwinccompiler.py |
linker_so='%s -mno-cygwin -mdll %s' % (self.linker_dll, entry_point)) | linker_so='%s -mno-cygwin %s %s' % (self.linker_dll, shared_option, entry_point)) | def __init__ (self, verbose=0, dry_run=0, force=0): | 21664d854fe60005e3a8094e2f4f54f0b805e366 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/21664d854fe60005e3a8094e2f4f54f0b805e366/cygwinccompiler.py |
import thread | import threading | def __init__(self, maxsize=0): """Initialize a queue object with a given maximum size. | 5af0e414822e0e5da17566e1156005df520d1ae0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5af0e414822e0e5da17566e1156005df520d1ae0/Queue.py |
import dummy_thread as thread | import dummy_threading as threading | def __init__(self, maxsize=0): """Initialize a queue object with a given maximum size. | 5af0e414822e0e5da17566e1156005df520d1ae0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5af0e414822e0e5da17566e1156005df520d1ae0/Queue.py |
self.mutex = thread.allocate_lock() self.esema = thread.allocate_lock() self.esema.acquire() self.fsema = thread.allocate_lock() | self.mutex = threading.Lock() self.not_empty = threading.Condition(self.mutex) self.not_full = threading.Condition(self.mutex) | def __init__(self, maxsize=0): """Initialize a queue object with a given maximum size. | 5af0e414822e0e5da17566e1156005df520d1ae0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5af0e414822e0e5da17566e1156005df520d1ae0/Queue.py |
if block: | if not block: return self.put_nowait(item) self.not_full.acquire() try: | def put(self, item, block=True, timeout=None): """Put an item into the queue. | 5af0e414822e0e5da17566e1156005df520d1ae0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5af0e414822e0e5da17566e1156005df520d1ae0/Queue.py |
self.fsema.acquire() elif timeout >= 0: delay = 0.0005 | while self._full(): self.not_full.wait() else: if timeout < 0: raise ValueError("'timeout' must be a positive number") | def put(self, item, block=True, timeout=None): """Put an item into the queue. | 5af0e414822e0e5da17566e1156005df520d1ae0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5af0e414822e0e5da17566e1156005df520d1ae0/Queue.py |
while True: if self.fsema.acquire(0): break | while self._full(): | def put(self, item, block=True, timeout=None): """Put an item into the queue. | 5af0e414822e0e5da17566e1156005df520d1ae0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5af0e414822e0e5da17566e1156005df520d1ae0/Queue.py |
if remaining <= 0: | if remaining < 0.0: | def put(self, item, block=True, timeout=None): """Put an item into the queue. | 5af0e414822e0e5da17566e1156005df520d1ae0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5af0e414822e0e5da17566e1156005df520d1ae0/Queue.py |
delay = min(delay * 2, remaining, .05) _sleep(delay) else: raise ValueError("'timeout' must be a positive number") elif not self.fsema.acquire(0): raise Full self.mutex.acquire() release_fsema = True try: was_empty = self._empty() | self.not_full.wait(remaining) | def put(self, item, block=True, timeout=None): """Put an item into the queue. | 5af0e414822e0e5da17566e1156005df520d1ae0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5af0e414822e0e5da17566e1156005df520d1ae0/Queue.py |
if was_empty: self.esema.release() release_fsema = not self._full() | self.not_empty.notify() | def put(self, item, block=True, timeout=None): """Put an item into the queue. | 5af0e414822e0e5da17566e1156005df520d1ae0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5af0e414822e0e5da17566e1156005df520d1ae0/Queue.py |
if release_fsema: self.fsema.release() self.mutex.release() | self.not_full.release() | def put(self, item, block=True, timeout=None): """Put an item into the queue. | 5af0e414822e0e5da17566e1156005df520d1ae0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5af0e414822e0e5da17566e1156005df520d1ae0/Queue.py |
return self.put(item, False) | self.not_full.acquire() try: if self._full(): raise Full else: self._put(item) self.not_empty.notify() finally: self.not_full.release() | def put_nowait(self, item): """Put an item into the queue without blocking. | 5af0e414822e0e5da17566e1156005df520d1ae0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5af0e414822e0e5da17566e1156005df520d1ae0/Queue.py |
if block: | if not block: return self.get_nowait() self.not_empty.acquire() try: | def get(self, block=True, timeout=None): """Remove and return an item from the queue. | 5af0e414822e0e5da17566e1156005df520d1ae0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5af0e414822e0e5da17566e1156005df520d1ae0/Queue.py |
self.esema.acquire() elif timeout >= 0: delay = 0.0005 | while self._empty(): self.not_empty.wait() else: if timeout < 0: raise ValueError("'timeout' must be a positive number") | def get(self, block=True, timeout=None): """Remove and return an item from the queue. | 5af0e414822e0e5da17566e1156005df520d1ae0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5af0e414822e0e5da17566e1156005df520d1ae0/Queue.py |
while 1: if self.esema.acquire(0): break | while self._empty(): | def get(self, block=True, timeout=None): """Remove and return an item from the queue. | 5af0e414822e0e5da17566e1156005df520d1ae0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5af0e414822e0e5da17566e1156005df520d1ae0/Queue.py |
if remaining <= 0: | if remaining < 0.0: | def get(self, block=True, timeout=None): """Remove and return an item from the queue. | 5af0e414822e0e5da17566e1156005df520d1ae0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5af0e414822e0e5da17566e1156005df520d1ae0/Queue.py |
delay = min(delay * 2, remaining, .05) _sleep(delay) else: raise ValueError("'timeout' must be a positive number") elif not self.esema.acquire(0): raise Empty self.mutex.acquire() release_esema = True try: was_full = self._full() | self.not_empty.wait(remaining) | def get(self, block=True, timeout=None): """Remove and return an item from the queue. | 5af0e414822e0e5da17566e1156005df520d1ae0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5af0e414822e0e5da17566e1156005df520d1ae0/Queue.py |
if was_full: self.fsema.release() release_esema = not self._empty() | self.not_full.notify() return item | def get(self, block=True, timeout=None): """Remove and return an item from the queue. | 5af0e414822e0e5da17566e1156005df520d1ae0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5af0e414822e0e5da17566e1156005df520d1ae0/Queue.py |
if release_esema: self.esema.release() self.mutex.release() return item | self.not_empty.release() | def get(self, block=True, timeout=None): """Remove and return an item from the queue. | 5af0e414822e0e5da17566e1156005df520d1ae0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5af0e414822e0e5da17566e1156005df520d1ae0/Queue.py |
return self.get(False) | self.not_empty.acquire() try: if self._empty(): raise Empty else: item = self._get() self.not_full.notify() return item finally: self.not_empty.release() | def get_nowait(self): """Remove and return an item from the queue without blocking. | 5af0e414822e0e5da17566e1156005df520d1ae0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5af0e414822e0e5da17566e1156005df520d1ae0/Queue.py |
buf = '' | buf = ['', ''] | def process_rawq(self): """Transfer from raw queue to cooked queue. | 1da9c57c740544fa0d2bc93949aa577b6184c8d2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1da9c57c740544fa0d2bc93949aa577b6184c8d2/telnetlib.py |
if c == theNULL: continue if c == "\021": continue if c != IAC: buf = buf + c continue c = self.rawq_getchar() if c == IAC: buf = buf + c elif c in (DO, DONT): opt = self.rawq_getchar() self.msg('IAC %s %d', c == DO and 'DO' or 'DONT', ord(opt)) if self.option_callback: self.option_callback(self.sock, c, opt) | if not self.iacseq: if c == theNULL: continue if c == "\021": continue if c != IAC: buf[self.sb] = buf[self.sb] + c continue | def process_rawq(self): """Transfer from raw queue to cooked queue. | 1da9c57c740544fa0d2bc93949aa577b6184c8d2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1da9c57c740544fa0d2bc93949aa577b6184c8d2/telnetlib.py |
self.sock.sendall(IAC + WONT + opt) elif c in (WILL, WONT): opt = self.rawq_getchar() self.msg('IAC %s %d', c == WILL and 'WILL' or 'WONT', ord(opt)) if self.option_callback: self.option_callback(self.sock, c, opt) | self.iacseq += c elif len(self.iacseq) == 1: 'IAC: IAC CMD [OPTION only for WILL/WONT/DO/DONT]' if c in (DO, DONT, WILL, WONT): self.iacseq += c continue self.iacseq = '' if c == IAC: buf[self.sb] = buf[self.sb] + c | def process_rawq(self): """Transfer from raw queue to cooked queue. | 1da9c57c740544fa0d2bc93949aa577b6184c8d2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1da9c57c740544fa0d2bc93949aa577b6184c8d2/telnetlib.py |
self.sock.sendall(IAC + DONT + opt) else: self.msg('IAC %d not recognized' % ord(c)) | if c == SB: self.sb = 1 self.sbdataq = '' elif c == SE: self.sb = 0 self.sbdataq = self.sbdataq + buf[1] buf[1] = '' if self.option_callback: self.option_callback(self.sock, c, NOOPT) else: self.msg('IAC %d not recognized' % ord(c)) elif len(self.iacseq) == 2: cmd = self.iacseq[1] self.iacseq = '' opt = c if cmd in (DO, DONT): self.msg('IAC %s %d', cmd == DO and 'DO' or 'DONT', ord(opt)) if self.option_callback: self.option_callback(self.sock, cmd, opt) else: self.sock.sendall(IAC + WONT + opt) elif cmd in (WILL, WONT): self.msg('IAC %s %d', cmd == WILL and 'WILL' or 'WONT', ord(opt)) if self.option_callback: self.option_callback(self.sock, cmd, opt) else: self.sock.sendall(IAC + DONT + opt) | def process_rawq(self): """Transfer from raw queue to cooked queue. | 1da9c57c740544fa0d2bc93949aa577b6184c8d2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1da9c57c740544fa0d2bc93949aa577b6184c8d2/telnetlib.py |
self.cookedq = self.cookedq + buf | self.cookedq = self.cookedq + buf[0] self.sbdataq = self.sbdataq + buf[1] | def process_rawq(self): """Transfer from raw queue to cooked queue. | 1da9c57c740544fa0d2bc93949aa577b6184c8d2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1da9c57c740544fa0d2bc93949aa577b6184c8d2/telnetlib.py |
for pattern in [' at 0x[0-9a-f]{6,}(>+)$', ' at [0-9A-F]{8,}(>+)$']: if re.search(pattern, repr(Exception)): return re.sub(pattern, '\\1', text) | if _re_stripid.search(repr(Exception)): return _re_stripid.sub(r'\1', text) | def stripid(text): """Remove the hexadecimal id from a Python object representation.""" # The behaviour of %p is implementation-dependent; we check two cases. for pattern in [' at 0x[0-9a-f]{6,}(>+)$', ' at [0-9A-F]{8,}(>+)$']: if re.search(pattern, repr(Exception)): return re.sub(pattern, '\\1', text) return text | c6c1f478d9236ed92312f55b0421497b4f86a302 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c6c1f478d9236ed92312f55b0421497b4f86a302/pydoc.py |
def _is_some_method(object): return inspect.ismethod(object) or inspect.ismethoddescriptor(object) | def _is_some_method(obj): return inspect.ismethod(obj) or inspect.ismethoddescriptor(obj) | def _is_some_method(object): return inspect.ismethod(object) or inspect.ismethoddescriptor(object) | c6c1f478d9236ed92312f55b0421497b4f86a302 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c6c1f478d9236ed92312f55b0421497b4f86a302/pydoc.py |
self.do_disassembly_test(bug1333982, dis_bug1333982) | if __debug__: self.do_disassembly_test(bug1333982, dis_bug1333982) | def test_bug_1333982(self): self.do_disassembly_test(bug1333982, dis_bug1333982) | 83a8c393b06d24b3c6b252b7614c34110c369c43 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/83a8c393b06d24b3c6b252b7614c34110c369c43/test_dis.py |
include_dirs = ['Modules/expat'] | include_dirs = [expatinc] | def detect_modules(self): # Ensure that /usr/local is always used add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') | 8301256a440fdd98fd500d225dac20ebb192e08f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8301256a440fdd98fd500d225dac20ebb192e08f/setup.py |
print "testing complex args" | if verbose: print "testing complex args" | exec 'def f(a): global a; a = 1' | 778e26546284f956cbf8a85a8b7a0bf28c194410 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/778e26546284f956cbf8a85a8b7a0bf28c194410/test_compile.py |
headers = {'content-type': "application/x-www-form-urlencoded"} | headers = {} if method == 'POST': headers['content-type'] = "application/x-www-form-urlencoded" | def __init__(self, fp=None, headers=None, outerboundary="", environ=os.environ, keep_blank_values=0, strict_parsing=0): """Constructor. Read multipart/* until last part. | cff311aa373c11756bbd353bfe77819f5d777598 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/cff311aa373c11756bbd353bfe77819f5d777598/cgi.py |
raise socket.error, err | raise socket.error, (err, errorcode[err]) | def connect(self, address): self.connected = False err = self.socket.connect_ex(address) # XXX Should interpret Winsock return values if err in (EINPROGRESS, EALREADY, EWOULDBLOCK): return if err in (0, EISCONN): self.addr = address self.connected = True self.handle_connect() else: raise socket.error, err | 174bdbc999e59363739b1127b0ced4fa8e25b3dc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/174bdbc999e59363739b1127b0ced4fa8e25b3dc/asyncore.py |
raise socket.error, why | raise | def accept(self): # XXX can return either an address pair or None try: conn, addr = self.socket.accept() return conn, addr except socket.error, why: if why[0] == EWOULDBLOCK: pass else: raise socket.error, why | 174bdbc999e59363739b1127b0ced4fa8e25b3dc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/174bdbc999e59363739b1127b0ced4fa8e25b3dc/asyncore.py |
raise socket.error, why | raise | def send(self, data): try: result = self.socket.send(data) return result except socket.error, why: if why[0] == EWOULDBLOCK: return 0 else: raise socket.error, why return 0 | 174bdbc999e59363739b1127b0ced4fa8e25b3dc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/174bdbc999e59363739b1127b0ced4fa8e25b3dc/asyncore.py |
raise socket.error, why | raise | def recv(self, buffer_size): try: data = self.socket.recv(buffer_size) if not data: # a closed connection is indicated by signaling # a read condition, and having recv() return 0. self.handle_close() return '' else: return data except socket.error, why: # winsock sometimes throws ENOTCONN if why[0] in [ECONNRESET, ENOTCONN, ESHUTDOWN]: self.handle_close() return '' else: raise socket.error, why | 174bdbc999e59363739b1127b0ced4fa8e25b3dc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/174bdbc999e59363739b1127b0ced4fa8e25b3dc/asyncore.py |
replacement = convert_entityref(name) | replacement = self.convert_entityref(name) | def handle_entityref(self, name): """Handle entity references, no need to override.""" replacement = convert_entityref(name) if replacement is None: self.unknown_entityref(name) else: self.handle_data(convert_entityref(name)) | 541660553d646db451655c0f79640f0b8f64baad /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/541660553d646db451655c0f79640f0b8f64baad/sgmllib.py |
self.handle_data(convert_entityref(name)) | self.handle_data(self.convert_entityref(name)) | def handle_entityref(self, name): """Handle entity references, no need to override.""" replacement = convert_entityref(name) if replacement is None: self.unknown_entityref(name) else: self.handle_data(convert_entityref(name)) | 541660553d646db451655c0f79640f0b8f64baad /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/541660553d646db451655c0f79640f0b8f64baad/sgmllib.py |
suffix = ['.html', '.txt'][self.format=="html"] | suffix = ['.txt', '.html'][self.format=="html"] | def handle(self, info=None): info = info or sys.exc_info() if self.format == "html": self.file.write(reset()) | 30633c9a6423459cdd481a6e44954d5933c7842b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/30633c9a6423459cdd481a6e44954d5933c7842b/cgitb.py |
":build.macppc.shared:PythonCore.", | ":build.macppc.shared:PythonCorePPC.", | def buildapplet(top, dummy, list): """Create a PPC python applet""" template = mkapplet.findtemplate() for src in list: if src[-3:] != '.py': raise 'Should end in .py', src base = os.path.basename(src) dst = os.path.join(top, base)[:-3] src = os.path.join(top, src) try: os.unlink(dst) except os.error: pass print 'Building applet', dst mkapplet.process(template, src, dst) | 057971528d37cbb45d80d7d16fdfe890e3bd356e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/057971528d37cbb45d80d7d16fdfe890e3bd356e/fullbuild.py |
":build.macppc.shared:PythonApplet.", | ":build.macppc.shared:PythonAppletPPC.", | def buildapplet(top, dummy, list): """Create a PPC python applet""" template = mkapplet.findtemplate() for src in list: if src[-3:] != '.py': raise 'Should end in .py', src base = os.path.basename(src) dst = os.path.join(top, base)[:-3] src = os.path.join(top, src) try: os.unlink(dst) except os.error: pass print 'Building applet', dst mkapplet.process(template, src, dst) | 057971528d37cbb45d80d7d16fdfe890e3bd356e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/057971528d37cbb45d80d7d16fdfe890e3bd356e/fullbuild.py |
":PlugIns:ctbmodule.ppc.", | ":PlugIns:ctb.ppc.", | def buildapplet(top, dummy, list): """Create a PPC python applet""" template = mkapplet.findtemplate() for src in list: if src[-3:] != '.py': raise 'Should end in .py', src base = os.path.basename(src) dst = os.path.join(top, base)[:-3] src = os.path.join(top, src) try: os.unlink(dst) except os.error: pass print 'Building applet', dst mkapplet.process(template, src, dst) | 057971528d37cbb45d80d7d16fdfe890e3bd356e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/057971528d37cbb45d80d7d16fdfe890e3bd356e/fullbuild.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.