rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
response = xmlrpclib.dumps(response, methodresponse=1)
response = xmlrpclib.dumps(response, methodresponse=1, allow_none = self.allow_none)
def _marshaled_dispatch(self, data, dispatch_method = None): """Dispatches an XML-RPC method from marshalled (XML) data.
44fa98d1ff28f6996bb6ec8ada530657e180b1c0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/44fa98d1ff28f6996bb6ec8ada530657e180b1c0/SimpleXMLRPCServer.py
logRequests=1):
logRequests=1, allow_none=False):
def __init__(self, addr, requestHandler=SimpleXMLRPCRequestHandler, logRequests=1): self.logRequests = logRequests
44fa98d1ff28f6996bb6ec8ada530657e180b1c0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/44fa98d1ff28f6996bb6ec8ada530657e180b1c0/SimpleXMLRPCServer.py
SimpleXMLRPCDispatcher.__init__(self)
SimpleXMLRPCDispatcher.__init__(self, allow_none)
def __init__(self, addr, requestHandler=SimpleXMLRPCRequestHandler, logRequests=1): self.logRequests = logRequests
44fa98d1ff28f6996bb6ec8ada530657e180b1c0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/44fa98d1ff28f6996bb6ec8ada530657e180b1c0/SimpleXMLRPCServer.py
def __init__(self): SimpleXMLRPCDispatcher.__init__(self)
def __init__(self, allow_none=False): SimpleXMLRPCDispatcher.__init__(self, allow_none)
def __init__(self): SimpleXMLRPCDispatcher.__init__(self)
44fa98d1ff28f6996bb6ec8ada530657e180b1c0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/44fa98d1ff28f6996bb6ec8ada530657e180b1c0/SimpleXMLRPCServer.py
if value is not None and value != 'C':
if value not in (None, '', 'C'):
def setlocale(category, value=None): """ setlocale(integer,string=None) -> string. Activates/queries locale processing. """ if value is not None and value != 'C': raise Error, '_locale emulation only supports "C" locale' return 'C'
f13251864876b44e9037b52868b90eb2df13afbe /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f13251864876b44e9037b52868b90eb2df13afbe/locale.py
parts = resp[left+1].split(resp[left + 1:right])
parts = resp[left + 1:right].split(resp[left+1])
def parse229(resp, peer): '''Parse the '229' response for a EPSV request. Raises error_proto if it does not contain '(|||port|)' Return ('host.addr.as.numbers', port#) tuple.''' if resp[:3] <> '229': raise error_reply, resp left = resp.find('(') if left < 0: raise error_proto, resp right = resp.find(')', left + 1) if right < 0: raise error_proto, resp # should contain '(|||port|)' if resp[left + 1] <> resp[right - 1]: raise error_proto, resp parts = resp[left+1].split(resp[left + 1:right]) if len(parts) <> 5: raise error_proto, resp host = peer[0] port = int(parts[3]) return host, port
13468b1ef945b0570eec3d1d630ac3e8a78c0f32 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/13468b1ef945b0570eec3d1d630ac3e8a78c0f32/ftplib.py
def _read_eof(self): # We've read to the end of the file, so we have to rewind in order # to reread the 8 bytes containing the CRC and the file size. # We check the that the computed CRC and size of the # uncompressed data matches the stored values. self.fileobj.seek(-8, 1) crc32 = read32(self.fileobj) isize = U32(read32(self.fileobj)) # may exceed 2GB if U32(crc32) != U32(self.crc): raise ValueError, "CRC check failed" elif isize != self.size: raise ValueError, "Incorrect length of data produced"
d6ad56784fff03262669945b5e9b0ecb41948b2c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d6ad56784fff03262669945b5e9b0ecb41948b2c/gzip.py
elif isize != self.size:
elif isize != LOWU32(self.size):
def _read_eof(self): # We've read to the end of the file, so we have to rewind in order # to reread the 8 bytes containing the CRC and the file size. # We check the that the computed CRC and size of the # uncompressed data matches the stored values. self.fileobj.seek(-8, 1) crc32 = read32(self.fileobj) isize = U32(read32(self.fileobj)) # may exceed 2GB if U32(crc32) != U32(self.crc): raise ValueError, "CRC check failed" elif isize != self.size: raise ValueError, "Incorrect length of data produced"
d6ad56784fff03262669945b5e9b0ecb41948b2c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d6ad56784fff03262669945b5e9b0ecb41948b2c/gzip.py
write32u(self.fileobj, self.size)
write32u(self.fileobj, LOWU32(self.size))
def close(self): if self.mode == WRITE: self.fileobj.write(self.compress.flush()) write32(self.fileobj, self.crc) # self.size may exceed 2GB write32u(self.fileobj, self.size) self.fileobj = None elif self.mode == READ: self.fileobj = None if self.myfileobj: self.myfileobj.close() self.myfileobj = None
d6ad56784fff03262669945b5e9b0ecb41948b2c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d6ad56784fff03262669945b5e9b0ecb41948b2c/gzip.py
while args and args[0][:1] == '-' and args[0] != '-':
while args and args[0].startswith('-') and args[0] != '-':
def getopt(args, shortopts, longopts = []): """getopt(args, options[, long_options]) -> opts, args Parses command line options and parameter list. args is the argument list to be parsed, without the leading reference to the running program. Typically, this means "sys.argv[1:]". shortopts is the string of option letters that the script wants to recognize, with options that require an argument followed by a colon (i.e., the same format that Unix getopt() uses). If specified, longopts is a list of strings with the names of the long options which should be supported. The leading '--' characters should not be included in the option name. Options which require an argument should be followed by an equal sign ('='). The return value consists of two elements: the first is a list of (option, value) pairs; the second is the list of program arguments left after the option list was stripped (this is a trailing slice of the first argument). Each option-and-value pair returned has the option as its first element, prefixed with a hyphen (e.g., '-x'), and the option argument as its second element, or an empty string if the option has no argument. The options occur in the list in the same order in which they were found, thus allowing multiple occurrences. Long and short options may be mixed. """ opts = [] if type(longopts) == type(""): longopts = [longopts] else: longopts = list(longopts) longopts.sort() while args and args[0][:1] == '-' and args[0] != '-': if args[0] == '--': args = args[1:] break if args[0][:2] == '--': opts, args = do_longs(opts, args[0][2:], longopts, args[1:]) else: opts, args = do_shorts(opts, args[0][1:], shortopts, args[1:]) return opts, args
0cfea82f908f5cc2d63275c121751444abc5fc2a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/0cfea82f908f5cc2d63275c121751444abc5fc2a/getopt.py
opt, optarg = opt[:i], opt[i+1:]
def do_longs(opts, opt, longopts, args): try: i = opt.index('=') opt, optarg = opt[:i], opt[i+1:] except ValueError: optarg = None has_arg, opt = long_has_args(opt, longopts) if has_arg: if optarg is None: if not args: raise GetoptError('option --%s requires argument' % opt, opt) optarg, args = args[0], args[1:] elif optarg: raise GetoptError('option --%s must not have an argument' % opt, opt) opts.append(('--' + opt, optarg or '')) return opts, args
0cfea82f908f5cc2d63275c121751444abc5fc2a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/0cfea82f908f5cc2d63275c121751444abc5fc2a/getopt.py
optlen = len(opt)
def long_has_args(opt, longopts): optlen = len(opt) for i in range(len(longopts)): x, y = longopts[i][:optlen], longopts[i][optlen:] if opt != x: continue if y != '' and y != '=' and i+1 < len(longopts): if opt == longopts[i+1][:optlen]: raise GetoptError('option --%s not a unique prefix' % opt, opt) if longopts[i][-1:] in ('=', ): return 1, longopts[i][:-1] return 0, longopts[i] raise GetoptError('option --%s not recognized' % opt, opt)
0cfea82f908f5cc2d63275c121751444abc5fc2a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/0cfea82f908f5cc2d63275c121751444abc5fc2a/getopt.py
x, y = longopts[i][:optlen], longopts[i][optlen:] if opt != x: continue if y != '' and y != '=' and i+1 < len(longopts): if opt == longopts[i+1][:optlen]: raise GetoptError('option --%s not a unique prefix' % opt, opt) if longopts[i][-1:] in ('=', ): return 1, longopts[i][:-1] return 0, longopts[i] raise GetoptError('option --%s not recognized' % opt, opt)
if longopts[i].startswith(opt): break else: raise GetoptError('option --%s not recognized' % opt, opt) j = i+1 while j < len(longopts) and longopts[j].startswith(opt): j += 1 possibilities = longopts[i:j] if opt in possibilities: return 0, opt elif opt + '=' in possibilities: return 1, opt if len(possibilities) > 1: raise GetoptError('option --%s not a unique prefix' % opt, opt) assert len(possibilities) == 1 unique_match = possibilities[0] has_arg = unique_match.endswith('=') if has_arg: unique_match = unique_match[:-1] return has_arg, unique_match
def long_has_args(opt, longopts): optlen = len(opt) for i in range(len(longopts)): x, y = longopts[i][:optlen], longopts[i][optlen:] if opt != x: continue if y != '' and y != '=' and i+1 < len(longopts): if opt == longopts[i+1][:optlen]: raise GetoptError('option --%s not a unique prefix' % opt, opt) if longopts[i][-1:] in ('=', ): return 1, longopts[i][:-1] return 0, longopts[i] raise GetoptError('option --%s not recognized' % opt, opt)
0cfea82f908f5cc2d63275c121751444abc5fc2a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/0cfea82f908f5cc2d63275c121751444abc5fc2a/getopt.py
def readline(self, size=None, keepends=True):
f14668eaa9789aa3009285595bef9d01cf8f2cb3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f14668eaa9789aa3009285595bef9d01cf8f2cb3/codecs.py
def readline(self, size=None, keepends=True):
f14668eaa9789aa3009285595bef9d01cf8f2cb3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f14668eaa9789aa3009285595bef9d01cf8f2cb3/codecs.py
while True:
while 1:
def normalvariate(self, mu, sigma): """Normal distribution.
4aa9408036856a9acf52e0804055e17317b4e3e6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4aa9408036856a9acf52e0804055e17317b4e3e6/random.py
while True:
while 1:
def vonmisesvariate(self, mu, kappa): """Circular data distribution.
4aa9408036856a9acf52e0804055e17317b4e3e6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4aa9408036856a9acf52e0804055e17317b4e3e6/random.py
if not (u2 >= c * (2.0 - c) and u2 > c * _exp(1.0 - c)):
if u2 < c * (2.0 - c) or u2 <= c * _exp(1.0 - c):
def vonmisesvariate(self, mu, kappa): """Circular data distribution.
4aa9408036856a9acf52e0804055e17317b4e3e6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4aa9408036856a9acf52e0804055e17317b4e3e6/random.py
while True:
while 1:
def gammavariate(self, alpha, beta): """Gamma distribution. Not the gamma function!
4aa9408036856a9acf52e0804055e17317b4e3e6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4aa9408036856a9acf52e0804055e17317b4e3e6/random.py
while True:
while 1:
def gammavariate(self, alpha, beta): """Gamma distribution. Not the gamma function!
4aa9408036856a9acf52e0804055e17317b4e3e6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4aa9408036856a9acf52e0804055e17317b4e3e6/random.py
x = pow(p, 1.0/alpha)
x = p ** (1.0/alpha)
def gammavariate(self, alpha, beta): """Gamma distribution. Not the gamma function!
4aa9408036856a9acf52e0804055e17317b4e3e6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4aa9408036856a9acf52e0804055e17317b4e3e6/random.py
def gammavariate(self, alpha, beta): """Gamma distribution. Not the gamma function!
4aa9408036856a9acf52e0804055e17317b4e3e6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4aa9408036856a9acf52e0804055e17317b4e3e6/random.py
if not (((p <= 1.0) and (u1 > _exp(-x))) or ((p > 1) and (u1 > pow(x, alpha - 1.0)))):
if p > 1.0: if u1 <= x ** (alpha - 1.0): break elif u1 <= _exp(-x):
def gammavariate(self, alpha, beta): """Gamma distribution. Not the gamma function!
4aa9408036856a9acf52e0804055e17317b4e3e6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4aa9408036856a9acf52e0804055e17317b4e3e6/random.py
data += self.sslobj.read(len(data)-size)
data += self.sslobj.read(size-len(data))
def read(self, size): """Read 'size' bytes from remote.""" # sslobj.read() sometimes returns < size bytes data = self.sslobj.read(size) while len(data) < size: data += self.sslobj.read(len(data)-size)
347e75c3bc74fc55bc616ac9124e38fbeeddc326 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/347e75c3bc74fc55bc616ac9124e38fbeeddc326/imaplib.py
expected = compile(str, "<input>", symbol, PyCF_DONT_IMPLY_DEDENT) self.assertEquals( compile_command(str, "<input>", symbol), expected)
if is_jython: code = compile_command(str, "<input>", symbol) self.assert_(code) if symbol == "single": d,r = {},{} sys.stdout = cStringIO.StringIO() try: exec code in d exec compile(str,"<input>","single") in r finally: sys.stdout = sys.__stdout__ elif symbol == 'eval': ctx = {'a': 2} d = { 'value': eval(code,ctx) } r = { 'value': eval(str,ctx) } self.assertEquals(unify_callables(r),unify_callables(d)) else: expected = compile(str, "<input>", symbol, PyCF_DONT_IMPLY_DEDENT) self.assertEquals( compile_command(str, "<input>", symbol), expected)
def assertValid(self, str, symbol='single'): '''succeed iff str is a valid piece of code''' expected = compile(str, "<input>", symbol, PyCF_DONT_IMPLY_DEDENT) self.assertEquals( compile_command(str, "<input>", symbol), expected)
a64d01b7cb50715cfc5a4c672963f1f948661451 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a64d01b7cb50715cfc5a4c672963f1f948661451/test_codeop.py
self.assertEquals(compile_command(""), compile("pass", "<input>", 'single', PyCF_DONT_IMPLY_DEDENT))
av("a = 9+ \\\n3")
av("def x():\n pass\n")
a64d01b7cb50715cfc5a4c672963f1f948661451 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a64d01b7cb50715cfc5a4c672963f1f948661451/test_codeop.py
ai("def x():\n")
ai("def x():\n")
a64d01b7cb50715cfc5a4c672963f1f948661451 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a64d01b7cb50715cfc5a4c672963f1f948661451/test_codeop.py
ai("a = (")
ai("if 1:") ai("if 1:\n") ai("if 1:\n pass\n if 1:\n pass\n else:") ai("if 1:\n pass\n if 1:\n pass\n else:\n") ai("if 1:\n pass\n if 1:\n pass\n else:\n pass") ai("def x():") ai("def x():\n") ai("def x():\n\n") ai("def x():\n pass") ai("def x():\n pass\n ") ai("def x():\n pass\n ") ai("\n\ndef x():\n pass")
ai("def x():\n")
a64d01b7cb50715cfc5a4c672963f1f948661451 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a64d01b7cb50715cfc5a4c672963f1f948661451/test_codeop.py
elif ord(c) < 32 or c in ' "*+,:;<=>?[]|':
elif ord(c) < 32 or c in ' ",:;<=>':
def normcase(s): res, s = splitdrive(s) for c in s: if c in '/\\': res = res + os.sep elif c == '.' and res[-1:] == os.sep: res = res + mapchar + c elif ord(c) < 32 or c in ' "*+,:;<=>?[]|': if res[-1:] != mapchar: res = res + mapchar else: res = res + c return string.lower(res)
33afa5d0754f796a4cac06b3c02489dccc16c4d5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/33afa5d0754f796a4cac06b3c02489dccc16c4d5/dospath.py
def redirect_request(self, req, fp, code, msg, headers):
def redirect_request(self, req, fp, code, msg, headers, newurl):
def redirect_request(self, req, fp, code, msg, headers): """Return a Request or None in response to a redirect.
d361e79ac280ef780e990c7694a0fefc3907b0aa /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d361e79ac280ef780e990c7694a0fefc3907b0aa/urllib2.py
if "location" in headers: newurl = headers["location"] elif "uri" in headers: newurl = headers["uri"] else: return newurl = urlparse.urljoin(req.get_full_url(), newurl)
def redirect_request(self, req, fp, code, msg, headers): """Return a Request or None in response to a redirect.
d361e79ac280ef780e990c7694a0fefc3907b0aa /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d361e79ac280ef780e990c7694a0fefc3907b0aa/urllib2.py
new = self.redirect_request(req, fp, code, msg, headers)
new = self.redirect_request(req, fp, code, msg, headers, newurl)
def http_error_302(self, req, fp, code, msg, headers): if 'location' in headers: newurl = headers['location'] elif 'uri' in headers: newurl = headers['uri'] else: return newurl = urlparse.urljoin(req.get_full_url(), newurl)
d361e79ac280ef780e990c7694a0fefc3907b0aa /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d361e79ac280ef780e990c7694a0fefc3907b0aa/urllib2.py
map(lambda t: apply(priDB.put, t), ProductIndex)
map(lambda t, priDB=priDB: apply(priDB.put, t), ProductIndex)
def test01_join(self): if verbose: print '\n', '-=' * 30 print "Running %s.test01_join..." % \ self.__class__.__name__
09268e2dda09c8a04a5a0e3e38fca3bc70b2b5fd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/09268e2dda09c8a04a5a0e3e38fca3bc70b2b5fd/test_join.py
map(lambda t: apply(secDB.put, t), ColorIndex)
map(lambda t, secDB=secDB: apply(secDB.put, t), ColorIndex)
def test01_join(self): if verbose: print '\n', '-=' * 30 print "Running %s.test01_join..." % \ self.__class__.__name__
09268e2dda09c8a04a5a0e3e38fca3bc70b2b5fd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/09268e2dda09c8a04a5a0e3e38fca3bc70b2b5fd/test_join.py
finalized. This gives provides the opportunity to sneak option
finalized. This provides the opportunity to sneak option
def reinitialize_command (self, command): """Reinitializes a command to the state it was in when first returned by 'get_command_obj()': ie., initialized but not yet finalized. This gives provides the opportunity to sneak option values in programmatically, overriding or supplementing user-supplied values from the config files and command line. You'll have to re-finalize the command object (by calling 'finalize_options()' or 'ensure_finalized()') before using it for real.
5a828ec7e353934b794d47b2912af37a023cb717 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5a828ec7e353934b794d47b2912af37a023cb717/dist.py
self.text = text = Text(text_frame, name='text', padx=5, wrap=None,
self.text = text = Text(text_frame, name='text', padx=5, wrap='none',
def __init__(self, flist=None, filename=None, key=None, root=None): currentTheme=idleConf.CurrentTheme() self.flist = flist root = root or flist.root self.root = root self.menubar = Menu(root) self.top = top = self.Toplevel(root, menu=self.menubar) if flist: self.vars = flist.vars #self.top.instanceDict makes flist.inversedict avalable to #configDialog.py so it can access all EditorWindow instaces self.top.instanceDict=flist.inversedict self.recentFilesPath=os.path.join(idleConf.GetUserCfgDir(), 'recent-files.lst') self.break_set = False self.vbar = vbar = Scrollbar(top, name='vbar') self.text_frame = text_frame = Frame(top) self.text = text = Text(text_frame, name='text', padx=5, wrap=None, foreground=idleConf.GetHighlight(currentTheme, 'normal',fgBg='fg'), background=idleConf.GetHighlight(currentTheme, 'normal',fgBg='bg'), highlightcolor=idleConf.GetHighlight(currentTheme, 'hilite',fgBg='fg'), highlightbackground=idleConf.GetHighlight(currentTheme, 'hilite',fgBg='bg'), insertbackground=idleConf.GetHighlight(currentTheme, 'cursor',fgBg='fg'), width=idleConf.GetOption('main','EditorWindow','width'), height=idleConf.GetOption('main','EditorWindow','height') )
824a01c2e7258ff5cc4a1cb903d6132c835304dd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/824a01c2e7258ff5cc4a1cb903d6132c835304dd/EditorWindow.py
return self.data.has_key(ref(key))
try: wr = ref(key) except TypeError: return 0 return self.data.has_key(wr)
def has_key(self, key): return self.data.has_key(ref(key))
b411aaaf0c12add5faa2a232130a7a0b74baae0b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b411aaaf0c12add5faa2a232130a7a0b74baae0b/weakref.py
MIN_SQLITE_VERSION = 3002002
MIN_SQLITE_VERSION_NUMBER = 3000008 MIN_SQLITE_VERSION = "3.0.8"
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')
e74050d3f53766077e1042cd40c6a54dca9cec42 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e74050d3f53766077e1042cd40c6a54dca9cec42/setup.py
if db_setup_debug: print "found %s"%f
if sqlite_setup_debug: print "sqlite: found %s"%f
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')
e74050d3f53766077e1042cd40c6a54dca9cec42 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e74050d3f53766077e1042cd40c6a54dca9cec42/setup.py
if sqlite_version >= MIN_SQLITE_VERSION:
if sqlite_version >= MIN_SQLITE_VERSION_NUMBER:
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')
e74050d3f53766077e1042cd40c6a54dca9cec42 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e74050d3f53766077e1042cd40c6a54dca9cec42/setup.py
if db_setup_debug:
if sqlite_setup_debug:
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')
e74050d3f53766077e1042cd40c6a54dca9cec42 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e74050d3f53766077e1042cd40c6a54dca9cec42/setup.py
def grid_location(self, x, y): """Return a tuple of column and row which identify the cell at which the pixel at position X and Y inside the master widget is located.""" return self._getints( self.tk.call( 'grid', 'location', self._w, x, y)) or None location = grid_location
location = grid_location = Misc.grid_location
def grid_location(self, x, y): """Return a tuple of column and row which identify the cell at which the pixel at position X and Y inside the master widget is located.""" return self._getints( self.tk.call( 'grid', 'location', self._w, x, y)) or None
d9445eda28dd2b7dffaa35eb6abc6c10eaa02457 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9445eda28dd2b7dffaa35eb6abc6c10eaa02457/Tkinter.py
gl.RGBmode() gl.gconfig()
self.set_rgbmode()
def initcolormap(self): self.colormapinited = 1 self.color0 = None self.fixcolor0 = 0 if self.format in ('rgb', 'jpeg', 'compress'): self.set_rgbmode() gl.RGBcolor(200, 200, 200) # XXX rather light grey gl.clear() return # This only works on an Entry-level Indigo from IRIX 4.0.5 if self.format == 'rgb8' and is_entry_indigo() and \ gl.gversion() == 'GL4DLG-4.0.': # Note trailing '.'! gl.RGBmode() gl.gconfig() gl.RGBcolor(200, 200, 200) # XXX rather light grey gl.clear() gl.pixmode(GL.PM_SIZE, 8) return self.set_cmode() self.skipchrom = 0 if self.offset == 0: self.mask = 0x7ff else: self.mask = 0xfff if not self.quiet: sys.stderr.write('Initializing color map...') self._initcmap() gl.clear() if not self.quiet: sys.stderr.write(' Done.\n')
18437736c8bbcbb52f49fec00fd4e2e6090ca3a5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/18437736c8bbcbb52f49fec00fd4e2e6090ca3a5/VFile.py
gl.mapcolor(index, r, g, b)
map.append(index, r, g, b)
def _initcmap(self): if self.format in ('mono', 'grey4') and self.mustunpack: convcolor = conv_grey else: convcolor = choose_conversion(self.format) maxbits = gl.getgdesc(GL.GD_BITS_NORM_SNG_CMODE) if maxbits > 11: maxbits = 11 c0bits = self.c0bits c1bits = self.c1bits c2bits = self.c2bits if c0bits+c1bits+c2bits > maxbits: if self.fallback and c0bits < maxbits: # Cannot display frames in this mode, use grey self.skipchrom = 1 c1bits = c2bits = 0 convcolor = choose_conversion('grey') else: raise Error, 'Sorry, '+`maxbits`+ \ ' bits max on this machine' maxc0 = 1 << c0bits maxc1 = 1 << c1bits maxc2 = 1 << c2bits if self.offset == 0 and maxbits == 11: offset = 2048 else: offset = self.offset if maxbits <> 11: offset = offset & ((1<<maxbits)-1) self.color0 = None self.fixcolor0 = 0 for c0 in range(maxc0): c0v = c0/float(maxc0-1) for c1 in range(maxc1): if maxc1 == 1: c1v = 0 else: c1v = c1/float(maxc1-1) for c2 in range(maxc2): if maxc2 == 1: c2v = 0 else: c2v = c2/float(maxc2-1) index = offset + c0 + (c1<<c0bits) + \ (c2 << (c0bits+c1bits)) if index < MAXMAP: rv, gv, bv = \ convcolor(c0v, c1v, c2v) r, g, b = int(rv*255.0), \ int(gv*255.0), \ int(bv*255.0) gl.mapcolor(index, r, g, b) if self.color0 == None: self.color0 = \ index, r, g, b # Permanently make the first color index current gl.color(self.color0[0]) gl.gflush() # send the colormap changes to the X server
18437736c8bbcbb52f49fec00fd4e2e6090ca3a5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/18437736c8bbcbb52f49fec00fd4e2e6090ca3a5/VFile.py
lookup = getattr(self, "handle_"+condition) elif condition in ["response", "request"]:
lookup = self.handle_open elif condition == "response":
def add_handler(self, handler): added = False for meth in dir(handler): i = meth.find("_") protocol = meth[:i] condition = meth[i+1:]
06aac9cdbe1a7667f6186a6f21e135f7be772421 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/06aac9cdbe1a7667f6186a6f21e135f7be772421/urllib2.py
lookup = getattr(self, "process_"+condition)
lookup = self.process_response elif condition == "request": kind = protocol lookup = self.process_request
def add_handler(self, handler): added = False for meth in dir(handler): i = meth.find("_") protocol = meth[:i] condition = meth[i+1:]
06aac9cdbe1a7667f6186a6f21e135f7be772421 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/06aac9cdbe1a7667f6186a6f21e135f7be772421/urllib2.py
print sys.exc_value
def test(name, input, output): f = getattr(strop, name) try: value = f(input) except: value = sys.exc_type print sys.exc_value if value != output: print f, `input`, `output`, `value`
6afe6e88b58e54687291253e42c039c81ad14347 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/6afe6e88b58e54687291253e42c039c81ad14347/test_strop.py
def getresponse(self): "Get the response from the server."
bbc63bac054b072bdb5d737ab7608c3ffb4ee395 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/bbc63bac054b072bdb5d737ab7608c3ffb4ee395/httplib.py
def __init__(self): self.data = {} def __repr__(self): return repr(self.data) def __cmp__(self, dict): if type(dict) == type(self.data): return cmp(self.data, dict) else: return cmp(self.data, dict.data) def __len__(self): return len(self.data) def __getitem__(self, key): return self.data[key] def __setitem__(self, key, item): self.data[key] = item def __delitem__(self, key): del self.data[key] def clear(self): return self.data.clear() def copy(self): if self.__class__ is UserDict: new = UserDict() new.dict = self.data.copy() else: new = self.__class__() for k, v in self.items(): new[k] = v return new def keys(self): return self.data.keys() def items(self): return self.data.items() def values(self): return self.data.values() def has_key(self, key): return self.data.has_key(key) def update(self, other): if type(other) is type(self.data): self.data.update(other) else: for k, v in other.items(): self.data[k] = v
def __init__(self): self.data = {} def __repr__(self): return repr(self.data) def __cmp__(self, dict): if type(dict) == type(self.data): return cmp(self.data, dict) else: return cmp(self.data, dict.data) def __len__(self): return len(self.data) def __getitem__(self, key): return self.data[key] def __setitem__(self, key, item): self.data[key] = item def __delitem__(self, key): del self.data[key] def clear(self): return self.data.clear() def copy(self): import copy return copy.copy(self) def keys(self): return self.data.keys() def items(self): return self.data.items() def values(self): return self.data.values() def has_key(self, key): return self.data.has_key(key) def update(self, other): if type(other) is type(self.data): self.data.update(other) else: for k, v in other.items(): self.data[k] = v
def __init__(self): self.data = {}
7c5ed6c136f805b7d459cf38cf2ef8180dd68871 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/7c5ed6c136f805b7d459cf38cf2ef8180dd68871/UserDict.py
def detect_tkinter(self, inc_dirs, lib_dirs): # The _tkinter module.
21342bf57506ae69bd7f85b12ff62a00a1bf8b24 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/21342bf57506ae69bd7f85b12ff62a00a1bf8b24/setup.py
debian_tcl_include = [ '/usr/include/tcl' + version ] debian_tk_include = [ '/usr/include/tk' + version ] + \ debian_tcl_include tcl_includes = find_file('tcl.h', inc_dirs, debian_tcl_include) tk_includes = find_file('tk.h', inc_dirs, debian_tk_include)
dotversion = version if '.' not in dotversion and "bsd" in sys.platform.lower(): dotversion = dotversion[:-1] + '.' + dotversion[-1] tcl_include_sub = [] tk_include_sub = [] for dir in inc_dirs: tcl_include_sub += [dir + os.sep + "tcl" + dotversion] tk_include_sub += [dir + os.sep + "tk" + dotversion] tk_include_sub += tcl_include_sub tcl_includes = find_file('tcl.h', inc_dirs, tcl_include_sub) tk_includes = find_file('tk.h', inc_dirs, tk_include_sub)
def detect_tkinter(self, inc_dirs, lib_dirs): # The _tkinter module.
21342bf57506ae69bd7f85b12ff62a00a1bf8b24 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/21342bf57506ae69bd7f85b12ff62a00a1bf8b24/setup.py
self.announce("INFO: Can't locate Tcl/Tk libs and/or headers", 2)
def detect_tkinter(self, inc_dirs, lib_dirs): # The _tkinter module.
21342bf57506ae69bd7f85b12ff62a00a1bf8b24 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/21342bf57506ae69bd7f85b12ff62a00a1bf8b24/setup.py
self.formatter.end_paragraph(0)
self.formatter.end_paragraph(1)
def end_blockquote(self): self.formatter.end_paragraph(0) self.formatter.pop_margin()
20b35690ee3c685b26abc9a7ddc1fe028abe1f31 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/20b35690ee3c685b26abc9a7ddc1fe028abe1f31/htmllib.py
self.formatter.end_paragraph(0)
self.formatter.end_paragraph(1)
def start_dl(self, attrs): self.formatter.end_paragraph(0) self.list_stack.append(['dl', '', 0])
20b35690ee3c685b26abc9a7ddc1fe028abe1f31 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/20b35690ee3c685b26abc9a7ddc1fe028abe1f31/htmllib.py
self.ddpop()
self.ddpop(1)
def end_dl(self): self.ddpop() if self.list_stack: del self.list_stack[-1]
20b35690ee3c685b26abc9a7ddc1fe028abe1f31 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/20b35690ee3c685b26abc9a7ddc1fe028abe1f31/htmllib.py
def ddpop(self): self.formatter.end_paragraph(0)
def ddpop(self, bl=0): self.formatter.end_paragraph(bl)
def ddpop(self): self.formatter.end_paragraph(0) if self.list_stack: if self.list_stack[-1][0] == 'dd':
20b35690ee3c685b26abc9a7ddc1fe028abe1f31 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/20b35690ee3c685b26abc9a7ddc1fe028abe1f31/htmllib.py
def start_string(self, attrs): self.start_b(attrs) def end_b(self): self.end_b()
def start_strong(self, attrs): self.start_b(attrs) def end_strong(self): self.end_b()
def start_string(self, attrs): self.start_b(attrs)
20b35690ee3c685b26abc9a7ddc1fe028abe1f31 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/20b35690ee3c685b26abc9a7ddc1fe028abe1f31/htmllib.py
def end_var(self): self.end_var()
def end_var(self): self.end_i()
def end_var(self): self.end_var()
20b35690ee3c685b26abc9a7ddc1fe028abe1f31 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/20b35690ee3c685b26abc9a7ddc1fe028abe1f31/htmllib.py
if ModalDialog(self._filterfunc) == 1:
if ModalDialog(_ProgressBar_filterfunc) == 1:
def _update(self, value): tp, h, bar_rect = self.d.GetDialogItem(3) Qd.SetPort(self.d) Qd.FrameRect(bar_rect) # Draw outline inner_rect = Qd.InsetRect(bar_rect, 1, 1) Qd.ForeColor(QuickDraw.whiteColor) Qd.BackColor(QuickDraw.whiteColor) Qd.PaintRect(inner_rect) # Clear internal l, t, r, b = inner_rect r = int(l + (r-l)*value/self.maxval) inner_rect = l, t, r, b Qd.ForeColor(QuickDraw.blackColor) Qd.BackColor(QuickDraw.blackColor) Qd.PaintRect(inner_rect) # Draw bar # Restore settings Qd.ForeColor(QuickDraw.blackColor) Qd.BackColor(QuickDraw.whiteColor) # Test for cancel button if ModalDialog(self._filterfunc) == 1: raise KeyboardInterrupt
1cea19f2f4835a255cb9a64f47d8a55baaf5798d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1cea19f2f4835a255cb9a64f47d8a55baaf5798d/EasyDialogs.py
def _filterfunc(self, d, e, *more): return 2
def _filterfunc(self, d, e, *more): return 2 # XXXX For now, this disables the cancel button
1cea19f2f4835a255cb9a64f47d8a55baaf5798d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1cea19f2f4835a255cb9a64f47d8a55baaf5798d/EasyDialogs.py
def _ProgressBar_filterfunc(*args): return 2
def set(self, value): if value < 0: value = 0 if value > self.maxval: value = self.maxval self._update(value)
1cea19f2f4835a255cb9a64f47d8a55baaf5798d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1cea19f2f4835a255cb9a64f47d8a55baaf5798d/EasyDialogs.py
u = u''.join(map(unichr, xrange(1024))) for encoding in ('utf-7', 'utf-8', 'utf-16', 'utf-16-le', 'utf-16-be', 'raw_unicode_escape', 'unicode_escape', 'unicode_internal'): self.assertEqual(unicode(u.encode(encoding),encoding), u)
for c in xrange(1024): u = unichr(c) for encoding in ('utf-7', 'utf-8', 'utf-16', 'utf-16-le', 'utf-16-be', 'raw_unicode_escape', 'unicode_escape', 'unicode_internal'): self.assertEqual(unicode(u.encode(encoding),encoding), u)
def test_codecs(self): # Encoding self.assertEqual(u'hello'.encode('ascii'), 'hello') self.assertEqual(u'hello'.encode('utf-7'), 'hello') self.assertEqual(u'hello'.encode('utf-8'), 'hello') self.assertEqual(u'hello'.encode('utf8'), 'hello') self.assertEqual(u'hello'.encode('utf-16-le'), 'h\000e\000l\000l\000o\000') self.assertEqual(u'hello'.encode('utf-16-be'), '\000h\000e\000l\000l\000o') self.assertEqual(u'hello'.encode('latin-1'), 'hello')
38c70e601d470b2de8cf9228de15540fbee65313 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/38c70e601d470b2de8cf9228de15540fbee65313/test_unicode.py
u = u''.join(map(unichr, xrange(256))) for encoding in ('latin-1',): self.assertEqual(unicode(u.encode(encoding),encoding), u)
for c in xrange(256): u = unichr(c) for encoding in ('latin-1',): self.assertEqual(unicode(u.encode(encoding),encoding), u)
def test_codecs(self): # Encoding self.assertEqual(u'hello'.encode('ascii'), 'hello') self.assertEqual(u'hello'.encode('utf-7'), 'hello') self.assertEqual(u'hello'.encode('utf-8'), 'hello') self.assertEqual(u'hello'.encode('utf8'), 'hello') self.assertEqual(u'hello'.encode('utf-16-le'), 'h\000e\000l\000l\000o\000') self.assertEqual(u'hello'.encode('utf-16-be'), '\000h\000e\000l\000l\000o') self.assertEqual(u'hello'.encode('latin-1'), 'hello')
38c70e601d470b2de8cf9228de15540fbee65313 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/38c70e601d470b2de8cf9228de15540fbee65313/test_unicode.py
u = u''.join(map(unichr, xrange(128))) for encoding in ('ascii',): self.assertEqual(unicode(u.encode(encoding),encoding), u)
for c in xrange(128): u = unichr(c) for encoding in ('ascii',): self.assertEqual(unicode(u.encode(encoding),encoding), u)
def test_codecs(self): # Encoding self.assertEqual(u'hello'.encode('ascii'), 'hello') self.assertEqual(u'hello'.encode('utf-7'), 'hello') self.assertEqual(u'hello'.encode('utf-8'), 'hello') self.assertEqual(u'hello'.encode('utf8'), 'hello') self.assertEqual(u'hello'.encode('utf-16-le'), 'h\000e\000l\000l\000o\000') self.assertEqual(u'hello'.encode('utf-16-be'), '\000h\000e\000l\000l\000o') self.assertEqual(u'hello'.encode('latin-1'), 'hello')
38c70e601d470b2de8cf9228de15540fbee65313 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/38c70e601d470b2de8cf9228de15540fbee65313/test_unicode.py
return strftime(self.format, (item,)*8+(0,)).capitalize()
t = (2001, 1, item+1, 12, 0, 0, item, item+1, 0) return strftime(self.format, t).capitalize()
def __getitem__(self, item): if isinstance(item, int): if item < 0: item += self.len if not 0 <= item < self.len: raise IndexError, "out of range" return strftime(self.format, (item,)*8+(0,)).capitalize() elif isinstance(item, type(slice(0))): return [self[e] for e in range(self.len)].__getslice__(item.start, item.stop)
ebb5916ac26ae91ab8a65b1090a83fef87b31a54 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ebb5916ac26ae91ab8a65b1090a83fef87b31a54/calendar.py
[frozenmain_c, frozen_c], target)
[frozenmain_c, os.path.basename(frozen_c)], os.path.basename(target))
def main(): # overridable context prefix = None # settable with -p option exec_prefix = None # settable with -P option extensions = [] path = sys.path[:] modargs = 0 debug = 1 odir = '' win = sys.platform[:3] == 'win' # modules that are imported by the Python runtime implicits = ["site", "exceptions"] # output files frozen_c = 'frozen.c' config_c = 'config.c' target = 'a.out' # normally derived from script name makefile = 'Makefile' subsystem = 'console' # parse command line try: opts, args = getopt.getopt(sys.argv[1:], 'de:hmo:p:P:qs:w') except getopt.error, msg: usage('getopt error: ' + str(msg)) # proces option arguments for o, a in opts: if o == '-h': print __doc__ return if o == '-d': debug = debug + 1 if o == '-e': extensions.append(a) if o == '-m': modargs = 1 if o == '-o': odir = a if o == '-p': prefix = a if o == '-P': exec_prefix = a if o == '-q': debug = 0 if o == '-w': win = not win if o == '-s': if not win: usage("-s subsystem option only on Windows") subsystem = a # default prefix and exec_prefix if not exec_prefix: if prefix: exec_prefix = prefix else: exec_prefix = sys.exec_prefix if not prefix: prefix = sys.prefix # determine whether -p points to the Python source tree ishome = os.path.exists(os.path.join(prefix, 'Python', 'ceval.c')) # locations derived from options version = sys.version[:3] if ishome: print "(Using Python source directory)" binlib = exec_prefix incldir = os.path.join(prefix, 'Include') config_c_in = os.path.join(prefix, 'Modules', 'config.c.in') frozenmain_c = os.path.join(prefix, 'Python', 'frozenmain.c') makefile_in = os.path.join(exec_prefix, 'Modules', 'Makefile') else: binlib = os.path.join(exec_prefix, 'lib', 'python%s' % version, 'config') incldir = os.path.join(prefix, 'include', 'python%s' % version) config_c_in = os.path.join(binlib, 'config.c.in') frozenmain_c = os.path.join(binlib, 'frozenmain.c') makefile_in = os.path.join(binlib, 'Makefile') supp_sources = [] defines = [] includes = ['-I' + incldir, '-I' + binlib] # sanity check of directories and files for dir in [prefix, exec_prefix, binlib, incldir] + extensions: if not os.path.exists(dir): usage('needed directory %s not found' % dir) if not os.path.isdir(dir): usage('%s: not a directory' % dir) if win: files = supp_sources else: files = [config_c_in, makefile_in] + supp_sources for file in supp_sources: if not os.path.exists(file): usage('needed file %s not found' % file) if not os.path.isfile(file): usage('%s: not a plain file' % file) if not win: for dir in extensions: setup = os.path.join(dir, 'Setup') if not os.path.exists(setup): usage('needed file %s not found' % setup) if not os.path.isfile(setup): usage('%s: not a plain file' % setup) # check that enough arguments are passed if not args: usage('at least one filename argument required') # check that file arguments exist for arg in args: if arg == '-m': break if not os.path.exists(arg): usage('argument %s not found' % arg) if not os.path.isfile(arg): usage('%s: not a plain file' % arg) if modargs: break # process non-option arguments scriptfile = args[0] modules = args[1:] # derive target name from script name base = os.path.basename(scriptfile) base, ext = os.path.splitext(base) if base: if base != scriptfile: target = base else: target = base + '.bin' # handle -o option base_frozen_c = frozen_c base_config_c = config_c base_target = target if odir and not os.path.isdir(odir): try: os.mkdir(odir) print "Created output directory", odir except os.error, msg: usage('%s: mkdir failed (%s)' % (odir, str(msg))) if odir: frozen_c = os.path.join(odir, frozen_c) config_c = os.path.join(odir, config_c) target = os.path.join(odir, target) makefile = os.path.join(odir, makefile) # Actual work starts here... # collect all modules of the program dir = os.path.dirname(scriptfile) path[0] = dir mf = modulefinder.ModuleFinder(path, debug) for mod in implicits: mf.import_hook(mod) for mod in modules: if mod == '-m': modargs = 1 continue if modargs: if mod[-2:] == '.*': mf.import_hook(mod[:-2], None, ["*"]) else: mf.import_hook(mod) else: mf.load_file(mod) mf.run_script(scriptfile) if debug > 0: mf.report() print dict = mf.modules # generate output for frozen modules backup = frozen_c + '~' try: os.rename(frozen_c, backup) except os.error: backup = None outfp = open(frozen_c, 'w') try: makefreeze.makefreeze(outfp, dict, debug) if win and subsystem == 'windows': import winmakemakefile outfp.write(winmakemakefile.WINMAINTEMPLATE) finally: outfp.close() if backup: if cmp.cmp(backup, frozen_c): sys.stderr.write('%s not changed, not written\n' % frozen_c) os.unlink(frozen_c) os.rename(backup, frozen_c) # windows gets different treatment if win: # Taking a shortcut here... import winmakemakefile outfp = open(makefile, 'w') try: winmakemakefile.makemakefile(outfp, locals(), [frozenmain_c, frozen_c], target) finally: outfp.close() return # generate config.c and Makefile builtins = [] unknown = [] mods = dict.keys() mods.sort() for mod in mods: if dict[mod].__code__: continue if not dict[mod].__file__: builtins.append(mod) else: unknown.append(mod) addfiles = [] if unknown: addfiles, addmods = \ checkextensions.checkextensions(unknown, extensions) for mod in addmods: unknown.remove(mod) builtins = builtins + addmods if unknown: sys.stderr.write('Warning: unknown modules remain: %s\n' % string.join(unknown)) builtins.sort() infp = open(config_c_in) backup = config_c + '~' try: os.rename(config_c, backup) except os.error: backup = None outfp = open(config_c, 'w') try: makeconfig.makeconfig(infp, outfp, builtins) finally: outfp.close() infp.close() if backup: if cmp.cmp(backup, config_c): sys.stderr.write('%s not changed, not written\n' % config_c) os.unlink(config_c) os.rename(backup, config_c) cflags = defines + includes + ['$(OPT)'] libs = [os.path.join(binlib, 'libpython$(VERSION).a')] somevars = {} if os.path.exists(makefile_in): makevars = parsesetup.getmakevars(makefile_in) for key in makevars.keys(): somevars[key] = makevars[key] somevars['CFLAGS'] = string.join(cflags) # override files = ['$(OPT)', '$(LDFLAGS)', base_config_c, base_frozen_c] + \ supp_sources + addfiles + libs + \ ['$(MODLIBS)', '$(LIBS)', '$(SYSLIBS)'] backup = makefile + '~' if os.path.exists(makefile): try: os.unlink(backup) except os.error: pass try: os.rename(makefile, backup) except os.error: backup = None outfp = open(makefile, 'w') try: makemakefile.makemakefile(outfp, somevars, files, base_target) finally: outfp.close() if backup: if not cmp.cmp(backup, makefile): print 'previous Makefile saved as', backup else: sys.stderr.write('%s not changed, not written\n' % makefile) os.unlink(makefile) os.rename(backup, makefile) # Done! if odir: print 'Now run "make" in', odir, print 'to build the target:', base_target else: print 'Now run "make" to build the target:', base_target
3add016f81cbdab356106e9a292e8ff242a324c3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/3add016f81cbdab356106e9a292e8ff242a324c3/freeze.py
The 'quotetabs' flag indicates whether tabs should be quoted.""" if c == '\t': return not quotetabs return c == ESCAPE or not(' ' <= c <= '~')
The 'quotetabs' flag indicates whether embedded tabs and spaces should be quoted. Note that line-ending tabs and spaces are always encoded, as per RFC 1521. """ if c in ' \t': return quotetabs return c == ESCAPE or not (' ' <= c <= '~')
def needsquoting(c, quotetabs): """Decide whether a particular character needs to be quoted. The 'quotetabs' flag indicates whether tabs should be quoted.""" if c == '\t': return not quotetabs return c == ESCAPE or not(' ' <= c <= '~')
425bbbb21443c34ba719bc271466c6e3c7cd680c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/425bbbb21443c34ba719bc271466c6e3c7cd680c/quopri.py
The 'quotetabs' flag indicates whether tabs should be quoted. """
The 'quotetabs' flag indicates whether embedded tabs and spaces should be quoted. Note that line-ending tabs and spaces are always encoded, as per RFC 1521. """ def write(s, output=output, lineEnd='\n'): if s and s[-1:] in ' \t': output.write(s[:-1] + quote(s[-1]) + lineEnd) else: output.write(s + lineEnd) prevline = None linelen = 0
def encode(input, output, quotetabs): """Read 'input', apply quoted-printable encoding, and write to 'output'. 'input' and 'output' are files with readline() and write() methods. The 'quotetabs' flag indicates whether tabs should be quoted. """ while 1: line = input.readline() if not line: break new = '' last = line[-1:] if last == '\n': line = line[:-1] else: last = '' prev = '' for c in line: if needsquoting(c, quotetabs): c = quote(c) if len(new) + len(c) >= MAXLINESIZE: output.write(new + ESCAPE + '\n') new = '' new = new + c prev = c if prev in (' ', '\t'): output.write(new + ESCAPE + '\n\n') else: output.write(new + '\n')
425bbbb21443c34ba719bc271466c6e3c7cd680c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/425bbbb21443c34ba719bc271466c6e3c7cd680c/quopri.py
new = '' last = line[-1:] if last == '\n':
outline = [] stripped = '' if line[-1:] == '\n':
def encode(input, output, quotetabs): """Read 'input', apply quoted-printable encoding, and write to 'output'. 'input' and 'output' are files with readline() and write() methods. The 'quotetabs' flag indicates whether tabs should be quoted. """ while 1: line = input.readline() if not line: break new = '' last = line[-1:] if last == '\n': line = line[:-1] else: last = '' prev = '' for c in line: if needsquoting(c, quotetabs): c = quote(c) if len(new) + len(c) >= MAXLINESIZE: output.write(new + ESCAPE + '\n') new = '' new = new + c prev = c if prev in (' ', '\t'): output.write(new + ESCAPE + '\n\n') else: output.write(new + '\n')
425bbbb21443c34ba719bc271466c6e3c7cd680c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/425bbbb21443c34ba719bc271466c6e3c7cd680c/quopri.py
else: last = '' prev = ''
stripped = '\n'
def encode(input, output, quotetabs): """Read 'input', apply quoted-printable encoding, and write to 'output'. 'input' and 'output' are files with readline() and write() methods. The 'quotetabs' flag indicates whether tabs should be quoted. """ while 1: line = input.readline() if not line: break new = '' last = line[-1:] if last == '\n': line = line[:-1] else: last = '' prev = '' for c in line: if needsquoting(c, quotetabs): c = quote(c) if len(new) + len(c) >= MAXLINESIZE: output.write(new + ESCAPE + '\n') new = '' new = new + c prev = c if prev in (' ', '\t'): output.write(new + ESCAPE + '\n\n') else: output.write(new + '\n')
425bbbb21443c34ba719bc271466c6e3c7cd680c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/425bbbb21443c34ba719bc271466c6e3c7cd680c/quopri.py
if len(new) + len(c) >= MAXLINESIZE: output.write(new + ESCAPE + '\n') new = '' new = new + c prev = c if prev in (' ', '\t'): output.write(new + ESCAPE + '\n\n') else: output.write(new + '\n')
if linelen + len(c) >= MAXLINESIZE: if prevline is not None: write(prevline) prevline = EMPTYSTRING.join(outline) linelen = 0 outline = [] outline.append(c) linelen += len(c) if prevline is not None: write(prevline) prevline = EMPTYSTRING.join(outline) linelen = 0 outline = [] if prevline is not None: write(prevline, lineEnd=stripped) def encodestring(s, quotetabs=0): from cStringIO import StringIO infp = StringIO(s) outfp = StringIO() encode(infp, outfp, quotetabs) return outfp.getvalue()
def encode(input, output, quotetabs): """Read 'input', apply quoted-printable encoding, and write to 'output'. 'input' and 'output' are files with readline() and write() methods. The 'quotetabs' flag indicates whether tabs should be quoted. """ while 1: line = input.readline() if not line: break new = '' last = line[-1:] if last == '\n': line = line[:-1] else: last = '' prev = '' for c in line: if needsquoting(c, quotetabs): c = quote(c) if len(new) + len(c) >= MAXLINESIZE: output.write(new + ESCAPE + '\n') new = '' new = new + c prev = c if prev in (' ', '\t'): output.write(new + ESCAPE + '\n\n') else: output.write(new + '\n')
425bbbb21443c34ba719bc271466c6e3c7cd680c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/425bbbb21443c34ba719bc271466c6e3c7cd680c/quopri.py
def test():
def main():
def test(): import sys import getopt try: opts, args = getopt.getopt(sys.argv[1:], 'td') except getopt.error, msg: sys.stdout = sys.stderr print msg print "usage: quopri [-t | -d] [file] ..." print "-t: quote tabs" print "-d: decode; default encode" sys.exit(2) deco = 0 tabs = 0 for o, a in opts: if o == '-t': tabs = 1 if o == '-d': deco = 1 if tabs and deco: sys.stdout = sys.stderr print "-t and -d are mutually exclusive" sys.exit(2) if not args: args = ['-'] sts = 0 for file in args: if file == '-': fp = sys.stdin else: try: fp = open(file) except IOError, msg: sys.stderr.write("%s: can't open (%s)\n" % (file, msg)) sts = 1 continue if deco: decode(fp, sys.stdout) else: encode(fp, sys.stdout, tabs) if fp is not sys.stdin: fp.close() if sts: sys.exit(sts)
425bbbb21443c34ba719bc271466c6e3c7cd680c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/425bbbb21443c34ba719bc271466c6e3c7cd680c/quopri.py
test()
main()
def test(): import sys import getopt try: opts, args = getopt.getopt(sys.argv[1:], 'td') except getopt.error, msg: sys.stdout = sys.stderr print msg print "usage: quopri [-t | -d] [file] ..." print "-t: quote tabs" print "-d: decode; default encode" sys.exit(2) deco = 0 tabs = 0 for o, a in opts: if o == '-t': tabs = 1 if o == '-d': deco = 1 if tabs and deco: sys.stdout = sys.stderr print "-t and -d are mutually exclusive" sys.exit(2) if not args: args = ['-'] sts = 0 for file in args: if file == '-': fp = sys.stdin else: try: fp = open(file) except IOError, msg: sys.stderr.write("%s: can't open (%s)\n" % (file, msg)) sts = 1 continue if deco: decode(fp, sys.stdout) else: encode(fp, sys.stdout, tabs) if fp is not sys.stdin: fp.close() if sts: sys.exit(sts)
425bbbb21443c34ba719bc271466c6e3c7cd680c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/425bbbb21443c34ba719bc271466c6e3c7cd680c/quopri.py
_tryorder = ["galeon", "mozilla", "netscape", "kfm", "grail", "links", "lynx", "w3m",]
_tryorder = ["links", "lynx", "w3m"]
def open_new(self, url): self.open(url)
c75fd3de79457d9891801c2dd0c58b144120a306 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c75fd3de79457d9891801c2dd0c58b144120a306/webbrowser.py
if tr_enc: if tr_enc.lower() != 'chunked': raise UnknownTransferEncoding()
if tr_enc and tr_enc.lower() == "chunked":
def begin(self): if self.msg is not None: # we've already started reading the response return
f19b68e76fa171980788a721fecdce8e4f1ca749 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f19b68e76fa171980788a721fecdce8e4f1ca749/httplib.py
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
raise HTTPError(req.get_full_url(), code, msg, headers, fp)
def redirect_request(self, req, fp, code, msg, headers, newurl): """Return a Request or None in response to a redirect.
8e326f613773457e8d58b7ad1946ca3043775ab4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8e326f613773457e8d58b7ad1946ca3043775ab4/urllib2.py
if terminator is None:
if terminator is None or terminator == '':
def handle_read (self):
ffd1e1e154771676a6ec52ab1b15a7048342cf73 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ffd1e1e154771676a6ec52ab1b15a7048342cf73/asynchat.py
meta = '\n <meta name="aesop" content="%s">'
meta = '<meta name="aesop" content="%s">\n ' % self.aesop_type
def get_header(self): s = HEAD % self.variables if self.uplink: if self.uptitle: link = ('<link rel="up" href="%s" title="%s">' % (self.uplink, self.uptitle)) else: link = '<link rel="up" href="%s">' % self.uplink repl = " %s\n</head>" % link s = s.replace("</head>", repl, 1) if self.aesop_type: meta = '\n <meta name="aesop" content="%s">' # Insert this in the middle of the head that's been # generated so far, keeping <meta> and <link> elements in # neat groups: s = s.replace("<link ", meta + "<link ", 1) return s
33411ce685a5a992dd895ae9f82908e38a9aa11d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/33411ce685a5a992dd895ae9f82908e38a9aa11d/support.py
if not dircase in _dirs_in_sys_path and os.path.exists(dir):
if not dircase in _dirs_in_sys_path:
def makepath(*paths): dir = os.path.abspath(os.path.join(*paths)) return dir, os.path.normcase(dir)
a5c6294a43a58a97e1d0e9fd71962f3112300cb7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a5c6294a43a58a97e1d0e9fd71962f3112300cb7/site.py
created_dirs = []
def mkpath (name, mode=0777, verbose=0, dry_run=0): """Create a directory and any missing ancestor directories. If the directory already exists, return silently. Raise DistutilsFileError if unable to create some directory along the way (eg. some sub-path exists, but is a file rather than a directory). If 'verbose' is true, print a one-line summary of each mkdir to stdout.""" global PATH_CREATED # XXX what's the better way to handle verbosity? print as we create # each directory in the path (the current behaviour), or only announce # the creation of the whole path? (quite easy to do the latter since # we're not using a recursive algorithm) name = os.path.normpath (name) if os.path.isdir (name) or name == '': return if PATH_CREATED.get (name): return (head, tail) = os.path.split (name) tails = [tail] # stack of lone dirs to create while head and tail and not os.path.isdir (head): #print "splitting '%s': " % head, (head, tail) = os.path.split (head) #print "to ('%s','%s')" % (head, tail) tails.insert (0, tail) # push next higher dir onto stack #print "stack of tails:", tails # now 'head' contains the deepest directory that already exists # (that is, the child of 'head' in 'name' is the highest directory # that does *not* exist) for d in tails: #print "head = %s, d = %s: " % (head, d), head = os.path.join (head, d) if PATH_CREATED.get (head): continue if verbose: print "creating", head if not dry_run: try: os.mkdir (head) except os.error, (errno, errstr): raise DistutilsFileError, \ "could not create '%s': %s" % (head, errstr) PATH_CREATED[head] = 1
4f6719ff1041b68835a25daa16d85ec6660d10ce /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4f6719ff1041b68835a25daa16d85ec6660d10ce/util.py
return
return created_dirs
def mkpath (name, mode=0777, verbose=0, dry_run=0): """Create a directory and any missing ancestor directories. If the directory already exists, return silently. Raise DistutilsFileError if unable to create some directory along the way (eg. some sub-path exists, but is a file rather than a directory). If 'verbose' is true, print a one-line summary of each mkdir to stdout.""" global PATH_CREATED # XXX what's the better way to handle verbosity? print as we create # each directory in the path (the current behaviour), or only announce # the creation of the whole path? (quite easy to do the latter since # we're not using a recursive algorithm) name = os.path.normpath (name) if os.path.isdir (name) or name == '': return if PATH_CREATED.get (name): return (head, tail) = os.path.split (name) tails = [tail] # stack of lone dirs to create while head and tail and not os.path.isdir (head): #print "splitting '%s': " % head, (head, tail) = os.path.split (head) #print "to ('%s','%s')" % (head, tail) tails.insert (0, tail) # push next higher dir onto stack #print "stack of tails:", tails # now 'head' contains the deepest directory that already exists # (that is, the child of 'head' in 'name' is the highest directory # that does *not* exist) for d in tails: #print "head = %s, d = %s: " % (head, d), head = os.path.join (head, d) if PATH_CREATED.get (head): continue if verbose: print "creating", head if not dry_run: try: os.mkdir (head) except os.error, (errno, errstr): raise DistutilsFileError, \ "could not create '%s': %s" % (head, errstr) PATH_CREATED[head] = 1
4f6719ff1041b68835a25daa16d85ec6660d10ce /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4f6719ff1041b68835a25daa16d85ec6660d10ce/util.py
return
return created_dirs
def mkpath (name, mode=0777, verbose=0, dry_run=0): """Create a directory and any missing ancestor directories. If the directory already exists, return silently. Raise DistutilsFileError if unable to create some directory along the way (eg. some sub-path exists, but is a file rather than a directory). If 'verbose' is true, print a one-line summary of each mkdir to stdout.""" global PATH_CREATED # XXX what's the better way to handle verbosity? print as we create # each directory in the path (the current behaviour), or only announce # the creation of the whole path? (quite easy to do the latter since # we're not using a recursive algorithm) name = os.path.normpath (name) if os.path.isdir (name) or name == '': return if PATH_CREATED.get (name): return (head, tail) = os.path.split (name) tails = [tail] # stack of lone dirs to create while head and tail and not os.path.isdir (head): #print "splitting '%s': " % head, (head, tail) = os.path.split (head) #print "to ('%s','%s')" % (head, tail) tails.insert (0, tail) # push next higher dir onto stack #print "stack of tails:", tails # now 'head' contains the deepest directory that already exists # (that is, the child of 'head' in 'name' is the highest directory # that does *not* exist) for d in tails: #print "head = %s, d = %s: " % (head, d), head = os.path.join (head, d) if PATH_CREATED.get (head): continue if verbose: print "creating", head if not dry_run: try: os.mkdir (head) except os.error, (errno, errstr): raise DistutilsFileError, \ "could not create '%s': %s" % (head, errstr) PATH_CREATED[head] = 1
4f6719ff1041b68835a25daa16d85ec6660d10ce /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4f6719ff1041b68835a25daa16d85ec6660d10ce/util.py
if msg[:3] != '500': raise error_perm, msg
if msg.args[0][:3] != '500': raise
def cwd(self, dirname): '''Change to a directory.''' if dirname == '..': try: return self.voidcmd('CDUP') except error_perm, msg: if msg[:3] != '500': raise error_perm, msg elif dirname == '': dirname = '.' # does nothing, but could return error cmd = 'CWD ' + dirname return self.voidcmd(cmd)
e7b2e16fd57a3b6dbee270a841f682243aa8789e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e7b2e16fd57a3b6dbee270a841f682243aa8789e/ftplib.py
tcltkdata = [(tcltk.id, "REGISTRY.tcl"),
tcldata = [(tcltk.id, "REGISTRY.tcl"),
# File extensions, associated with the REGISTRY.def component
ae4df2dcac34dc3909f10e7b8232f87afade6d57 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ae4df2dcac34dc3909f10e7b8232f87afade6d57/msi.py
[("py", "open", 1, None, r'-n -e "%1"'), ("pyw", "open", 1, None, r'-n -e "%1"'), ("pyc", "open", 1, None, r'-n -e "%1"'), ("pyo", "open", 1, None, r'-n -e "%1"')])
[("py", "open", 1, None, r'"%1"'), ("pyw", "open", 1, None, r'"%1"'), ("pyc", "open", 1, None, r'"%1"'), ("pyo", "open", 1, None, r'"%1"')])
# File extensions, associated with the REGISTRY.def component
ae4df2dcac34dc3909f10e7b8232f87afade6d57 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ae4df2dcac34dc3909f10e7b8232f87afade6d57/msi.py
screenbounds = Qd.qd.screenBits.bounds screenbounds = screenbounds[0]+4, screenbounds[1]+4, \ screenbounds[2]-4, screenbounds[3]-4
def AskYesNoCancel(question, default = 0):
efc0170fc1e14e215043d1c284970cbbdb41d3f8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/efc0170fc1e14e215043d1c284970cbbdb41d3f8/EasyDialogs.py
def __init__(self, label="Working...", maxval=100): self.label = label
def __init__(self, title="Working...", maxval=100, label=""):
def __init__(self, label="Working...", maxval=100): self.label = label self.maxval = maxval self.curval = -1 self.d = GetNewDialog(259, -1) tp, text_h, rect = self.d.GetDialogItem(2) SetDialogItemText(text_h, label) self._update(0)
efc0170fc1e14e215043d1c284970cbbdb41d3f8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/efc0170fc1e14e215043d1c284970cbbdb41d3f8/EasyDialogs.py
SetDialogItemText(text_h, label) self._update(0)
SetDialogItemText(text_h, self._label)
def __init__(self, label="Working...", maxval=100): self.label = label self.maxval = maxval self.curval = -1 self.d = GetNewDialog(259, -1) tp, text_h, rect = self.d.GetDialogItem(2) SetDialogItemText(text_h, label) self._update(0)
efc0170fc1e14e215043d1c284970cbbdb41d3f8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/efc0170fc1e14e215043d1c284970cbbdb41d3f8/EasyDialogs.py
if ModalDialog(_ProgressBar_filterfunc) == 1: raise KeyboardInterrupt
ready, ev = Evt.WaitNextEvent( Events.mDownMask, 1 ) if ready : what,msg,when,where,mod = ev part = Win.FindWindow(where)[0] if Dlg.IsDialogEvent(ev): ds = Dlg.DialogSelect(ev) if ds[0] and ds[1] == self.d and ds[-1] == 1: raise KeyboardInterrupt, ev else: if part == 4: self.d.DragWindow(where, screenbounds) else: MacOS.HandleEvent(ev)
def _update(self, value): tp, h, bar_rect = self.d.GetDialogItem(3) Qd.SetPort(self.d) Qd.FrameRect(bar_rect) # Draw outline inner_rect = Qd.InsetRect(bar_rect, 1, 1) l, t, r, b = inner_rect
efc0170fc1e14e215043d1c284970cbbdb41d3f8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/efc0170fc1e14e215043d1c284970cbbdb41d3f8/EasyDialogs.py
def _ProgressBar_filterfunc(*args): return 2
def inc(self, n=1): """inc(amt) - Increment progress bar position""" self.set(self.curval + n)
def set(self, value): if value < 0: value = 0 if value > self.maxval: value = self.maxval self._update(value)
efc0170fc1e14e215043d1c284970cbbdb41d3f8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/efc0170fc1e14e215043d1c284970cbbdb41d3f8/EasyDialogs.py
bar = ProgressBar("Counting...", 100) for i in range(100): bar.set(i) del bar
text = ( "Working Hard...", "Hardly Working..." , "So far, so good!", "Keep on truckin'" ) bar = ProgressBar("Progress, progress...", 100) try: appsw = MacOS.EnableAppswitch(0) for i in range(100): bar.set(i) time.sleep(0.1) if i % 10 == 0: bar.label(text[(i/10) % 4]) bar.label("Done.") time.sleep(0.3) finally: del bar MacOS.EnableAppswitch(appsw)
def test(): Message("Testing EasyDialogs.") ok = AskYesNoCancel("Do you want to proceed?") if ok > 0: s = AskString("Enter your first name") Message("Thank you,\015%s" % `s`) bar = ProgressBar("Counting...", 100) for i in range(100): bar.set(i) del bar
efc0170fc1e14e215043d1c284970cbbdb41d3f8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/efc0170fc1e14e215043d1c284970cbbdb41d3f8/EasyDialogs.py
test()
try: test() except KeyboardInterrupt: Message("Operation Canceled.")
def test(): Message("Testing EasyDialogs.") ok = AskYesNoCancel("Do you want to proceed?") if ok > 0: s = AskString("Enter your first name") Message("Thank you,\015%s" % `s`) bar = ProgressBar("Counting...", 100) for i in range(100): bar.set(i) del bar
efc0170fc1e14e215043d1c284970cbbdb41d3f8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/efc0170fc1e14e215043d1c284970cbbdb41d3f8/EasyDialogs.py
if not os.isatty(slave_fd) and sys.platform not in fickle_isatty:
if not os.isatty(slave_fd):
def test_basic_pty(): try: debug("Calling master_open()") master_fd, slave_name = pty.master_open() debug("Got master_fd '%d', slave_name '%s'"%(master_fd, slave_name)) debug("Calling slave_open(%r)"%(slave_name,)) slave_fd = pty.slave_open(slave_name) debug("Got slave_fd '%d'"%slave_fd) except OSError: # " An optional feature could not be imported " ... ? raise TestSkipped, "Pseudo-terminals (seemingly) not functional." if not os.isatty(slave_fd) and sys.platform not in fickle_isatty: raise TestFailed, "slave_fd is not a tty" debug("Writing to slave_fd") os.write(slave_fd, TEST_STRING_1) s1 = os.read(master_fd, 1024) sys.stdout.write(normalize_output(s1)) debug("Writing chunked output") os.write(slave_fd, TEST_STRING_2[:5]) os.write(slave_fd, TEST_STRING_2[5:]) s2 = os.read(master_fd, 1024) sys.stdout.write(normalize_output(s2)) os.close(slave_fd) os.close(master_fd)
7fbecc6e4f25c49e8e53a0d7007a71cb1ee15ad5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/7fbecc6e4f25c49e8e53a0d7007a71cb1ee15ad5/test_pty.py
if nodelist[3][0] != symbol.except_clause: return self.com_try_finally(nodelist) return self.com_try_except(nodelist)
return self.com_try_except_finally(nodelist)
def try_stmt(self, nodelist): # 'try' ':' suite (except_clause ':' suite)+ ['else' ':' suite] # | 'try' ':' suite 'finally' ':' suite if nodelist[3][0] != symbol.except_clause: return self.com_try_finally(nodelist)
1cac368f5f265c3a934ad65d7da75d350146c773 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1cac368f5f265c3a934ad65d7da75d350146c773/transformer.py
def com_try_finally(self, nodelist): return TryFinally(self.com_node(nodelist[2]), self.com_node(nodelist[5]), lineno=nodelist[0][2]) def com_try_except(self, nodelist):
def com_try_except_finally(self, nodelist): if nodelist[3][0] == token.NAME: return TryFinally(self.com_node(nodelist[2]), self.com_node(nodelist[5]), lineno=nodelist[0][2])
def com_try_finally(self, nodelist): # try_fin_stmt: "try" ":" suite "finally" ":" suite return TryFinally(self.com_node(nodelist[2]), self.com_node(nodelist[5]), lineno=nodelist[0][2])
1cac368f5f265c3a934ad65d7da75d350146c773 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1cac368f5f265c3a934ad65d7da75d350146c773/transformer.py
stmt = self.com_node(nodelist[2])
def com_try_except(self, nodelist): # try_except: 'try' ':' suite (except_clause ':' suite)* ['else' suite] #tryexcept: [TryNode, [except_clauses], elseNode)] stmt = self.com_node(nodelist[2]) clauses = [] elseNode = None for i in range(3, len(nodelist), 3): node = nodelist[i] if node[0] == symbol.except_clause: # except_clause: 'except' [expr [',' expr]] */ if len(node) > 2: expr1 = self.com_node(node[2]) if len(node) > 4: expr2 = self.com_assign(node[4], OP_ASSIGN) else: expr2 = None else: expr1 = expr2 = None clauses.append((expr1, expr2, self.com_node(nodelist[i+2])))
1cac368f5f265c3a934ad65d7da75d350146c773 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1cac368f5f265c3a934ad65d7da75d350146c773/transformer.py
elseNode = self.com_node(nodelist[i+2]) return TryExcept(self.com_node(nodelist[2]), clauses, elseNode, lineno=nodelist[0][2])
if node[1] == 'else': elseNode = self.com_node(nodelist[i+2]) elif node[1] == 'finally': finallyNode = self.com_node(nodelist[i+2]) try_except = TryExcept(self.com_node(nodelist[2]), clauses, elseNode, lineno=nodelist[0][2]) if finallyNode: return TryFinally(try_except, finallyNode, lineno=nodelist[0][2]) else: return try_except
def com_try_except(self, nodelist): # try_except: 'try' ':' suite (except_clause ':' suite)* ['else' suite] #tryexcept: [TryNode, [except_clauses], elseNode)] stmt = self.com_node(nodelist[2]) clauses = [] elseNode = None for i in range(3, len(nodelist), 3): node = nodelist[i] if node[0] == symbol.except_clause: # except_clause: 'except' [expr [',' expr]] */ if len(node) > 2: expr1 = self.com_node(node[2]) if len(node) > 4: expr2 = self.com_assign(node[4], OP_ASSIGN) else: expr2 = None else: expr1 = expr2 = None clauses.append((expr1, expr2, self.com_node(nodelist[i+2])))
1cac368f5f265c3a934ad65d7da75d350146c773 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1cac368f5f265c3a934ad65d7da75d350146c773/transformer.py
prefix = get_config_vars('prefix', 'exec_prefix')
(prefix, exec_prefix) = get_config_vars('prefix', 'exec_prefix')
def finalize_options (self):
42af12a673b43b676492fc3828c7b7f73e4af7af /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/42af12a673b43b676492fc3828c7b7f73e4af7af/install.py
def unpack(self, archive, output=None):
def unpack(self, archive, output=None, package=None):
def unpack(self, archive, output=None): return None
b8bc1787f4d2ad5bafcd19ae7aee7c0bf279e0f5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b8bc1787f4d2ad5bafcd19ae7aee7c0bf279e0f5/pimp.py
def unpack(self, archive, output=None):
def unpack(self, archive, output=None, package=None):
def unpack(self, archive, output=None): cmd = self.argument % archive if _cmd(output, self._dir, cmd): return "unpack command failed"
b8bc1787f4d2ad5bafcd19ae7aee7c0bf279e0f5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b8bc1787f4d2ad5bafcd19ae7aee7c0bf279e0f5/pimp.py