rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
f.close()
_sync_close(f)
def add(self, message): """Add message and return assigned key.""" keys = self.keys() if len(keys) == 0: new_key = 1 else: new_key = max(keys) + 1 new_path = os.path.join(self._path, str(new_key)) f = _create_carefully(new_path) try: if self._locked: _lock_file(f) try: self._dump_message(message, f) if isinstance(message, MHMessage): self._dump_sequences(message, new_key) finally: if self._locked: _unlock_file(f) finally: f.close() return new_key
b5686da24f7cb7b4a7fb66d8263e5479653f5def /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b5686da24f7cb7b4a7fb66d8263e5479653f5def/mailbox.py
f.close()
_sync_close(f)
def __setitem__(self, key, message): """Replace the keyed message; raise KeyError if it doesn't exist.""" path = os.path.join(self._path, str(key)) try: f = open(path, 'rb+') except IOError, e: if e.errno == errno.ENOENT: raise KeyError('No message with key: %s' % key) else: raise try: if self._locked: _lock_file(f) try: os.close(os.open(path, os.O_WRONLY | os.O_TRUNC)) self._dump_message(message, f) if isinstance(message, MHMessage): self._dump_sequences(message, key) finally: if self._locked: _unlock_file(f) finally: f.close()
b5686da24f7cb7b4a7fb66d8263e5479653f5def /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b5686da24f7cb7b4a7fb66d8263e5479653f5def/mailbox.py
self._file.close()
_sync_close(self._file)
def unlock(self): """Unlock the mailbox if it is locked.""" if self._locked: _unlock_file(self._file) self._file.close() del self._file self._locked = False
b5686da24f7cb7b4a7fb66d8263e5479653f5def /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b5686da24f7cb7b4a7fb66d8263e5479653f5def/mailbox.py
f.close()
_sync_close(f)
def set_sequences(self, sequences): """Set sequences using the given name-to-key-list dictionary.""" f = open(os.path.join(self._path, '.mh_sequences'), 'r+') try: os.close(os.open(f.name, os.O_WRONLY | os.O_TRUNC)) for name, keys in sequences.iteritems(): if len(keys) == 0: continue f.write('%s:' % name) prev = None completing = False for key in sorted(set(keys)): if key - 1 == prev: if not completing: completing = True f.write('-') elif completing: completing = False f.write('%s %s' % (prev, key)) else: f.write(' %s' % key) prev = key if completing: f.write(str(prev) + '\n') else: f.write('\n') finally: f.close()
b5686da24f7cb7b4a7fb66d8263e5479653f5def /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b5686da24f7cb7b4a7fb66d8263e5479653f5def/mailbox.py
self.assertEqual(re.match('(x)*', 50000*'x').span(), (0, 50000))
try: re.match('(x)*', 50000*'x') except RuntimeError, v: self.assertEqual(str(v), "maximum recursion limit exceeded") else: self.fail("re.match('(x)*', 50000*'x') should have failed")
def test_limitations(self): # Try nasty case that overflows the straightforward recursive # implementation of repeated groups. self.assertEqual(re.match('(x)*', 50000*'x').span(), (0, 50000))
46144be02cbd6b8d6626c2e5048339364705c454 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/46144be02cbd6b8d6626c2e5048339364705c454/test_re.py
def newgroups(self, date, time):
def newgroups(self, date, time, file=None):
def newgroups(self, date, time): """Process a NEWGROUPS command. Arguments: - date: string 'yymmdd' indicating the date - time: string 'hhmmss' indicating the time Return: - resp: server response if successful - list: list of newsgroup names"""
a26854095be67418bc89eff4874b32e33d7e5bf6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a26854095be67418bc89eff4874b32e33d7e5bf6/nntplib.py
return self.longcmd('NEWGROUPS ' + date + ' ' + time) def newnews(self, group, date, time):
return self.longcmd('NEWGROUPS ' + date + ' ' + time, file) def newnews(self, group, date, time, file=None):
def newgroups(self, date, time): """Process a NEWGROUPS command. Arguments: - date: string 'yymmdd' indicating the date - time: string 'hhmmss' indicating the time Return: - resp: server response if successful - list: list of newsgroup names"""
a26854095be67418bc89eff4874b32e33d7e5bf6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a26854095be67418bc89eff4874b32e33d7e5bf6/nntplib.py
return self.longcmd(cmd) def list(self):
return self.longcmd(cmd, file) def list(self, file=None):
def newnews(self, group, date, time): """Process a NEWNEWS command. Arguments: - group: group name or '*' - date: string 'yymmdd' indicating the date - time: string 'hhmmss' indicating the time Return: - resp: server response if successful - list: list of article ids"""
a26854095be67418bc89eff4874b32e33d7e5bf6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a26854095be67418bc89eff4874b32e33d7e5bf6/nntplib.py
resp, list = self.longcmd('LIST')
resp, list = self.longcmd('LIST', file)
def list(self): """Process a LIST command. Return: - resp: server response if successful - list: list of (group, last, first, flag) (strings)"""
a26854095be67418bc89eff4874b32e33d7e5bf6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a26854095be67418bc89eff4874b32e33d7e5bf6/nntplib.py
def help(self):
def help(self, file=None):
def help(self): """Process a HELP command. Returns: - resp: server response if successful - list: list of strings"""
a26854095be67418bc89eff4874b32e33d7e5bf6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a26854095be67418bc89eff4874b32e33d7e5bf6/nntplib.py
return self.longcmd('HELP')
return self.longcmd('HELP',file)
def help(self): """Process a HELP command. Returns: - resp: server response if successful - list: list of strings"""
a26854095be67418bc89eff4874b32e33d7e5bf6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a26854095be67418bc89eff4874b32e33d7e5bf6/nntplib.py
def xhdr(self, hdr, str):
def xhdr(self, hdr, str, file=None):
def xhdr(self, hdr, str): """Process an XHDR command (optional server extension). Arguments: - hdr: the header type (e.g. 'subject') - str: an article nr, a message id, or a range nr1-nr2 Returns: - resp: server response if successful - list: list of (nr, value) strings"""
a26854095be67418bc89eff4874b32e33d7e5bf6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a26854095be67418bc89eff4874b32e33d7e5bf6/nntplib.py
resp, lines = self.longcmd('XHDR ' + hdr + ' ' + str)
resp, lines = self.longcmd('XHDR ' + hdr + ' ' + str, file)
def xhdr(self, hdr, str): """Process an XHDR command (optional server extension). Arguments: - hdr: the header type (e.g. 'subject') - str: an article nr, a message id, or a range nr1-nr2 Returns: - resp: server response if successful - list: list of (nr, value) strings"""
a26854095be67418bc89eff4874b32e33d7e5bf6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a26854095be67418bc89eff4874b32e33d7e5bf6/nntplib.py
def xover(self,start,end):
def xover(self, start, end, file=None):
def xover(self,start,end): """Process an XOVER command (optional server extension) Arguments: - start: start of range - end: end of range Returns: - resp: server response if successful - list: list of (art-nr, subject, poster, date, id, references, size, lines)"""
a26854095be67418bc89eff4874b32e33d7e5bf6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a26854095be67418bc89eff4874b32e33d7e5bf6/nntplib.py
resp, lines = self.longcmd('XOVER ' + start + '-' + end)
resp, lines = self.longcmd('XOVER ' + start + '-' + end, file)
def xover(self,start,end): """Process an XOVER command (optional server extension) Arguments: - start: start of range - end: end of range Returns: - resp: server response if successful - list: list of (art-nr, subject, poster, date, id, references, size, lines)"""
a26854095be67418bc89eff4874b32e33d7e5bf6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a26854095be67418bc89eff4874b32e33d7e5bf6/nntplib.py
def xgtitle(self, group):
def xgtitle(self, group, file=None):
def xgtitle(self, group): """Process an XGTITLE command (optional server extension) Arguments: - group: group name wildcard (i.e. news.*) Returns: - resp: server response if successful - list: list of (name,title) strings"""
a26854095be67418bc89eff4874b32e33d7e5bf6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a26854095be67418bc89eff4874b32e33d7e5bf6/nntplib.py
resp, raw_lines = self.longcmd('XGTITLE ' + group)
resp, raw_lines = self.longcmd('XGTITLE ' + group, file)
def xgtitle(self, group): """Process an XGTITLE command (optional server extension) Arguments: - group: group name wildcard (i.e. news.*) Returns: - resp: server response if successful - list: list of (name,title) strings"""
a26854095be67418bc89eff4874b32e33d7e5bf6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a26854095be67418bc89eff4874b32e33d7e5bf6/nntplib.py
print '<dd>', escape(form[key])
print '<dd>', escape(`form[key]`)
def print_form( form ): skeys = form.keys() skeys.sort() print '<h3> The following name/value pairs ' \ 'were entered in the form: </h3>' print '<dl>' for key in skeys: print '<dt>', escape(key), ':', print '<i>', escape(`type(form[key])`), '</i>', print '<dd>', escape(form[key]) print '</dl>'
dcce73af48387531e0cef280e27b3689bf7d4b85 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/dcce73af48387531e0cef280e27b3689bf7d4b85/cgi.py
s = regsub.gsub('&', '&amp;') s = regsub.gsub('<', '&lt;') s = regsub.gsub('>', '&gt;')
s = regsub.gsub('&', '&amp;', s) s = regsub.gsub('<', '&lt;', s) s = regsub.gsub('>', '&gt;', s)
def escape( s ): s = regsub.gsub('&', '&amp;') # Must be done first s = regsub.gsub('<', '&lt;') s = regsub.gsub('>', '&gt;') return s
dcce73af48387531e0cef280e27b3689bf7d4b85 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/dcce73af48387531e0cef280e27b3689bf7d4b85/cgi.py
'Copyright: ' + self.distribution.get_license(),
'License: ' + self.distribution.get_license(),
def _make_spec_file(self): """Generate the text of an RPM spec file and return it as a list of strings (one per line). """ # definitions and headers spec_file = [ '%define name ' + self.distribution.get_name(), '%define version ' + self.distribution.get_version(), '%define release ' + self.release, '', 'Summary: ' + self.distribution.get_description(), ]
e567114e472470554adda63ab39ca0850d51fd66 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e567114e472470554adda63ab39ca0850d51fd66/bdist_rpm.py
>>> msg = '''
>>> msg = '''\\
def sendmail(self, from_addr, to_addrs, msg, mail_options=[], rcpt_options=[]): """This command performs an entire mail transaction.
301b1cd1072423a2b424fff9307e94e75aeb82a8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/301b1cd1072423a2b424fff9307e94e75aeb82a8/smtplib.py
SyntaxError: assignment to generator expression not possible (<doctest test.test_genexps.__test__.doctests[38]>, line 1)
SyntaxError: assignment to generator expression not possible (<doctest test.test_genexps.__test__.doctests[40]>, line 1)
>>> def f(n):
37c0844b35b9a4d68f7ddf3a8b38d3e013f17d78 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37c0844b35b9a4d68f7ddf3a8b38d3e013f17d78/test_genexps.py
SyntaxError: augmented assignment to generator expression not possible (<doctest test.test_genexps.__test__.doctests[39]>, line 1)
SyntaxError: augmented assignment to generator expression not possible (<doctest test.test_genexps.__test__.doctests[41]>, line 1)
>>> def f(n):
37c0844b35b9a4d68f7ddf3a8b38d3e013f17d78 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37c0844b35b9a4d68f7ddf3a8b38d3e013f17d78/test_genexps.py
usage: idle.py [-c command] [-d] [-e] [-s] [-t title] [arg] ... -c command run this command -d enable debugger -e edit mode; arguments are files to be edited -s run $IDLESTARTUP or $PYTHONSTARTUP before anything else -t title set title of shell window When neither -c nor -e is used, and there are arguments, and the first argument is not '-', the first argument is run as a script. Remaining arguments are arguments to the script or to the command run by -c.
usage: idle.py [-c command] [-d] [-i] [-r script] [-s] [-t title] [arg] ... idle file(s) (without options) edit the file(s) -c cmd run the command in a shell -d enable the debugger -i open an interactive shell -i file(s) open a shell and also an editor window for each file -r script run a file as a script in a shell -s run $IDLESTARTUP or $PYTHONSTARTUP before anything else -t title set title of shell window Remaining arguments are applied to the command (-c) or script (-r).
def isatty(self): return 1
96d88422373ffb32aef75157647e0575a0471c03 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/96d88422373ffb32aef75157647e0575a0471c03/PyShell.py
opts, args = getopt.getopt(argv, "c:deist:")
opts, args = getopt.getopt(argv, "c:dir:st:")
def main(self, argv, noshell): cmd = None edit = 0 debug = 0 startup = 0 try: opts, args = getopt.getopt(argv, "c:deist:") except getopt.error, msg: sys.stderr.write("Error: %s\n" % str(msg)) sys.stderr.write(usage_msg) sys.exit(2) for o, a in opts: noshell = 0 if o == '-c': cmd = a if o == '-d': debug = 1 if o == '-e': edit = 1 if o == '-s': startup = 1 if o == '-t': PyShell.shell_title = a if noshell: edit=1 for i in range(len(sys.path)): sys.path[i] = os.path.abspath(sys.path[i]) pathx = [] if edit: for filename in args: pathx.append(os.path.dirname(filename)) elif args and args[0] != "-": pathx.append(os.path.dirname(args[0])) else: pathx.append(os.curdir) for dir in pathx: dir = os.path.abspath(dir) if not dir in sys.path: sys.path.insert(0, dir)
96d88422373ffb32aef75157647e0575a0471c03 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/96d88422373ffb32aef75157647e0575a0471c03/PyShell.py
noshell = 0
noshell = 0
def main(self, argv, noshell): cmd = None edit = 0 debug = 0 startup = 0 try: opts, args = getopt.getopt(argv, "c:deist:") except getopt.error, msg: sys.stderr.write("Error: %s\n" % str(msg)) sys.stderr.write(usage_msg) sys.exit(2) for o, a in opts: noshell = 0 if o == '-c': cmd = a if o == '-d': debug = 1 if o == '-e': edit = 1 if o == '-s': startup = 1 if o == '-t': PyShell.shell_title = a if noshell: edit=1 for i in range(len(sys.path)): sys.path[i] = os.path.abspath(sys.path[i]) pathx = [] if edit: for filename in args: pathx.append(os.path.dirname(filename)) elif args and args[0] != "-": pathx.append(os.path.dirname(args[0])) else: pathx.append(os.curdir) for dir in pathx: dir = os.path.abspath(dir) if not dir in sys.path: sys.path.insert(0, dir)
96d88422373ffb32aef75157647e0575a0471c03 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/96d88422373ffb32aef75157647e0575a0471c03/PyShell.py
if o == '-e': edit = 1
if o == '-i': interactive = 1 if o == '-r': script = a
def main(self, argv, noshell): cmd = None edit = 0 debug = 0 startup = 0 try: opts, args = getopt.getopt(argv, "c:deist:") except getopt.error, msg: sys.stderr.write("Error: %s\n" % str(msg)) sys.stderr.write(usage_msg) sys.exit(2) for o, a in opts: noshell = 0 if o == '-c': cmd = a if o == '-d': debug = 1 if o == '-e': edit = 1 if o == '-s': startup = 1 if o == '-t': PyShell.shell_title = a if noshell: edit=1 for i in range(len(sys.path)): sys.path[i] = os.path.abspath(sys.path[i]) pathx = [] if edit: for filename in args: pathx.append(os.path.dirname(filename)) elif args and args[0] != "-": pathx.append(os.path.dirname(args[0])) else: pathx.append(os.curdir) for dir in pathx: dir = os.path.abspath(dir) if not dir in sys.path: sys.path.insert(0, dir)
96d88422373ffb32aef75157647e0575a0471c03 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/96d88422373ffb32aef75157647e0575a0471c03/PyShell.py
elif not edit and args and args[0] != "-": interp.execfile(args[0])
elif script: if os.path.isfile(script): interp.execfile(script) else: print "No script file: ", script
def main(self, argv, noshell): cmd = None edit = 0 debug = 0 startup = 0 try: opts, args = getopt.getopt(argv, "c:deist:") except getopt.error, msg: sys.stderr.write("Error: %s\n" % str(msg)) sys.stderr.write(usage_msg) sys.exit(2) for o, a in opts: noshell = 0 if o == '-c': cmd = a if o == '-d': debug = 1 if o == '-e': edit = 1 if o == '-s': startup = 1 if o == '-t': PyShell.shell_title = a if noshell: edit=1 for i in range(len(sys.path)): sys.path[i] = os.path.abspath(sys.path[i]) pathx = [] if edit: for filename in args: pathx.append(os.path.dirname(filename)) elif args and args[0] != "-": pathx.append(os.path.dirname(args[0])) else: pathx.append(os.curdir) for dir in pathx: dir = os.path.abspath(dir) if not dir in sys.path: sys.path.insert(0, dir)
96d88422373ffb32aef75157647e0575a0471c03 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/96d88422373ffb32aef75157647e0575a0471c03/PyShell.py
compile(file)
compileFile(file)
def wrap_aug(node): return wrapper[node.__class__](node)
57911ae35a76276997fb51afb78f0a8dfeb684b8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/57911ae35a76276997fb51afb78f0a8dfeb684b8/pycodegen.py
return '[Errno %d] %s: %s' % (self.errno, self.strerror,
return '[Errno %s] %s: %s' % (self.errno, self.strerror,
def __str__(self): if self.filename: return '[Errno %d] %s: %s' % (self.errno, self.strerror, self.filename) elif self.errno and self.strerror: return '[Errno %d] %s' % (self.errno, self.strerror) else: return StandardError.__str__(self)
ec8c8c2ef2cac83a12b249c4e6ba4c62c018bfdc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ec8c8c2ef2cac83a12b249c4e6ba4c62c018bfdc/exceptions.py
return '[Errno %d] %s' % (self.errno, self.strerror)
return '[Errno %s] %s' % (self.errno, self.strerror)
def __str__(self): if self.filename: return '[Errno %d] %s: %s' % (self.errno, self.strerror, self.filename) elif self.errno and self.strerror: return '[Errno %d] %s' % (self.errno, self.strerror) else: return StandardError.__str__(self)
ec8c8c2ef2cac83a12b249c4e6ba4c62c018bfdc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ec8c8c2ef2cac83a12b249c4e6ba4c62c018bfdc/exceptions.py
def __init__(self, counts=None, calledfuncs=None, infile=None, outfile=None):
def __init__(self, counts=None, calledfuncs=None, infile=None, outfile=None):
def __init__(self, counts=None, calledfuncs=None, infile=None, outfile=None): self.counts = counts if self.counts is None: self.counts = {} self.counter = self.counts.copy() # map (filename, lineno) to count self.calledfuncs = calledfuncs if self.calledfuncs is None: self.calledfuncs = {} self.calledfuncs = self.calledfuncs.copy() self.infile = infile self.outfile = outfile if self.infile: # try and merge existing counts file try: thingie = pickle.load(open(self.infile, 'r')) if type(thingie) is types.DictType: # backwards compatibility for old trace.py after Zooko touched it but before calledfuncs --Zooko 2001-10-24 self.update(self.__class__(thingie)) elif type(thingie) is types.TupleType and len(thingie) == 2: counts, calledfuncs = thingie self.update(self.__class__(counts, calledfuncs)) except (IOError, EOFError): pass except pickle.UnpicklingError: # backwards compatibility for old trace.py before Zooko touched it --Zooko 2001-10-24 self.update(self.__class__(marshal.load(open(self.infile))))
6bf45c67523a8e81963ce645979ac85f4f75ef33 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6bf45c67523a8e81963ce645979ac85f4f75ef33/trace.py
def __init__(self, counts=None, calledfuncs=None, infile=None, outfile=None): self.counts = counts if self.counts is None: self.counts = {} self.counter = self.counts.copy() # map (filename, lineno) to count self.calledfuncs = calledfuncs if self.calledfuncs is None: self.calledfuncs = {} self.calledfuncs = self.calledfuncs.copy() self.infile = infile self.outfile = outfile if self.infile: # try and merge existing counts file try: thingie = pickle.load(open(self.infile, 'r')) if type(thingie) is types.DictType: # backwards compatibility for old trace.py after Zooko touched it but before calledfuncs --Zooko 2001-10-24 self.update(self.__class__(thingie)) elif type(thingie) is types.TupleType and len(thingie) == 2: counts, calledfuncs = thingie self.update(self.__class__(counts, calledfuncs)) except (IOError, EOFError): pass except pickle.UnpicklingError: # backwards compatibility for old trace.py before Zooko touched it --Zooko 2001-10-24 self.update(self.__class__(marshal.load(open(self.infile))))
6bf45c67523a8e81963ce645979ac85f4f75ef33 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6bf45c67523a8e81963ce645979ac85f4f75ef33/trace.py
def __init__(self, counts=None, calledfuncs=None, infile=None, outfile=None): self.counts = counts if self.counts is None: self.counts = {} self.counter = self.counts.copy() # map (filename, lineno) to count self.calledfuncs = calledfuncs if self.calledfuncs is None: self.calledfuncs = {} self.calledfuncs = self.calledfuncs.copy() self.infile = infile self.outfile = outfile if self.infile: # try and merge existing counts file try: thingie = pickle.load(open(self.infile, 'r')) if type(thingie) is types.DictType: # backwards compatibility for old trace.py after Zooko touched it but before calledfuncs --Zooko 2001-10-24 self.update(self.__class__(thingie)) elif type(thingie) is types.TupleType and len(thingie) == 2: counts, calledfuncs = thingie self.update(self.__class__(counts, calledfuncs)) except (IOError, EOFError): pass except pickle.UnpicklingError: # backwards compatibility for old trace.py before Zooko touched it --Zooko 2001-10-24 self.update(self.__class__(marshal.load(open(self.infile))))
6bf45c67523a8e81963ce645979ac85f4f75ef33 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6bf45c67523a8e81963ce645979ac85f4f75ef33/trace.py
if key != 'calledfuncs':
if key != 'calledfuncs':
def update(self, other): """Merge in the data from another CoverageResults""" counts = self.counts calledfuncs = self.calledfuncs other_counts = other.counts other_calledfuncs = other.calledfuncs
6bf45c67523a8e81963ce645979ac85f4f75ef33 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6bf45c67523a8e81963ce645979ac85f4f75ef33/trace.py
def __init__(self, count=1, trace=1, countfuncs=0, ignoremods=(), ignoredirs=(), infile=None, outfile=None):
def __init__(self, count=1, trace=1, countfuncs=0, ignoremods=(), ignoredirs=(), infile=None, outfile=None):
def __init__(self, count=1, trace=1, countfuncs=0, ignoremods=(), ignoredirs=(), infile=None, outfile=None): """ @param count true iff it should count number of times each line is executed @param trace true iff it should print out each line that is being counted @param countfuncs true iff it should just output a list of (filename, modulename, funcname,) for functions that were called at least once; This overrides `count' and `trace' @param ignoremods a list of the names of modules to ignore @param ignoredirs a list of the names of directories to ignore all of the (recursive) contents of @param infile file from which to read stored counts to be added into the results @param outfile file in which to write the results """ self.infile = infile self.outfile = outfile self.ignore = Ignore(ignoremods, ignoredirs) self.counts = {} # keys are (filename, linenumber) self.blabbed = {} # for debugging self.pathtobasename = {} # for memoizing os.path.basename self.donothing = 0 self.trace = trace self._calledfuncs = {} if countfuncs: self.globaltrace = self.globaltrace_countfuncs elif trace and count: self.globaltrace = self.globaltrace_lt self.localtrace = self.localtrace_trace_and_count elif trace: self.globaltrace = self.globaltrace_lt self.localtrace = self.localtrace_trace elif count: self.globaltrace = self.globaltrace_lt self.localtrace = self.localtrace_count else: # Ahem -- do nothing? Okay. self.donothing = 1
6bf45c67523a8e81963ce645979ac85f4f75ef33 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6bf45c67523a8e81963ce645979ac85f4f75ef33/trace.py
@param count true iff it should count number of times each line is executed @param trace true iff it should print out each line that is being counted @param countfuncs true iff it should just output a list of (filename, modulename, funcname,) for functions that were called at least once; This overrides `count' and `trace'
@param count true iff it should count number of times each line is executed @param trace true iff it should print out each line that is being counted @param countfuncs true iff it should just output a list of (filename, modulename, funcname,) for functions that were called at least once; This overrides `count' and `trace'
def __init__(self, count=1, trace=1, countfuncs=0, ignoremods=(), ignoredirs=(), infile=None, outfile=None): """ @param count true iff it should count number of times each line is executed @param trace true iff it should print out each line that is being counted @param countfuncs true iff it should just output a list of (filename, modulename, funcname,) for functions that were called at least once; This overrides `count' and `trace' @param ignoremods a list of the names of modules to ignore @param ignoredirs a list of the names of directories to ignore all of the (recursive) contents of @param infile file from which to read stored counts to be added into the results @param outfile file in which to write the results """ self.infile = infile self.outfile = outfile self.ignore = Ignore(ignoremods, ignoredirs) self.counts = {} # keys are (filename, linenumber) self.blabbed = {} # for debugging self.pathtobasename = {} # for memoizing os.path.basename self.donothing = 0 self.trace = trace self._calledfuncs = {} if countfuncs: self.globaltrace = self.globaltrace_countfuncs elif trace and count: self.globaltrace = self.globaltrace_lt self.localtrace = self.localtrace_trace_and_count elif trace: self.globaltrace = self.globaltrace_lt self.localtrace = self.localtrace_trace elif count: self.globaltrace = self.globaltrace_lt self.localtrace = self.localtrace_count else: # Ahem -- do nothing? Okay. self.donothing = 1
6bf45c67523a8e81963ce645979ac85f4f75ef33 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6bf45c67523a8e81963ce645979ac85f4f75ef33/trace.py
@param ignoredirs a list of the names of directories to ignore all of the (recursive) contents of @param infile file from which to read stored counts to be added into the results
@param ignoredirs a list of the names of directories to ignore all of the (recursive) contents of @param infile file from which to read stored counts to be added into the results
def __init__(self, count=1, trace=1, countfuncs=0, ignoremods=(), ignoredirs=(), infile=None, outfile=None): """ @param count true iff it should count number of times each line is executed @param trace true iff it should print out each line that is being counted @param countfuncs true iff it should just output a list of (filename, modulename, funcname,) for functions that were called at least once; This overrides `count' and `trace' @param ignoremods a list of the names of modules to ignore @param ignoredirs a list of the names of directories to ignore all of the (recursive) contents of @param infile file from which to read stored counts to be added into the results @param outfile file in which to write the results """ self.infile = infile self.outfile = outfile self.ignore = Ignore(ignoremods, ignoredirs) self.counts = {} # keys are (filename, linenumber) self.blabbed = {} # for debugging self.pathtobasename = {} # for memoizing os.path.basename self.donothing = 0 self.trace = trace self._calledfuncs = {} if countfuncs: self.globaltrace = self.globaltrace_countfuncs elif trace and count: self.globaltrace = self.globaltrace_lt self.localtrace = self.localtrace_trace_and_count elif trace: self.globaltrace = self.globaltrace_lt self.localtrace = self.localtrace_trace elif count: self.globaltrace = self.globaltrace_lt self.localtrace = self.localtrace_count else: # Ahem -- do nothing? Okay. self.donothing = 1
6bf45c67523a8e81963ce645979ac85f4f75ef33 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6bf45c67523a8e81963ce645979ac85f4f75ef33/trace.py
key = (filename, lineno,)
key = filename, lineno
def localtrace_trace_and_count(self, frame, why, arg): if why == 'line': # record the file name and line number of every trace # XXX I wish inspect offered me an optimized # `getfilename(frame)' to use in place of the presumably # heavier `getframeinfo()'. --Zooko 2001-10-14 filename, lineno, funcname, context, lineindex = \ inspect.getframeinfo(frame, 1) key = (filename, lineno,) self.counts[key] = self.counts.get(key, 0) + 1 # XXX not convinced that this memoizing is a performance # win -- I don't know enough about Python guts to tell. # --Zooko 2001-10-14 bname = self.pathtobasename.get(filename) if bname is None: # Using setdefault faster than two separate lines? # --Zooko 2001-10-14 bname = self.pathtobasename.setdefault(filename, os.path.basename(filename)) try: print "%s(%d): %s" % (bname, lineno, context[lineindex]), except IndexError: # Uh.. sometimes getframeinfo gives me a context of # length 1 and a lineindex of -2. Oh well. pass return self.localtrace
6bf45c67523a8e81963ce645979ac85f4f75ef33 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6bf45c67523a8e81963ce645979ac85f4f75ef33/trace.py
listfuncs = false
listfuncs = False
def main(argv=None): import getopt if argv is None: argv = sys.argv try: opts, prog_argv = getopt.getopt(argv[1:], "tcrRf:d:msC:l", ["help", "version", "trace", "count", "report", "no-report", "file=", "missing", "ignore-module=", "ignore-dir=", "coverdir=", "listfuncs",]) except getopt.error, msg: sys.stderr.write("%s: %s\n" % (sys.argv[0], msg)) sys.stderr.write("Try `%s --help' for more information\n" % sys.argv[0]) sys.exit(1) trace = 0 count = 0 report = 0 no_report = 0 counts_file = None missing = 0 ignore_modules = [] ignore_dirs = [] coverdir = None summary = 0 listfuncs = false for opt, val in opts: if opt == "--help": usage(sys.stdout) sys.exit(0) if opt == "--version": sys.stdout.write("trace 2.0\n") sys.exit(0) if opt == "-l" or opt == "--listfuncs": listfuncs = true continue if opt == "-t" or opt == "--trace": trace = 1 continue if opt == "-c" or opt == "--count": count = 1 continue if opt == "-r" or opt == "--report": report = 1 continue if opt == "-R" or opt == "--no-report": no_report = 1 continue if opt == "-f" or opt == "--file": counts_file = val continue if opt == "-m" or opt == "--missing": missing = 1 continue if opt == "-C" or opt == "--coverdir": coverdir = val continue if opt == "-s" or opt == "--summary": summary = 1 continue if opt == "--ignore-module": ignore_modules.append(val) continue if opt == "--ignore-dir": for s in val.split(os.pathsep): s = os.path.expandvars(s) # should I also call expanduser? (after all, could use $HOME) s = s.replace("$prefix", os.path.join(sys.prefix, "lib", "python" + sys.version[:3])) s = s.replace("$exec_prefix", os.path.join(sys.exec_prefix, "lib", "python" + sys.version[:3])) s = os.path.normpath(s) ignore_dirs.append(s) continue assert 0, "Should never get here" if listfuncs and (count or trace): _err_exit("cannot specify both --listfuncs and (--trace or --count)") if not count and not trace and not report and not listfuncs: _err_exit("must specify one of --trace, --count, --report or --listfuncs") if report and no_report: _err_exit("cannot specify both --report and --no-report") if report and not counts_file: _err_exit("--report requires a --file") if no_report and len(prog_argv) == 0: _err_exit("missing name of file to run") # everything is ready if report: results = CoverageResults(infile=counts_file, outfile=counts_file) results.write_results(missing, summary=summary, coverdir=coverdir) else: sys.argv = prog_argv progname = prog_argv[0] sys.path[0] = os.path.split(progname)[0] t = Trace(count, trace, countfuncs=listfuncs, ignoremods=ignore_modules, ignoredirs=ignore_dirs, infile=counts_file, outfile=counts_file) try: t.run('execfile(' + `progname` + ')') except IOError, err: _err_exit("Cannot run file %s because: %s" % (`sys.argv[0]`, err)) except SystemExit: pass results = t.results() if not no_report: results.write_results(missing, summary=summary, coverdir=coverdir)
6bf45c67523a8e81963ce645979ac85f4f75ef33 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6bf45c67523a8e81963ce645979ac85f4f75ef33/trace.py
listfuncs = true
listfuncs = True
def main(argv=None): import getopt if argv is None: argv = sys.argv try: opts, prog_argv = getopt.getopt(argv[1:], "tcrRf:d:msC:l", ["help", "version", "trace", "count", "report", "no-report", "file=", "missing", "ignore-module=", "ignore-dir=", "coverdir=", "listfuncs",]) except getopt.error, msg: sys.stderr.write("%s: %s\n" % (sys.argv[0], msg)) sys.stderr.write("Try `%s --help' for more information\n" % sys.argv[0]) sys.exit(1) trace = 0 count = 0 report = 0 no_report = 0 counts_file = None missing = 0 ignore_modules = [] ignore_dirs = [] coverdir = None summary = 0 listfuncs = false for opt, val in opts: if opt == "--help": usage(sys.stdout) sys.exit(0) if opt == "--version": sys.stdout.write("trace 2.0\n") sys.exit(0) if opt == "-l" or opt == "--listfuncs": listfuncs = true continue if opt == "-t" or opt == "--trace": trace = 1 continue if opt == "-c" or opt == "--count": count = 1 continue if opt == "-r" or opt == "--report": report = 1 continue if opt == "-R" or opt == "--no-report": no_report = 1 continue if opt == "-f" or opt == "--file": counts_file = val continue if opt == "-m" or opt == "--missing": missing = 1 continue if opt == "-C" or opt == "--coverdir": coverdir = val continue if opt == "-s" or opt == "--summary": summary = 1 continue if opt == "--ignore-module": ignore_modules.append(val) continue if opt == "--ignore-dir": for s in val.split(os.pathsep): s = os.path.expandvars(s) # should I also call expanduser? (after all, could use $HOME) s = s.replace("$prefix", os.path.join(sys.prefix, "lib", "python" + sys.version[:3])) s = s.replace("$exec_prefix", os.path.join(sys.exec_prefix, "lib", "python" + sys.version[:3])) s = os.path.normpath(s) ignore_dirs.append(s) continue assert 0, "Should never get here" if listfuncs and (count or trace): _err_exit("cannot specify both --listfuncs and (--trace or --count)") if not count and not trace and not report and not listfuncs: _err_exit("must specify one of --trace, --count, --report or --listfuncs") if report and no_report: _err_exit("cannot specify both --report and --no-report") if report and not counts_file: _err_exit("--report requires a --file") if no_report and len(prog_argv) == 0: _err_exit("missing name of file to run") # everything is ready if report: results = CoverageResults(infile=counts_file, outfile=counts_file) results.write_results(missing, summary=summary, coverdir=coverdir) else: sys.argv = prog_argv progname = prog_argv[0] sys.path[0] = os.path.split(progname)[0] t = Trace(count, trace, countfuncs=listfuncs, ignoremods=ignore_modules, ignoredirs=ignore_dirs, infile=counts_file, outfile=counts_file) try: t.run('execfile(' + `progname` + ')') except IOError, err: _err_exit("Cannot run file %s because: %s" % (`sys.argv[0]`, err)) except SystemExit: pass results = t.results() if not no_report: results.write_results(missing, summary=summary, coverdir=coverdir)
6bf45c67523a8e81963ce645979ac85f4f75ef33 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6bf45c67523a8e81963ce645979ac85f4f75ef33/trace.py
print "usage:", sys.argv[0], "file ..."
print "usage:", sys.argv[0], "[-t tabwidth] file ..."
def main(): tabsize = 8 try: opts, args = getopt.getopt(sys.argv[1:], "t:") if not args: raise getopt.error, "At least one file argument required" except getopt.error, msg: print msg print "usage:", sys.argv[0], "file ..." return for file in args: process(file, tabsize)
8fd0f147e74138b8046ba42c083e61e24dfecad2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8fd0f147e74138b8046ba42c083e61e24dfecad2/untabify.py
def urlparse(url, scheme = '', allow_framents = 1): key = url, scheme, allow_framents
def urlparse(url, scheme = '', allow_fragments = 1): key = url, scheme, allow_fragments
def urlparse(url, scheme = '', allow_framents = 1): key = url, scheme, allow_framents try: return _parse_cache[key] except KeyError: pass if len(_parse_cache) >= MAX_CACHE_SIZE: # avoid runaway growth clear_cache() netloc = path = params = query = fragment = '' i = string.find(url, ':') if i > 0: for c in url[:i]: if c not in scheme_chars: break else: scheme, url = string.lower(url[:i]), url[i+1:] if scheme in uses_netloc: if url[:2] == '//': i = string.find(url, '/', 2) if i < 0: i = len(url) netloc, url = url[2:i], url[i:] if allow_framents and scheme in uses_fragment: i = string.rfind(url, '#') if i >= 0: url, fragment = url[:i], url[i+1:] if scheme in uses_query: i = string.find(url, '?') if i >= 0: url, query = url[:i], url[i+1:] if scheme in uses_params: i = string.find(url, ';') if i >= 0: url, params = url[:i], url[i+1:] tuple = scheme, netloc, url, params, query, fragment _parse_cache[key] = tuple return tuple
4722da6ebf96cbe0e0699e935fecc717c04a4b42 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4722da6ebf96cbe0e0699e935fecc717c04a4b42/urlparse.py
if allow_framents and scheme in uses_fragment:
if allow_fragments and scheme in uses_fragment:
def urlparse(url, scheme = '', allow_framents = 1): key = url, scheme, allow_framents try: return _parse_cache[key] except KeyError: pass if len(_parse_cache) >= MAX_CACHE_SIZE: # avoid runaway growth clear_cache() netloc = path = params = query = fragment = '' i = string.find(url, ':') if i > 0: for c in url[:i]: if c not in scheme_chars: break else: scheme, url = string.lower(url[:i]), url[i+1:] if scheme in uses_netloc: if url[:2] == '//': i = string.find(url, '/', 2) if i < 0: i = len(url) netloc, url = url[2:i], url[i:] if allow_framents and scheme in uses_fragment: i = string.rfind(url, '#') if i >= 0: url, fragment = url[:i], url[i+1:] if scheme in uses_query: i = string.find(url, '?') if i >= 0: url, query = url[:i], url[i+1:] if scheme in uses_params: i = string.find(url, ';') if i >= 0: url, params = url[:i], url[i+1:] tuple = scheme, netloc, url, params, query, fragment _parse_cache[key] = tuple return tuple
4722da6ebf96cbe0e0699e935fecc717c04a4b42 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4722da6ebf96cbe0e0699e935fecc717c04a4b42/urlparse.py
def urljoin(base, url, allow_framents = 1):
def urljoin(base, url, allow_fragments = 1):
def urljoin(base, url, allow_framents = 1): if not base: return url bscheme, bnetloc, bpath, bparams, bquery, bfragment = \ urlparse(base, '', allow_framents) scheme, netloc, path, params, query, fragment = \ urlparse(url, bscheme, allow_framents) # XXX Unofficial hack: default netloc to bnetloc even if # schemes differ if scheme != bscheme and not netloc and \ scheme in uses_relative and bscheme in uses_relative and \ scheme in uses_netloc and bscheme in uses_netloc: netloc = bnetloc # Strip the port number i = find(netloc, '@') if i < 0: i = 0 i = find(netloc, ':', i) if i >= 0: netloc = netloc[:i] if scheme != bscheme or scheme not in uses_relative: return urlunparse((scheme, netloc, path, params, query, fragment)) if scheme in uses_netloc: if netloc: return urlunparse((scheme, netloc, path, params, query, fragment)) netloc = bnetloc if path[:1] == '/': return urlunparse((scheme, netloc, path, params, query, fragment)) if not path: return urlunparse((scheme, netloc, bpath, params, query or bquery, fragment)) i = rfind(bpath, '/') if i >= 0: path = bpath[:i] + '/' + path segments = splitfields(path, '/') if segments[-1] == '.': segments[-1] = '' while '.' in segments: segments.remove('.') while 1: i = 1 n = len(segments) - 1 while i < n: if segments[i] == '..' and segments[i-1]: del segments[i-1:i+1] break i = i+1 else: break if len(segments) == 2 and segments[1] == '..' and segments[0] == '': segments[-1] = '' elif len(segments) >= 2 and segments[-1] == '..': segments[-2:] = [''] return urlunparse((scheme, netloc, joinfields(segments, '/'), params, query, fragment))
4722da6ebf96cbe0e0699e935fecc717c04a4b42 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4722da6ebf96cbe0e0699e935fecc717c04a4b42/urlparse.py
urlparse(base, '', allow_framents)
urlparse(base, '', allow_fragments)
def urljoin(base, url, allow_framents = 1): if not base: return url bscheme, bnetloc, bpath, bparams, bquery, bfragment = \ urlparse(base, '', allow_framents) scheme, netloc, path, params, query, fragment = \ urlparse(url, bscheme, allow_framents) # XXX Unofficial hack: default netloc to bnetloc even if # schemes differ if scheme != bscheme and not netloc and \ scheme in uses_relative and bscheme in uses_relative and \ scheme in uses_netloc and bscheme in uses_netloc: netloc = bnetloc # Strip the port number i = find(netloc, '@') if i < 0: i = 0 i = find(netloc, ':', i) if i >= 0: netloc = netloc[:i] if scheme != bscheme or scheme not in uses_relative: return urlunparse((scheme, netloc, path, params, query, fragment)) if scheme in uses_netloc: if netloc: return urlunparse((scheme, netloc, path, params, query, fragment)) netloc = bnetloc if path[:1] == '/': return urlunparse((scheme, netloc, path, params, query, fragment)) if not path: return urlunparse((scheme, netloc, bpath, params, query or bquery, fragment)) i = rfind(bpath, '/') if i >= 0: path = bpath[:i] + '/' + path segments = splitfields(path, '/') if segments[-1] == '.': segments[-1] = '' while '.' in segments: segments.remove('.') while 1: i = 1 n = len(segments) - 1 while i < n: if segments[i] == '..' and segments[i-1]: del segments[i-1:i+1] break i = i+1 else: break if len(segments) == 2 and segments[1] == '..' and segments[0] == '': segments[-1] = '' elif len(segments) >= 2 and segments[-1] == '..': segments[-2:] = [''] return urlunparse((scheme, netloc, joinfields(segments, '/'), params, query, fragment))
4722da6ebf96cbe0e0699e935fecc717c04a4b42 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4722da6ebf96cbe0e0699e935fecc717c04a4b42/urlparse.py
urlparse(url, bscheme, allow_framents)
urlparse(url, bscheme, allow_fragments)
def urljoin(base, url, allow_framents = 1): if not base: return url bscheme, bnetloc, bpath, bparams, bquery, bfragment = \ urlparse(base, '', allow_framents) scheme, netloc, path, params, query, fragment = \ urlparse(url, bscheme, allow_framents) # XXX Unofficial hack: default netloc to bnetloc even if # schemes differ if scheme != bscheme and not netloc and \ scheme in uses_relative and bscheme in uses_relative and \ scheme in uses_netloc and bscheme in uses_netloc: netloc = bnetloc # Strip the port number i = find(netloc, '@') if i < 0: i = 0 i = find(netloc, ':', i) if i >= 0: netloc = netloc[:i] if scheme != bscheme or scheme not in uses_relative: return urlunparse((scheme, netloc, path, params, query, fragment)) if scheme in uses_netloc: if netloc: return urlunparse((scheme, netloc, path, params, query, fragment)) netloc = bnetloc if path[:1] == '/': return urlunparse((scheme, netloc, path, params, query, fragment)) if not path: return urlunparse((scheme, netloc, bpath, params, query or bquery, fragment)) i = rfind(bpath, '/') if i >= 0: path = bpath[:i] + '/' + path segments = splitfields(path, '/') if segments[-1] == '.': segments[-1] = '' while '.' in segments: segments.remove('.') while 1: i = 1 n = len(segments) - 1 while i < n: if segments[i] == '..' and segments[i-1]: del segments[i-1:i+1] break i = i+1 else: break if len(segments) == 2 and segments[1] == '..' and segments[0] == '': segments[-1] = '' elif len(segments) >= 2 and segments[-1] == '..': segments[-2:] = [''] return urlunparse((scheme, netloc, joinfields(segments, '/'), params, query, fragment))
4722da6ebf96cbe0e0699e935fecc717c04a4b42 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4722da6ebf96cbe0e0699e935fecc717c04a4b42/urlparse.py
def main(): testtype('c', 'c') for type in (['b', 'h', 'i', 'l', 'f', 'd']): testtype(type, 1) unlink(TESTFN)
99866336094bd432860d32dd368f5934683939e7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/99866336094bd432860d32dd368f5934683939e7/test_array.py
testtype('u', u'\u263a')
def main(): testtype('c', 'c') for type in (['b', 'h', 'i', 'l', 'f', 'd']): testtype(type, 1) unlink(TESTFN)
99866336094bd432860d32dd368f5934683939e7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/99866336094bd432860d32dd368f5934683939e7/test_array.py
testunicode() testsubclassing()
def main(): testtype('c', 'c') for type in (['b', 'h', 'i', 'l', 'f', 'd']): testtype(type, 1) unlink(TESTFN)
99866336094bd432860d32dd368f5934683939e7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/99866336094bd432860d32dd368f5934683939e7/test_array.py
contents = contents[:i-1] + contents[i:]
if event.char: contents = contents[:i-1] + contents[i:] icursor = icursor-1
def __normalize(self, event=None): ew = event.widget contents = ew.get() icursor = ew.index(INSERT) if contents == '': contents = '0' # figure out what the contents value is in the current base try: if self.__hexp.get(): v = string.atoi(contents, 16) else: v = string.atoi(contents) except ValueError: v = None # if value is not legal, delete the last character inserted and ring # the bell if v is None or v < 0 or v > 255: i = ew.index(INSERT) contents = contents[:i-1] + contents[i:] ew.bell() icursor = icursor-1 elif self.__hexp.get(): contents = hex(v) else: contents = int(v) ew.delete(0, END) ew.insert(0, contents) ew.icursor(icursor)
8934af00d8a99e606729b96c34e8da6fb9c9123c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8934af00d8a99e606729b96c34e8da6fb9c9123c/TypeinViewer.py
icursor = icursor-1
def __normalize(self, event=None): ew = event.widget contents = ew.get() icursor = ew.index(INSERT) if contents == '': contents = '0' # figure out what the contents value is in the current base try: if self.__hexp.get(): v = string.atoi(contents, 16) else: v = string.atoi(contents) except ValueError: v = None # if value is not legal, delete the last character inserted and ring # the bell if v is None or v < 0 or v > 255: i = ew.index(INSERT) contents = contents[:i-1] + contents[i:] ew.bell() icursor = icursor-1 elif self.__hexp.get(): contents = hex(v) else: contents = int(v) ew.delete(0, END) ew.insert(0, contents) ew.icursor(icursor)
8934af00d8a99e606729b96c34e8da6fb9c9123c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8934af00d8a99e606729b96c34e8da6fb9c9123c/TypeinViewer.py
self.__x.delete(0, END) self.__y.delete(0, END) self.__z.delete(0, END) self.__x.insert(0, redstr) self.__y.insert(0, greenstr) self.__z.insert(0, bluestr)
x, y, z = self.__x, self.__y, self.__z xicursor = x.index(INSERT) yicursor = y.index(INSERT) zicursor = z.index(INSERT) x.delete(0, END) y.delete(0, END) z.delete(0, END) x.insert(0, redstr) y.insert(0, greenstr) z.insert(0, bluestr) x.icursor(xicursor) y.icursor(yicursor) z.icursor(zicursor)
def update_yourself(self, red, green, blue): if self.__hexp.get(): redstr, greenstr, bluestr = map(hex, (red, green, blue)) else: redstr, greenstr, bluestr = red, green, blue self.__x.delete(0, END) self.__y.delete(0, END) self.__z.delete(0, END) self.__x.insert(0, redstr) self.__y.insert(0, greenstr) self.__z.insert(0, bluestr)
8934af00d8a99e606729b96c34e8da6fb9c9123c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8934af00d8a99e606729b96c34e8da6fb9c9123c/TypeinViewer.py
import mimetools, StringIO headers = mimetools.Message(StringIO.StringIO( 'Content-Length: %d\n' % retrlen)) else: headers = noheaders()
headers += "Content-Length: %d\n" % retrlen headers = mimetools.Message(StringIO.StringIO(headers))
def open_ftp(self, url): """Use FTP protocol.""" host, path = splithost(url) if not host: raise IOError, ('ftp error', 'no host given') host, port = splitport(host) user, host = splituser(host) if user: user, passwd = splitpasswd(user) else: passwd = None host = unquote(host) user = unquote(user or '') passwd = unquote(passwd or '') host = socket.gethostbyname(host) if not port: import ftplib port = ftplib.FTP_PORT else: port = int(port) path, attrs = splitattr(path) path = unquote(path) dirs = path.split('/') dirs, file = dirs[:-1], dirs[-1] if dirs and not dirs[0]: dirs = dirs[1:] if dirs and not dirs[0]: dirs[0] = '/' key = user, host, port, '/'.join(dirs) # XXX thread unsafe! if len(self.ftpcache) > MAXFTPCACHE: # Prune the cache, rather arbitrarily for k in self.ftpcache.keys(): if k != key: v = self.ftpcache[k] del self.ftpcache[k] v.close() try: if not self.ftpcache.has_key(key): self.ftpcache[key] = \ ftpwrapper(user, passwd, host, port, dirs) if not file: type = 'D' else: type = 'I' for attr in attrs: attr, value = splitvalue(attr) if attr.lower() == 'type' and \ value in ('a', 'A', 'i', 'I', 'd', 'D'): type = value.upper() (fp, retrlen) = self.ftpcache[key].retrfile(file, type) if retrlen is not None and retrlen >= 0: import mimetools, StringIO headers = mimetools.Message(StringIO.StringIO( 'Content-Length: %d\n' % retrlen)) else: headers = noheaders() return addinfourl(fp, headers, "ftp:" + url) except ftperrors(), msg: raise IOError, ('ftp error', msg), sys.exc_info()[2]
88e0b5bee0e69b628a9358c987bf49ac885d1c21 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/88e0b5bee0e69b628a9358c987bf49ac885d1c21/urllib.py
new = Request(newurl, req.get_data())
new = Request(newurl, req.get_data(), req.headers)
def http_error_302(self, req, fp, code, msg, headers): if headers.has_key('location'): newurl = headers['location'] elif headers.has_key('uri'): newurl = headers['uri'] else: return newurl = urlparse.urljoin(req.get_full_url(), newurl)
2e250b4378dbfbd2892d215d6add14cc91e2482a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/2e250b4378dbfbd2892d215d6add14cc91e2482a/urllib2.py
testme[:42] testme[:42] = "The Answer" del testme[:42]
import sys if sys.platform[:4] != 'java': testme[:42] testme[:42] = "The Answer" del testme[:42] else: print "__getitem__: (slice(0, 42, None),)" print "__setitem__: (slice(0, 42, None), 'The Answer')" print "__delitem__: (slice(0, 42, None),)"
exec """def __%(method)s__(self, *args): print "__%(method)s__:", args
07d8d6415fcddd1149981a9d8de9afd5d829178b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/07d8d6415fcddd1149981a9d8de9afd5d829178b/test_class.py
int(testme) long(testme) float(testme) oct(testme) hex(testme)
if sys.platform[:4] != 'java': int(testme) long(testme) float(testme) oct(testme) hex(testme) else: print "__int__: ()" print "__long__: ()" print "__float__: ()" print "__oct__: ()" print "__hex__: ()"
exec """def __%(method)s__(self, *args): print "__%(method)s__:", args
07d8d6415fcddd1149981a9d8de9afd5d829178b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/07d8d6415fcddd1149981a9d8de9afd5d829178b/test_class.py
if sys.platform[:4] == 'java': import java java.lang.System.gc()
exec """def __%(method)s__(self, *args): print "__%(method)s__:", args
07d8d6415fcddd1149981a9d8de9afd5d829178b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/07d8d6415fcddd1149981a9d8de9afd5d829178b/test_class.py
def fixupOrderForward(self, blocks, default_next): """Make sure all JUMP_FORWARDs jump forward""" index = {} chains = [] cur = [] for b in blocks: index[b] = len(chains) cur.append(b) if b.next and b.next[0] == default_next: chains.append(cur) cur = [] chains.append(cur)
138d90eb73415e48a0e7f09a7c9603b1164bcaed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/138d90eb73415e48a0e7f09a7c9603b1164bcaed/pyassem.py
self.stacksize = findDepth(self.insts)
def flattenGraph(self): """Arrange the blocks in order and resolve jumps""" assert self.stage == RAW self.insts = insts = [] pc = 0 begin = {} end = {} for b in self.getBlocksInOrder(): begin[b] = pc for inst in b.getInstructions(): insts.append(inst) if len(inst) == 1: pc = pc + 1 else: # arg takes 2 bytes pc = pc + 3 end[b] = pc pc = 0 for i in range(len(insts)): inst = insts[i] if len(inst) == 1: pc = pc + 1 else: pc = pc + 3 opname = inst[0] if self.hasjrel.has_elt(opname): oparg = inst[1] offset = begin[oparg] - pc insts[i] = opname, offset elif self.hasjabs.has_elt(opname): insts[i] = opname, begin[inst[1]] self.stacksize = findDepth(self.insts) self.stage = FLAT
138d90eb73415e48a0e7f09a7c9603b1164bcaed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/138d90eb73415e48a0e7f09a7c9603b1164bcaed/pyassem.py
def findDepth(self, insts):
def findDepth(self, insts, debug=0):
def findDepth(self, insts): depth = 0 maxDepth = 0 for i in insts: opname = i[0] delta = self.effect.get(opname, 0) if delta > 1: depth = depth + delta elif delta < 0: if depth > maxDepth: maxDepth = depth depth = depth + delta else: if depth > maxDepth: maxDepth = depth # now check patterns for pat, pat_delta in self.patterns: if opname[:len(pat)] == pat: delta = pat_delta depth = depth + delta break # if we still haven't found a match if delta == 0: meth = getattr(self, opname, None) if meth is not None: depth = depth + meth(i[1]) if depth < 0: depth = 0 return maxDepth
138d90eb73415e48a0e7f09a7c9603b1164bcaed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/138d90eb73415e48a0e7f09a7c9603b1164bcaed/pyassem.py
delta = self.effect.get(opname, 0) if delta > 1: depth = depth + delta elif delta < 0: if depth > maxDepth: maxDepth = depth
if debug: print i, delta = self.effect.get(opname, None) if delta is not None:
def findDepth(self, insts): depth = 0 maxDepth = 0 for i in insts: opname = i[0] delta = self.effect.get(opname, 0) if delta > 1: depth = depth + delta elif delta < 0: if depth > maxDepth: maxDepth = depth depth = depth + delta else: if depth > maxDepth: maxDepth = depth # now check patterns for pat, pat_delta in self.patterns: if opname[:len(pat)] == pat: delta = pat_delta depth = depth + delta break # if we still haven't found a match if delta == 0: meth = getattr(self, opname, None) if meth is not None: depth = depth + meth(i[1]) if depth < 0: depth = 0 return maxDepth
138d90eb73415e48a0e7f09a7c9603b1164bcaed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/138d90eb73415e48a0e7f09a7c9603b1164bcaed/pyassem.py
if depth > maxDepth: maxDepth = depth
def findDepth(self, insts): depth = 0 maxDepth = 0 for i in insts: opname = i[0] delta = self.effect.get(opname, 0) if delta > 1: depth = depth + delta elif delta < 0: if depth > maxDepth: maxDepth = depth depth = depth + delta else: if depth > maxDepth: maxDepth = depth # now check patterns for pat, pat_delta in self.patterns: if opname[:len(pat)] == pat: delta = pat_delta depth = depth + delta break # if we still haven't found a match if delta == 0: meth = getattr(self, opname, None) if meth is not None: depth = depth + meth(i[1]) if depth < 0: depth = 0 return maxDepth
138d90eb73415e48a0e7f09a7c9603b1164bcaed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/138d90eb73415e48a0e7f09a7c9603b1164bcaed/pyassem.py
if delta == 0:
if delta is None:
def findDepth(self, insts): depth = 0 maxDepth = 0 for i in insts: opname = i[0] delta = self.effect.get(opname, 0) if delta > 1: depth = depth + delta elif delta < 0: if depth > maxDepth: maxDepth = depth depth = depth + delta else: if depth > maxDepth: maxDepth = depth # now check patterns for pat, pat_delta in self.patterns: if opname[:len(pat)] == pat: delta = pat_delta depth = depth + delta break # if we still haven't found a match if delta == 0: meth = getattr(self, opname, None) if meth is not None: depth = depth + meth(i[1]) if depth < 0: depth = 0 return maxDepth
138d90eb73415e48a0e7f09a7c9603b1164bcaed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/138d90eb73415e48a0e7f09a7c9603b1164bcaed/pyassem.py
if depth < 0: depth = 0
if depth > maxDepth: maxDepth = depth if debug: print depth, maxDepth
def findDepth(self, insts): depth = 0 maxDepth = 0 for i in insts: opname = i[0] delta = self.effect.get(opname, 0) if delta > 1: depth = depth + delta elif delta < 0: if depth > maxDepth: maxDepth = depth depth = depth + delta else: if depth > maxDepth: maxDepth = depth # now check patterns for pat, pat_delta in self.patterns: if opname[:len(pat)] == pat: delta = pat_delta depth = depth + delta break # if we still haven't found a match if delta == 0: meth = getattr(self, opname, None) if meth is not None: depth = depth + meth(i[1]) if depth < 0: depth = 0 return maxDepth
138d90eb73415e48a0e7f09a7c9603b1164bcaed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/138d90eb73415e48a0e7f09a7c9603b1164bcaed/pyassem.py
return lo + hi * 2
return -(lo + hi * 2)
def CALL_FUNCTION(self, argc): hi, lo = divmod(argc, 256) return lo + hi * 2
138d90eb73415e48a0e7f09a7c9603b1164bcaed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/138d90eb73415e48a0e7f09a7c9603b1164bcaed/pyassem.py
return self.CALL_FUNCTION(argc)+1
return self.CALL_FUNCTION(argc)-1
def CALL_FUNCTION_VAR(self, argc): return self.CALL_FUNCTION(argc)+1
138d90eb73415e48a0e7f09a7c9603b1164bcaed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/138d90eb73415e48a0e7f09a7c9603b1164bcaed/pyassem.py
return self.CALL_FUNCTION(argc)+1
return self.CALL_FUNCTION(argc)-1
def CALL_FUNCTION_KW(self, argc): return self.CALL_FUNCTION(argc)+1
138d90eb73415e48a0e7f09a7c9603b1164bcaed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/138d90eb73415e48a0e7f09a7c9603b1164bcaed/pyassem.py
return self.CALL_FUNCTION(argc)+2
return self.CALL_FUNCTION(argc)-2
def CALL_FUNCTION_VAR_KW(self, argc): return self.CALL_FUNCTION(argc)+2
138d90eb73415e48a0e7f09a7c9603b1164bcaed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/138d90eb73415e48a0e7f09a7c9603b1164bcaed/pyassem.py
def loop(timeout=30.0, use_poll=False, map=None):
def loop(timeout=30.0, use_poll=False, map=None, count=1e309):
def loop(timeout=30.0, use_poll=False, map=None): if map is None: map = socket_map if use_poll and hasattr(select, 'poll'): poll_fun = poll2 else: poll_fun = poll while map: poll_fun(timeout, map)
eac324b90bc76c5c8e305d567c40d53e3440593e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/eac324b90bc76c5c8e305d567c40d53e3440593e/asyncore.py
while map:
while map and count >= 0:
def loop(timeout=30.0, use_poll=False, map=None): if map is None: map = socket_map if use_poll and hasattr(select, 'poll'): poll_fun = poll2 else: poll_fun = poll while map: poll_fun(timeout, map)
eac324b90bc76c5c8e305d567c40d53e3440593e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/eac324b90bc76c5c8e305d567c40d53e3440593e/asyncore.py
self.passiveserver = 0
self.passiveserver = 1
def connect(self, host = '', port = 0): '''Connect to host. Arguments are: - host: hostname to connect to (string, default previous host) - port: port to connect to (integer, default previous port)''' if host: self.host = host if port: self.port = port self.passiveserver = 0 self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.sock.connect((self.host, self.port)) self.file = self.sock.makefile('rb') self.welcome = self.getresp() return self.welcome
e6ccf3ab966c37f25c3c0e4da58c3b0bc7c5a1f6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e6ccf3ab966c37f25c3c0e4da58c3b0bc7c5a1f6/ftplib.py
return result = MenuKey(ord(c)) id = (result>>16) & 0xffff item = result & 0xffff if id: self.do_rawmenu(id, item, None, event) else: if DEBUG: print "Command-" +`c`
return
def do_key(self, event): (what, message, when, where, modifiers) = event c = chr(message & charCodeMask) if modifiers & cmdKey: if c == '.': raise self else: if not self.menubar: MacOS.HandleEvent(event) return result = MenuKey(ord(c)) id = (result>>16) & 0xffff # Hi word item = result & 0xffff # Lo word if id: self.do_rawmenu(id, item, None, event)
c15e43a2da0bee955d5e939e31c43f8dc6270fef /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c15e43a2da0bee955d5e939e31c43f8dc6270fef/FrameWork.py
self.menu.SetMenuItem
self.menu.SetMenuItemKeyGlyph(item, shortcut[2])
def additem(self, label, shortcut=None, callback=None, kind=None): self.menu.AppendMenu('x') # add a dummy string self.items.append(label, shortcut, callback, kind) item = len(self.items) self.menu.SetMenuItemText(item, label) # set the actual text if shortcut and type(shortcut) == type(()): modifiers, char = shortcut[:2] self.menu.SetItemCmd(item, ord(char)) self.menu.SetMenuItemModifiers(item, modifiers) if len(shortcut) > 2: self.menu.SetMenuItem elif shortcut: self.menu.SetItemCmd(item, ord(shortcut)) return item
c15e43a2da0bee955d5e939e31c43f8dc6270fef /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c15e43a2da0bee955d5e939e31c43f8dc6270fef/FrameWork.py
def maybe_mutate(): global mutate if not mutate: return if random.random() < 0.5: return if random.random() < 0.5: target, keys = dict1, dict1keys else: target, keys = dict2, dict2keys if random.random() < 0.2: # Insert a new key. mutate = 0 # disable mutation until key inserted while 1: newkey = Horrid(random.randrange(100)) if newkey not in target: break target[newkey] = Horrid(random.randrange(100)) keys.append(newkey) mutate = 1 elif keys: # Delete a key at random. i = random.randrange(len(keys)) key = keys[i] del target[key] # CAUTION: don't use keys.remove(key) here. Or do <wink>. The # point is that .remove() would trigger more comparisons, and so # also more calls to this routine. We're mutating often enough # without that. del keys[i]
57179feec8b0b22a81ec70b4f4037a17f06fd415 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/57179feec8b0b22a81ec70b4f4037a17f06fd415/test_mutants.py
"exclude=", "include=", "package=", "strip")
"exclude=", "include=", "package=", "strip", "iconfile=")
def main(builder=None): if builder is None: builder = AppBuilder(verbosity=1) shortopts = "b:n:r:e:m:c:p:lx:i:hvq" longopts = ("builddir=", "name=", "resource=", "executable=", "mainprogram=", "creator=", "nib=", "plist=", "link", "link-exec", "help", "verbose", "quiet", "standalone", "exclude=", "include=", "package=", "strip") try: options, args = getopt.getopt(sys.argv[1:], shortopts, longopts) except getopt.error: usage() for opt, arg in options: if opt in ('-b', '--builddir'): builder.builddir = arg elif opt in ('-n', '--name'): builder.name = arg elif opt in ('-r', '--resource'): builder.resources.append(arg) elif opt in ('-e', '--executable'): builder.executable = arg elif opt in ('-m', '--mainprogram'): builder.mainprogram = arg elif opt in ('-c', '--creator'): builder.creator = arg elif opt == "--nib": builder.nibname = arg elif opt in ('-p', '--plist'): builder.plist = Plist.fromFile(arg) elif opt in ('-l', '--link'): builder.symlink = 1 elif opt == '--link-exec': builder.symlink_exec = 1 elif opt in ('-h', '--help'): usage() elif opt in ('-v', '--verbose'): builder.verbosity += 1 elif opt in ('-q', '--quiet'): builder.verbosity -= 1 elif opt == '--standalone': builder.standalone = 1 elif opt in ('-x', '--exclude'): builder.excludeModules.append(arg) elif opt in ('-i', '--include'): builder.includeModules.append(arg) elif opt == '--package': builder.includePackages.append(arg) elif opt == '--strip': builder.strip = 1 if len(args) != 1: usage("Must specify one command ('build', 'report' or 'help')") command = args[0] if command == "build": builder.setup() builder.build() elif command == "report": builder.setup() builder.report() elif command == "help": usage() else: usage("Unknown command '%s'" % command)
2aa09566c5b1b1ab84db195fd73a51747c1d5606 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/2aa09566c5b1b1ab84db195fd73a51747c1d5606/bundlebuilder.py
if len(sys.argv) != 2: sys.stderr.write('usage: telnet hostname\n')
if len(sys.argv) < 2: sys.stderr.write('usage: telnet hostname [port]\n')
def main(): if len(sys.argv) != 2: sys.stderr.write('usage: telnet hostname\n') sys.exit(2) host = sys.argv[1] try: hostaddr = gethostbyname(host) except error: sys.stderr.write(sys.argv[1] + ': bad host name\n') sys.exit(2) # if len(sys.argv) > 2: servname = sys.argv[2] else: servname = 'telnet' # if '0' <= servname[:1] <= '9': port = eval(servname) else: try: port = getservbyname(servname, 'tcp') except error: sys.stderr.write(servname + ': bad tcp service name\n') sys.exit(2) # s = socket(AF_INET, SOCK_STREAM) # try: s.connect(host, port) except error, msg: sys.stderr.write('connect failed: ' + `msg` + '\n') sys.exit(1) # thread.start_new(child, (s,)) parent(s)
4550b00c80b064a3594d6d648fd7e164ffa59286 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4550b00c80b064a3594d6d648fd7e164ffa59286/telnet.py
s.connect(host, port)
s.connect((host, port))
def main(): if len(sys.argv) != 2: sys.stderr.write('usage: telnet hostname\n') sys.exit(2) host = sys.argv[1] try: hostaddr = gethostbyname(host) except error: sys.stderr.write(sys.argv[1] + ': bad host name\n') sys.exit(2) # if len(sys.argv) > 2: servname = sys.argv[2] else: servname = 'telnet' # if '0' <= servname[:1] <= '9': port = eval(servname) else: try: port = getservbyname(servname, 'tcp') except error: sys.stderr.write(servname + ': bad tcp service name\n') sys.exit(2) # s = socket(AF_INET, SOCK_STREAM) # try: s.connect(host, port) except error, msg: sys.stderr.write('connect failed: ' + `msg` + '\n') sys.exit(1) # thread.start_new(child, (s,)) parent(s)
4550b00c80b064a3594d6d648fd7e164ffa59286 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4550b00c80b064a3594d6d648fd7e164ffa59286/telnet.py
h.update(u''.join(data).encode('unicode-internal'))
h.update(u''.join(data).encode(encoding))
def test_methods(): h = sha.sha() for i in range(65536): char = unichr(i) data = [ # Predicates (single char) char.isalnum() and u'1' or u'0', char.isalpha() and u'1' or u'0', char.isdecimal() and u'1' or u'0', char.isdigit() and u'1' or u'0', char.islower() and u'1' or u'0', char.isnumeric() and u'1' or u'0', char.isspace() and u'1' or u'0', char.istitle() and u'1' or u'0', char.isupper() and u'1' or u'0', # Predicates (multiple chars) (char + u'abc').isalnum() and u'1' or u'0', (char + u'abc').isalpha() and u'1' or u'0', (char + u'123').isdecimal() and u'1' or u'0', (char + u'123').isdigit() and u'1' or u'0', (char + u'abc').islower() and u'1' or u'0', (char + u'123').isnumeric() and u'1' or u'0', (char + u' \t').isspace() and u'1' or u'0', (char + u'abc').istitle() and u'1' or u'0', (char + u'ABC').isupper() and u'1' or u'0', # Mappings (single char) char.lower(), char.upper(), char.title(), # Mappings (multiple chars) (char + u'abc').lower(), (char + u'ABC').upper(), (char + u'abc').title(), (char + u'ABC').title(), ] h.update(u''.join(data).encode('unicode-internal')) return h.hexdigest()
67ceca7addbe6b202aa5043b065ac2e3c9749449 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/67ceca7addbe6b202aa5043b065ac2e3c9749449/test_unicodedata.py
exts.append( Extension('audioop', ['audioop.c']) )
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')
8fbefe28745f980579620147dd0c0fdef94374de /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8fbefe28745f980579620147dd0c0fdef94374de/setup.py
self._read(length, self.fp.read)
return self._read(length, self.fp.read)
def read(self, length = None): self._read(length, self.fp.read)
3414c1ceeebd6a0cc00df147cfd3146821010194 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3414c1ceeebd6a0cc00df147cfd3146821010194/mailbox.py
self._read(length, self.fp.readline)
return self._read(length, self.fp.readline)
def readline(self, length = None): self._read(length, self.fp.readline)
3414c1ceeebd6a0cc00df147cfd3146821010194 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3414c1ceeebd6a0cc00df147cfd3146821010194/mailbox.py
log.warn("'%s' does not exist -- can't clean it", self.build_temp)
log.debug("'%s' does not exist -- can't clean it", self.build_temp)
def run(self): # remove the build/temp.<plat> directory (unless it's already # gone) if os.path.exists(self.build_temp): remove_tree(self.build_temp, dry_run=self.dry_run) else: log.warn("'%s' does not exist -- can't clean it", self.build_temp)
a683233d87f5024b9eb944dd408c3a7c4ed3c1ad /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a683233d87f5024b9eb944dd408c3a7c4ed3c1ad/clean.py
self.lines = []
def __init__(self, fp=None, headers=None, outerboundary="", environ=os.environ, keep_blank_values=0, strict_parsing=0): """Constructor. Read multipart/* until last part.
7fed217515d060b065119f74eea3a024dfb00210 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7fed217515d060b065119f74eea3a024dfb00210/cgi.py
self.lines.append(line)
def read_lines_to_eof(self): """Internal: read lines until EOF.""" while 1: line = self.fp.readline() if not line: self.done = -1 break self.lines.append(line) self.file.write(line)
7fed217515d060b065119f74eea3a024dfb00210 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7fed217515d060b065119f74eea3a024dfb00210/cgi.py
self.lines.append(line)
def read_lines_to_outerboundary(self): """Internal: read lines until outerboundary.""" next = "--" + self.outerboundary last = next + "--" delim = "" while 1: line = self.fp.readline() if not line: self.done = -1 break self.lines.append(line) if line[:2] == "--": strippedline = string.strip(line) if strippedline == next: break if strippedline == last: self.done = 1 break odelim = delim if line[-2:] == "\r\n": delim = "\r\n" line = line[:-2] elif line[-1] == "\n": delim = "\n" line = line[:-1] else: delim = "" self.file.write(odelim + line)
7fed217515d060b065119f74eea3a024dfb00210 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7fed217515d060b065119f74eea3a024dfb00210/cgi.py
self.lines.append(line)
def skip_lines(self): """Internal: skip lines until outer boundary if defined.""" if not self.outerboundary or self.done: return next = "--" + self.outerboundary last = next + "--" while 1: line = self.fp.readline() if not line: self.done = -1 break self.lines.append(line) if line[:2] == "--": strippedline = string.strip(line) if strippedline == next: break if strippedline == last: self.done = 1 break
7fed217515d060b065119f74eea3a024dfb00210 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7fed217515d060b065119f74eea3a024dfb00210/cgi.py
curses_libs = ['curses', 'termcap']
curses_libs = ['curses']
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')
0b27ff92d2127ed39f52d9987e4e96313937cbc8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0b27ff92d2127ed39f52d9987e4e96313937cbc8/setup.py
def nuke_release_tree (self, base_dir): try: self.execute (rmtree, (base_dir,), "removing %s" % base_dir) except (IOError, OSError), exc: if exc.filename: msg = "error removing %s: %s (%s)" % \ (base_dir, exc.strerror, exc.filename) else: msg = "error removing %s: %s" % (base_dir, exc.strerror) self.warn (msg)
def make_release_tree (self, base_dir, files):
2dc139cc914ec366e769e464270b8af8aa751b78 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/2dc139cc914ec366e769e464270b8af8aa751b78/sdist.py
self.nuke_release_tree (base_dir)
remove_tree (base_dir, self.verbose, self.dry_run)
def make_distribution (self):
2dc139cc914ec366e769e464270b8af8aa751b78 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/2dc139cc914ec366e769e464270b8af8aa751b78/sdist.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
30fe363fd8957d833aa913a2af375d275c581c15 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/30fe363fd8957d833aa913a2af375d275c581c15/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
30fe363fd8957d833aa913a2af375d275c581c15 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/30fe363fd8957d833aa913a2af375d275c581c15/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)
30fe363fd8957d833aa913a2af375d275c581c15 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/30fe363fd8957d833aa913a2af375d275c581c15/EasyDialogs.py
self.text.insert(mark, str(s), tags)
self.text.insert(mark, s, tags)
def write(self, s, tags=(), mark="insert"): self.text.insert(mark, str(s), tags) self.text.see(mark) self.text.update()
dc1351758672caf5a3ff3c3f57ecf6f9d16a48f2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/dc1351758672caf5a3ff3c3f57ecf6f9d16a48f2/OutputWindow.py
without effecting this threads data:
without affecting this thread's data:
... def squared(self):
3fc2fde7ffc7f94438a212592879e57520f01247 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3fc2fde7ffc7f94438a212592879e57520f01247/_threading_local.py
pass
pass
def __del__(self): key = __getattribute__(self, '_local__key')
3fc2fde7ffc7f94438a212592879e57520f01247 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3fc2fde7ffc7f94438a212592879e57520f01247/_threading_local.py
pth_file.cleanup()
pth_file.cleanup(prep=True)
def test_addpackage(self): # Make sure addpackage() imports if the line starts with 'import', # adds directories to sys.path for any line in the file that is not a # comment or import that is a valid directory name for where the .pth # file resides; invalid directories are not added pth_file = PthFile() pth_file.cleanup() # to make sure that nothing is pre-existing that # shouldn't be try: pth_file.create() site.addpackage(pth_file.base_dir, pth_file.filename, set()) unittest.FunctionTestCase(pth_file.test) finally: pth_file.cleanup()
ee86a66dd87787e54772c93c961fa611311b1502 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ee86a66dd87787e54772c93c961fa611311b1502/test_site.py
unittest.FunctionTestCase(pth_file.test)
self.pth_file_tests(pth_file)
def test_addpackage(self): # Make sure addpackage() imports if the line starts with 'import', # adds directories to sys.path for any line in the file that is not a # comment or import that is a valid directory name for where the .pth # file resides; invalid directories are not added pth_file = PthFile() pth_file.cleanup() # to make sure that nothing is pre-existing that # shouldn't be try: pth_file.create() site.addpackage(pth_file.base_dir, pth_file.filename, set()) unittest.FunctionTestCase(pth_file.test) finally: pth_file.cleanup()
ee86a66dd87787e54772c93c961fa611311b1502 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ee86a66dd87787e54772c93c961fa611311b1502/test_site.py
pth_file.cleanup()
pth_file.cleanup(prep=True)
def test_addsitedir(self): # Same tests for test_addpackage since addsitedir() essentially just # calls addpackage() for every .pth file in the directory pth_file = PthFile() pth_file.cleanup() # Make sure that nothing is pre-existing that is # tested for try: site.addsitedir(pth_file.base_dir, set()) unittest.FunctionTestCase(pth_file.test) finally: pth_file.cleanup()
ee86a66dd87787e54772c93c961fa611311b1502 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ee86a66dd87787e54772c93c961fa611311b1502/test_site.py
unittest.FunctionTestCase(pth_file.test)
self.pth_file_tests(pth_file)
def test_addsitedir(self): # Same tests for test_addpackage since addsitedir() essentially just # calls addpackage() for every .pth file in the directory pth_file = PthFile() pth_file.cleanup() # Make sure that nothing is pre-existing that is # tested for try: site.addsitedir(pth_file.base_dir, set()) unittest.FunctionTestCase(pth_file.test) finally: pth_file.cleanup()
ee86a66dd87787e54772c93c961fa611311b1502 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ee86a66dd87787e54772c93c961fa611311b1502/test_site.py