rem stringlengths 1 322k | add stringlengths 0 2.05M | context stringlengths 4 228k | meta stringlengths 156 215 |
|---|---|---|---|
self.assertRaises(TypeError, setattr, X.x, "offset", 92) self.assertRaises(TypeError, setattr, X.x, "size", 92) | self.assertRaises(AttributeError, setattr, X.x, "offset", 92) self.assertRaises(AttributeError, setattr, X.x, "size", 92) | def test_fields(self): # test the offset and size attributes of Structure/Unoin fields. class X(Structure): _fields_ = [("x", c_int), ("y", c_char)] | ecc3e67b986a1eed404b528ccbc099049c149edb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ecc3e67b986a1eed404b528ccbc099049c149edb/test_structures.py |
Retrieves a list of addresses from a header, where each address is a tuple as returned by getaddr(). """ try: data = self[name] except KeyError: return [] a = AddrlistClass(data) | Retrieves a list of addresses from a header, where each address is a tuple as returned by getaddr(). Scans all named headers, so it works properly with multiple To: or Cc: headers for example. """ raw = [] for h in self.getallmatchingheaders(name): if h[0] in ' \t': raw.append(h) else: if raw: raw.append(', ') i = s... | def getaddrlist(self, name): """Get a list of addresses from a header. Retrieves a list of addresses from a header, where each address is a tuple as returned by getaddr(). """ # New, by Ben Escoto try: data = self[name] except KeyError: return [] a = AddrlistClass(data) return a.getaddrlist() | 8a578436f493251ae912bc1e1ef09abc38a10316 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8a578436f493251ae912bc1e1ef09abc38a10316/rfc822.py |
self.CR = '\r' | self.CR = '\r\n' | def __init__(self, field): """Initialize a new instance. `field' is an unparsed address header field, containing one or more addresses. """ self.specials = '()<>@,:;.\"[]' self.pos = 0 self.LWS = ' \t' self.CR = '\r' self.atomends = self.specials + self.LWS + self.CR self.field = field self.commentlist = [] | 8a578436f493251ae912bc1e1ef09abc38a10316 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8a578436f493251ae912bc1e1ef09abc38a10316/rfc822.py |
def __init__(self, field): """Initialize a new instance. `field' is an unparsed address header field, containing one or more addresses. """ self.specials = '()<>@,:;.\"[]' self.pos = 0 self.LWS = ' \t' self.CR = '\r' self.atomends = self.specials + self.LWS + self.CR self.field = field self.commentlist = [] | 8a578436f493251ae912bc1e1ef09abc38a10316 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8a578436f493251ae912bc1e1ef09abc38a10316/rfc822.py | ||
def getdomain(self): """Get the complete domain name from an address.""" sdlist = [] while self.pos < len(self.field): if self.field[self.pos] in self.LWS: self.pos = self.pos + 1 elif self.field[self.pos] == '(': self.commentlist.append(self.getcomment()) elif self.field[self.pos] == '[': sdlist.append(self.getdomainl... | 8a578436f493251ae912bc1e1ef09abc38a10316 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8a578436f493251ae912bc1e1ef09abc38a10316/rfc822.py | ||
tests = [ GeneralModuleTests, BasicTCPTest ] | tests = [GeneralModuleTests, BasicTCPTest, TCPTimeoutTest, TestExceptions] | def test_main(): tests = [ GeneralModuleTests, BasicTCPTest ] if sys.platform != 'mac': tests.append(BasicUDPTest) tests.extend([ NonBlockingTCPTests, FileObjectClassTestCase, UnbufferedFileObjectClassTestCase, LineBufferedFileObjectClassTestCase, SmallBufferedFileObjectClassTestCase ]) test_support.run_unittest(*test... | 11a35f545b39ebd09171869f9987dabd85f03254 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/11a35f545b39ebd09171869f9987dabd85f03254/test_socket.py |
tests.append(BasicUDPTest) | tests.extend([ BasicUDPTest, UDPTimeoutTest ]) | def test_main(): tests = [ GeneralModuleTests, BasicTCPTest ] if sys.platform != 'mac': tests.append(BasicUDPTest) tests.extend([ NonBlockingTCPTests, FileObjectClassTestCase, UnbufferedFileObjectClassTestCase, LineBufferedFileObjectClassTestCase, SmallBufferedFileObjectClassTestCase ]) test_support.run_unittest(*test... | 11a35f545b39ebd09171869f9987dabd85f03254 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/11a35f545b39ebd09171869f9987dabd85f03254/test_socket.py |
def change_root (new_root, pathname): """Return 'pathname' with 'new_root' prepended. If 'pathname' is relative, this is equivalent to "os.path.join(new_root,pathname)". Otherwise, it requires making 'pathname' relative and then joining the two, which is tricky on DOS/Windows and Mac OS.""" if not abspath (pathname)... | 4b46ef9a4f35c50eed2e0993058be0cfe71e0b3b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4b46ef9a4f35c50eed2e0993058be0cfe71e0b3b/util.py | ||
two, which is tricky on DOS/Windows and Mac OS.""" if not abspath (pathname): return os.path.join (new_root, pathname) elif os.name == 'posix': return os.path.join (new_root, pathname[1:]) | two, which is tricky on DOS/Windows and Mac OS. """ if os.name == 'posix': if not os.path.isabs (pathname): return os.path.join (new_root, pathname) else: return os.path.join (new_root, pathname[1:]) | def change_root (new_root, pathname): """Return 'pathname' with 'new_root' prepended. If 'pathname' is relative, this is equivalent to "os.path.join(new_root,pathname)". Otherwise, it requires making 'pathname' relative and then joining the two, which is tricky on DOS/Windows and Mac OS.""" if not abspath (pathname)... | 4b46ef9a4f35c50eed2e0993058be0cfe71e0b3b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4b46ef9a4f35c50eed2e0993058be0cfe71e0b3b/util.py |
(root_drive, root_path) = os.path.splitdrive (new_root) | def change_root (new_root, pathname): """Return 'pathname' with 'new_root' prepended. If 'pathname' is relative, this is equivalent to "os.path.join(new_root,pathname)". Otherwise, it requires making 'pathname' relative and then joining the two, which is tricky on DOS/Windows and Mac OS.""" if not abspath (pathname)... | 4b46ef9a4f35c50eed2e0993058be0cfe71e0b3b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4b46ef9a4f35c50eed2e0993058be0cfe71e0b3b/util.py | |
raise RuntimeError, "I give up -- not sure how to do this on Windows" | if path[0] == '\\': path = path[1:] return os.path.join (new_root, path) | def change_root (new_root, pathname): """Return 'pathname' with 'new_root' prepended. If 'pathname' is relative, this is equivalent to "os.path.join(new_root,pathname)". Otherwise, it requires making 'pathname' relative and then joining the two, which is tricky on DOS/Windows and Mac OS.""" if not abspath (pathname)... | 4b46ef9a4f35c50eed2e0993058be0cfe71e0b3b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4b46ef9a4f35c50eed2e0993058be0cfe71e0b3b/util.py |
mro_err_msg = """Cannot create class.The superclasses have conflicting inheritance trees which leave the method resolution order (MRO) undefined for bases """ | mro_err_msg = """Cannot create a consistent method resolution order (MRO) for bases """ | def consistency_with_epg(): if verbose: print "Testing consistentcy with EPG..." class Pane(object): pass class ScrollingMixin(object): pass class EditingMixin(object): pass class ScrollablePane(Pane,ScrollingMixin): pass class EditablePane(Pane,EditingMixin): pass class EditableScrollablePane(ScrollablePane,EditablePa... | f394df47fd943d7067b5c3bedbf2c359d864923c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f394df47fd943d7067b5c3bedbf2c359d864923c/test_descr.py |
writer = _get_StringIO() self.writexml(writer, "", indent, newl) return writer.getvalue() | writer = _get_StringIO() self.writexml(writer, "", indent, newl) return writer.getvalue() | def toprettyxml(self, indent="\t", newl="\n"): # indent = the indentation string to prepend, per level # newl = the newline string to append writer = _get_StringIO() self.writexml(writer, "", indent, newl) return writer.getvalue() | cb67ea1d6e2dfb2680bba29144ef33fd2cc9a21a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/cb67ea1d6e2dfb2680bba29144ef33fd2cc9a21a/minidom.py |
By default, the diff control lines (those with *** or ---) are | By default, the diff control lines (those with ---, +++, or @@) are | def unified_diff(a, b, fromfile='', tofile='', fromfiledate='', tofiledate='', n=3, lineterm='\n'): r""" Compare two sequences of lines; generate the delta as a unified diff. Unified diffs are a compact way of showing line changes and a few lines of context. The number of context lines is set by 'n' which defaults to... | 0887c732e7d6e162b4b78004af8546b739c77ca7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0887c732e7d6e162b4b78004af8546b739c77ca7/difflib.py |
def search(self, charset, criteria): | def search(self, charset, *criteria): | def search(self, charset, criteria): """Search mailbox for matching messages. | 66d451397577a7710902b75104839afc7ca05b81 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/66d451397577a7710902b75104839afc7ca05b81/imaplib.py |
(typ, [data]) = <instance>.search(charset, criteria) | (typ, [data]) = <instance>.search(charset, criterium, ...) | def search(self, charset, criteria): """Search mailbox for matching messages. | 66d451397577a7710902b75104839afc7ca05b81 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/66d451397577a7710902b75104839afc7ca05b81/imaplib.py |
typ, dat = self._simple_command(name, charset, criteria) | typ, dat = apply(self._simple_command, (name, charset) + criteria) | def search(self, charset, criteria): """Search mailbox for matching messages. | 66d451397577a7710902b75104839afc7ca05b81 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/66d451397577a7710902b75104839afc7ca05b81/imaplib.py |
import getpass, sys host = '' if sys.argv[1:]: host = sys.argv[1] | import getopt, getpass, sys try: optlist, args = getopt.getopt(sys.argv[1:], 'd:') except getopt.error, val: pass for opt,val in optlist: if opt == '-d': Debug = int(val) if not args: args = ('',) host = args[0] | def print_log(): _mesg('last %d IMAP4 interactions:' % len(_cmd_log)) for secs,line in _cmd_log: _mesg(line, secs) | 66d451397577a7710902b75104839afc7ca05b81 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/66d451397577a7710902b75104839afc7ca05b81/imaplib.py |
('search', (None, '(TO zork)')), | ('search', (None, 'SUBJECT', 'test')), | def print_log(): _mesg('last %d IMAP4 interactions:' % len(_cmd_log)) for secs,line in _cmd_log: _mesg(line, secs) | 66d451397577a7710902b75104839afc7ca05b81 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/66d451397577a7710902b75104839afc7ca05b81/imaplib.py |
Debug = 5 M = IMAP4(host) _mesg('PROTOCOL_VERSION = %s' % M.PROTOCOL_VERSION) for cmd,args in test_seq1: run(cmd, args) for ml in run('list', ('/tmp/', 'yy%')): mo = re.match(r'.*"([^"]+)"$', ml) if mo: path = mo.group(1) else: path = string.split(ml)[-1] run('delete', (path,)) for cmd,args in test_seq2: dat = run(c... | try: M = IMAP4(host) _mesg('PROTOCOL_VERSION = %s' % M.PROTOCOL_VERSION) for cmd,args in test_seq1: run(cmd, args) for ml in run('list', ('/tmp/', 'yy%')): mo = re.match(r'.*"([^"]+)"$', ml) if mo: path = mo.group(1) else: path = string.split(ml)[-1] run('delete', (path,)) for cmd,args in test_seq2: dat = run(cmd, a... | def run(cmd, args): _mesg('%s %s' % (cmd, args)) typ, dat = apply(eval('M.%s' % cmd), args) _mesg('%s => %s %s' % (cmd, typ, dat)) return dat | 66d451397577a7710902b75104839afc7ca05b81 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/66d451397577a7710902b75104839afc7ca05b81/imaplib.py |
def test_encoding_decoding(self): codecs = [('rot13', 'uryyb jbeyq'), ('base64', 'aGVsbG8gd29ybGQ=\n'), ('hex', '68656c6c6f20776f726c64'), ('uu', 'begin 666 <data>\n+:&5L;&\\@=V]R;&0 \n \nend\n')] for encoding, data in codecs: self.checkequal(data, 'hello world', 'encode', encoding) self.checkequal('hello world', data,... | 108f13751999f63c20fa9067f3fc0feb6a87718e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/108f13751999f63c20fa9067f3fc0feb6a87718e/string_tests.py | ||
self.get_installer_filename())) | self.get_installer_filename(fullname))) | def run (self): if (sys.platform != "win32" and (self.distribution.has_ext_modules() or self.distribution.has_c_libraries())): raise DistutilsPlatformError \ ("distribution contains extensions and/or C libraries; " "must be compiled on a Windows 32 platform") | 24ff83d5f3f2afdfd22c1e5081ede2860a30ce0c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/24ff83d5f3f2afdfd22c1e5081ede2860a30ce0c/bdist_wininst.py |
@bigmemtest(minsize=_2G // 2 + 2, memuse=8) | @bigmemtest(minsize=_2G // 2 + 2, memuse=24) | def basic_test_inplace_concat(self, size): l = [sys.stdout] * size l += l self.assertEquals(len(l), size * 2) self.failUnless(l[0] is l[-1]) self.failUnless(l[size - 1] is l[size + 1]) | 2574f5cd8bfa7d504706f1f481ede5748a64e9f3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/2574f5cd8bfa7d504706f1f481ede5748a64e9f3/test_bigmem.py |
@bigmemtest(minsize=_2G + 2, memuse=8) | @bigmemtest(minsize=_2G + 2, memuse=24) | def test_inplace_concat_small(self, size): return self.basic_test_inplace_concat(size) | 2574f5cd8bfa7d504706f1f481ede5748a64e9f3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/2574f5cd8bfa7d504706f1f481ede5748a64e9f3/test_bigmem.py |
(typ, [data]) = <instance>.search(charset, criterium, ...) | (typ, [data]) = <instance>.search(charset, criterion, ...) | def search(self, charset, *criteria): """Search mailbox for matching messages. | 3ae0f7a7cf8c7555a654542811509d4c17b49497 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3ae0f7a7cf8c7555a654542811509d4c17b49497/imaplib.py |
for tagName in DESCRIPTOR_ELEMENTS: nodes = find_all_elements(doc, tagName) for node in nodes: rewrite_descriptor(doc, node) | sections = find_all_elements(doc, "section") for section in sections: find_and_fix_descriptors(doc, section) def find_and_fix_descriptors(doc, container): children = container.childNodes for child in children: if child.nodeType == xml.dom.core.ELEMENT: tagName = child.tagName if tagName in DESCRIPTOR_ELEMENTS: rewrit... | def fixup_descriptors(doc): for tagName in DESCRIPTOR_ELEMENTS: nodes = find_all_elements(doc, tagName) for node in nodes: rewrite_descriptor(doc, node) | 3a7ff998aca0301659bb906d3631a4e02326615d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3a7ff998aca0301659bb906d3631a4e02326615d/docfixer.py |
class Maildir: def __init__(self, dirname): import string self.dirname = dirname self.boxes = [] newdir = os.path.join(self.dirname, 'new') for file in os.listdir(newdir): if len(string.split(file, '.')) > 2: self.boxes.append(os.path.join(newdir, file)) curdir = os.path.join(self.dirname, 'cur') for file in os... | def next(self): if not self.boxes: return None fn = self.boxes[0] del self.boxes[0] fp = open(os.path.join(self.dirname, fn)) return rfc822.Message(fp) | 9a4d63730ed3d93a1f059bb10f546609e2290cfb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9a4d63730ed3d93a1f059bb10f546609e2290cfb/mailbox.py | |
for key in 'MAIL', 'LOGNAME', 'USER': | for key in 'MAILDIR', 'MAIL', 'LOGNAME', 'USER': | def _test(): import time import sys import string import os args = sys.argv[1:] if not args: for key in 'MAIL', 'LOGNAME', 'USER': if os.environ.has_key(key): mbox = os.environ[key] break else: print "$MAIL, $LOGNAME nor $USER set -- who are you?" return else: mbox = args[0] if mbox[:1] == '+': mbox = os.environ['HOME... | 9a4d63730ed3d93a1f059bb10f546609e2290cfb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9a4d63730ed3d93a1f059bb10f546609e2290cfb/mailbox.py |
mb = MHMailbox(mbox) | if os.path.isdir(os.path.join(mbox, 'cur')): mb = Maildir(mbox) else: mb = MHMailbox(mbox) | def _test(): import time import sys import string import os args = sys.argv[1:] if not args: for key in 'MAIL', 'LOGNAME', 'USER': if os.environ.has_key(key): mbox = os.environ[key] break else: print "$MAIL, $LOGNAME nor $USER set -- who are you?" return else: mbox = args[0] if mbox[:1] == '+': mbox = os.environ['HOME... | 9a4d63730ed3d93a1f059bb10f546609e2290cfb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9a4d63730ed3d93a1f059bb10f546609e2290cfb/mailbox.py |
def main(): | def findtemplate(): """Locate the applet template along sys.path""" | def main(): # Find the template # (there's no point in proceeding if we can't find it) for p in sys.path: template = os.path.join(p, TEMPLATE) try: template, d1, d2 = macfs.ResolveAliasFile(template) break except (macfs.error, ValueError): continue else: die("Template %s not found on sys.path" % `TEMPLATE`) return te... | 0f452fa557eaf41aa576f8644b0955efea8daaac /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0f452fa557eaf41aa576f8644b0955efea8daaac/BuildApplet.py |
print "Processing", `filename`, "..." | if DEBUG: print "Processing", `filename`, "..." | def process(template, filename, output): print "Processing", `filename`, "..." # Read the source and compile it # (there's no point overwriting the destination if it has a syntax error) fp = open(filename) text = fp.read() fp.close() try: code = compile(text, filename, "exec") except (SyntaxError, EOFError): die("Sy... | 0f452fa557eaf41aa576f8644b0955efea8daaac /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0f452fa557eaf41aa576f8644b0955efea8daaac/BuildApplet.py |
print "Creating resource fork..." | if DEBUG: print "Creating resource fork..." | def process(template, filename, output): print "Processing", `filename`, "..." # Read the source and compile it # (there's no point overwriting the destination if it has a syntax error) fp = open(filename) text = fp.read() fp.close() try: code = compile(text, filename, "exec") except (SyntaxError, EOFError): die("Sy... | 0f452fa557eaf41aa576f8644b0955efea8daaac /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0f452fa557eaf41aa576f8644b0955efea8daaac/BuildApplet.py |
except MacOS.Error: | except (MacOS.Error, ValueError): print 'No resource file', rsrcname | def process(template, filename, output): print "Processing", `filename`, "..." # Read the source and compile it # (there's no point overwriting the destination if it has a syntax error) fp = open(filename) text = fp.read() fp.close() try: code = compile(text, filename, "exec") except (SyntaxError, EOFError): die("Sy... | 0f452fa557eaf41aa576f8644b0955efea8daaac /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0f452fa557eaf41aa576f8644b0955efea8daaac/BuildApplet.py |
print id, type, name, size, hex(attrs) | if DEBUG: print id, type, name, size, hex(attrs) | def copyres(input, output): ctor = None UseResFile(input) ntypes = Count1Types() for itype in range(1, 1+ntypes): type = Get1IndType(itype) nresources = Count1Resources(type) for ires in range(1, 1+nresources): res = Get1IndResource(type, ires) id, type, name = res.GetResInfo() lcname = string.lower(name) if (type, lcn... | 0f452fa557eaf41aa576f8644b0955efea8daaac /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0f452fa557eaf41aa576f8644b0955efea8daaac/BuildApplet.py |
print "Overwriting..." | if DEBUG: print "Overwriting..." | def copyres(input, output): ctor = None UseResFile(input) ntypes = Count1Types() for itype in range(1, 1+ntypes): type = Get1IndType(itype) nresources = Count1Resources(type) for ires in range(1, 1+nresources): res = Get1IndResource(type, ires) id, type, name = res.GetResInfo() lcname = string.lower(name) if (type, lcn... | 0f452fa557eaf41aa576f8644b0955efea8daaac /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0f452fa557eaf41aa576f8644b0955efea8daaac/BuildApplet.py |
print "New attrs =", hex(attrs) | if DEBUG: print "New attrs =", hex(attrs) | def copyres(input, output): ctor = None UseResFile(input) ntypes = Count1Types() for itype in range(1, 1+ntypes): type = Get1IndType(itype) nresources = Count1Resources(type) for ires in range(1, 1+nresources): res = Get1IndResource(type, ires) id, type, name = res.GetResInfo() lcname = string.lower(name) if (type, lcn... | 0f452fa557eaf41aa576f8644b0955efea8daaac /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0f452fa557eaf41aa576f8644b0955efea8daaac/BuildApplet.py |
TixWidget.__init__(self, master, 'tixDirList', ['options'], cnf, kw) self.subwidget_list['hlist'] = _dummyHList(self, 'hlist') self.subwidget_list['shlist'] = _dummyScrolledHList(self, 'vsb') | TixWidget.__init__(self, master, 'tixListNoteBook', ['options'], cnf, kw) self.subwidget_list['pane'] = _dummyPanedWindow(self, 'pane', destroy_physically=0) self.subwidget_list['hlist'] = _dummyHList(self, 'hlist') self.subwidget_list['shlist'] = _dummyScrolledHList(self, 'vsb') | def __init__(self, master, cnf={}, **kw): TixWidget.__init__(self, master, 'tixDirList', ['options'], cnf, kw) self.subwidget_list['hlist'] = _dummyHList(self, 'hlist') self.subwidget_list['shlist'] = _dummyScrolledHList(self, 'vsb') | 01824bf50c2967c264b0fb4a13d08bb5c1d9665c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/01824bf50c2967c264b0fb4a13d08bb5c1d9665c/Tix.py |
if os.name == "posix" and os.path.basename(sys.path[-1]) == "Modules": | if (os.name == "posix" and sys.path and os.path.basename(sys.path[-1]) == "Modules"): | def makepath(*paths): dir = os.path.abspath(os.path.join(*paths)) return dir, os.path.normcase(dir) | 7ccd30fa438ff5518752b34cadb41dd1c12d6032 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7ccd30fa438ff5518752b34cadb41dd1c12d6032/site.py |
__all__ = ["Random","seed","random","uniform","randint","choice", | __all__ = ["Random","seed","random","uniform","randint","choice","sample", | def create_generators(num, delta, firstseed=None): ""\"Return list of num distinct generators. Each generator has its own unique segment of delta elements from Random.random()'s full period. Seed the first generator with optional arg firstseed (default is None, to seed from current time). ""\" from random import Rando... | f24eb35d185c0623315cfbd9977d37c509860dcf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f24eb35d185c0623315cfbd9977d37c509860dcf/random.py |
def _test(N=20000): | def _test_sample(n): population = xrange(n) for k in xrange(n+1): s = sample(population, k) assert len(dict([(elem,True) for elem in s])) == len(s) == k def _sample_generator(n, k): return sample(xrange(n), k)[k//2] def _test(N=2000): | def _test(N=20000): print 'TWOPI =', TWOPI print 'LOG4 =', LOG4 print 'NV_MAGICCONST =', NV_MAGICCONST print 'SG_MAGICCONST =', SG_MAGICCONST _test_generator(N, 'random()') _test_generator(N, 'normalvariate(0.0, 1.0)') _test_generator(N, 'lognormvariate(0.0, 1.0)') _test_generator(N, 'cunifvariate(0.0,... | f24eb35d185c0623315cfbd9977d37c509860dcf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f24eb35d185c0623315cfbd9977d37c509860dcf/random.py |
InteractiveInterpreter.__init__(self) | locals = sys.modules['__main__'].__dict__ InteractiveInterpreter.__init__(self, locals=locals) | def __init__(self, tkconsole): self.tkconsole = tkconsole InteractiveInterpreter.__init__(self) | eeb88076e7f4a89ce76d271379ca0aced0c2d6c7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/eeb88076e7f4a89ce76d271379ca0aced0c2d6c7/PyShell.py |
filename = self.stuffsource(source) self.more = 0 return InteractiveInterpreter.runsource(self, source, filename) def stuffsource(self, source): | def runsource(self, source): # Extend base class to stuff the source in the line cache filename = "<pyshell#%d>" % self.gid self.gid = self.gid + 1 lines = string.split(source, "\n") linecache.cache[filename] = len(source)+1, 0, lines, filename self.more = 0 return InteractiveInterpreter.runsource(self, source, filenam... | eeb88076e7f4a89ce76d271379ca0aced0c2d6c7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/eeb88076e7f4a89ce76d271379ca0aced0c2d6c7/PyShell.py | |
self.more = 0 return InteractiveInterpreter.runsource(self, source, filename) | return filename | def runsource(self, source): # Extend base class to stuff the source in the line cache filename = "<pyshell#%d>" % self.gid self.gid = self.gid + 1 lines = string.split(source, "\n") linecache.cache[filename] = len(source)+1, 0, lines, filename self.more = 0 return InteractiveInterpreter.runsource(self, source, filenam... | eeb88076e7f4a89ce76d271379ca0aced0c2d6c7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/eeb88076e7f4a89ce76d271379ca0aced0c2d6c7/PyShell.py |
if char in string.letters + string.digits + "_": | if char and char in string.letters + string.digits + "_": | def showsyntaxerror(self, filename=None): # Extend base class to color the offending position # (instead of printing it and pointing at it with a caret) text = self.tkconsole.text stuff = self.unpackerror() if not stuff: self.tkconsole.resetoutput() InteractiveInterpreter.showsyntaxerror(self, filename) return msg, lin... | eeb88076e7f4a89ce76d271379ca0aced0c2d6c7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/eeb88076e7f4a89ce76d271379ca0aced0c2d6c7/PyShell.py |
ok = type == SyntaxError | ok = type is SyntaxError | def unpackerror(self): type, value, tb = sys.exc_info() ok = type == SyntaxError if ok: try: msg, (dummy_filename, lineno, offset, line) = value except: ok = 0 if ok: return msg, lineno, offset, line else: return None | eeb88076e7f4a89ce76d271379ca0aced0c2d6c7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/eeb88076e7f4a89ce76d271379ca0aced0c2d6c7/PyShell.py |
def toggle_debugger(self, event=None): if self.executing: tkMessageBox.showerror("Don't debug now", "You can only toggle the debugger when idle", master=self.text) self.set_debugger_indicator() return "break" else: db = self.interp.getdebugger() if db: self.close_debugger() else: self.open_debugger() | eeb88076e7f4a89ce76d271379ca0aced0c2d6c7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/eeb88076e7f4a89ce76d271379ca0aced0c2d6c7/PyShell.py | ||
sys.stdout = sys.__stdout__ sys.stderr = sys.__stderr__ sys.stdin = sys.__stdin__ | sys.stdout = self.save_stdout sys.stderr = self.save_stderr sys.stdin = self.save_stdin | def close(self): # Extend base class method if self.executing: # XXX Need to ask a question here if not tkMessageBox.askokcancel( "Kill?", "The program is still running; do you want to kill it?", default="ok", master=self.text): return "cancel" self.canceled = 1 if self.reading: self.top.quit() return "cancel" reply = ... | eeb88076e7f4a89ce76d271379ca0aced0c2d6c7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/eeb88076e7f4a89ce76d271379ca0aced0c2d6c7/PyShell.py |
return "Python Shell" | return self.shell_title | def short_title(self): return "Python Shell" | eeb88076e7f4a89ce76d271379ca0aced0c2d6c7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/eeb88076e7f4a89ce76d271379ca0aced0c2d6c7/PyShell.py |
opts, args = getopt.getopt(sys.argv[1:], "d") | opts, args = getopt.getopt(sys.argv[1:], "c:deist:") | def main(): debug = 0 try: opts, args = getopt.getopt(sys.argv[1:], "d") except getopt.error, msg: sys.stderr.write("Error: %s\n" % str(msg)) sys.exit(2) for o, a in opts: if o == "-d": debug = 1 global flist, root root = Tk() fixwordbreaks(root) root.withdraw() flist = PyShellFileList(root) if args: for filename in sy... | eeb88076e7f4a89ce76d271379ca0aced0c2d6c7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/eeb88076e7f4a89ce76d271379ca0aced0c2d6c7/PyShell.py |
if o == "-d": | if o == '-c': cmd = a if o == '-d': | def main(): debug = 0 try: opts, args = getopt.getopt(sys.argv[1:], "d") except getopt.error, msg: sys.stderr.write("Error: %s\n" % str(msg)) sys.exit(2) for o, a in opts: if o == "-d": debug = 1 global flist, root root = Tk() fixwordbreaks(root) root.withdraw() flist = PyShellFileList(root) if args: for filename in sy... | eeb88076e7f4a89ce76d271379ca0aced0c2d6c7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/eeb88076e7f4a89ce76d271379ca0aced0c2d6c7/PyShell.py |
if args: for filename in sys.argv[1:]: | if edit: for filename in args: | def main(): debug = 0 try: opts, args = getopt.getopt(sys.argv[1:], "d") except getopt.error, msg: sys.stderr.write("Error: %s\n" % str(msg)) sys.exit(2) for o, a in opts: if o == "-d": debug = 1 global flist, root root = Tk() fixwordbreaks(root) root.withdraw() flist = PyShellFileList(root) if args: for filename in sy... | eeb88076e7f4a89ce76d271379ca0aced0c2d6c7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/eeb88076e7f4a89ce76d271379ca0aced0c2d6c7/PyShell.py |
aPath = os.path.abspath(os.path.dirname(filename)) if not aPath in sys.path: sys.path.insert(0, aPath) else: aPath = os.getcwd() if not aPath in sys.path: sys.path.insert(0, aPath) t = PyShell(flist) flist.pyshell = t t.begin() | shell = PyShell(flist) interp = shell.interp flist.pyshell = shell if startup: filename = os.environ.get("IDLESTARTUP") or \ os.environ.get("PYTHONSTARTUP") if filename and os.path.isfile(filename): interp.execfile(filename) | def main(): debug = 0 try: opts, args = getopt.getopt(sys.argv[1:], "d") except getopt.error, msg: sys.stderr.write("Error: %s\n" % str(msg)) sys.exit(2) for o, a in opts: if o == "-d": debug = 1 global flist, root root = Tk() fixwordbreaks(root) root.withdraw() flist = PyShellFileList(root) if args: for filename in sy... | eeb88076e7f4a89ce76d271379ca0aced0c2d6c7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/eeb88076e7f4a89ce76d271379ca0aced0c2d6c7/PyShell.py |
t.open_debugger() | shell.open_debugger() if cmd: interp.execsource(cmd) elif not edit and args and args[0] != "-": interp.execfile(args[0]) shell.begin() | def main(): debug = 0 try: opts, args = getopt.getopt(sys.argv[1:], "d") except getopt.error, msg: sys.stderr.write("Error: %s\n" % str(msg)) sys.exit(2) for o, a in opts: if o == "-d": debug = 1 global flist, root root = Tk() fixwordbreaks(root) root.withdraw() flist = PyShellFileList(root) if args: for filename in sy... | eeb88076e7f4a89ce76d271379ca0aced0c2d6c7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/eeb88076e7f4a89ce76d271379ca0aced0c2d6c7/PyShell.py |
if self._debugging > 1: print '*put*', `line` | def _putline(self, line): #if self._debugging > 1: print '*put*', `line` self.sock.send('%s%s' % (line, CRLF)) | a16433b14edc4d4c08c97262609a3e8821ff1f6e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a16433b14edc4d4c08c97262609a3e8821ff1f6e/poplib.py | |
if self._debugging: print '*cmd*', `line` | def _putcmd(self, line): #if self._debugging: print '*cmd*', `line` self._putline(line) | a16433b14edc4d4c08c97262609a3e8821ff1f6e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a16433b14edc4d4c08c97262609a3e8821ff1f6e/poplib.py | |
if self._debugging > 1: print '*get*', `line` | def _getline(self): line = self.file.readline() #if self._debugging > 1: print '*get*', `line` if not line: raise error_proto('-ERR EOF') octets = len(line) # server can send any combination of CR & LF # however, 'readline()' returns lines ending in LF # so only possibilities are ...LF, ...CRLF, CR...LF if line[-2:] ==... | a16433b14edc4d4c08c97262609a3e8821ff1f6e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a16433b14edc4d4c08c97262609a3e8821ff1f6e/poplib.py | |
if self._debugging > 1: print '*resp*', `resp` | def _getresp(self): resp, o = self._getline() #if self._debugging > 1: print '*resp*', `resp` c = resp[:1] if c != '+': raise error_proto(resp) return resp | a16433b14edc4d4c08c97262609a3e8821ff1f6e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a16433b14edc4d4c08c97262609a3e8821ff1f6e/poplib.py | |
if self._debugging: print '*stat*', `rets` | def stat(self): """Get mailbox status. | a16433b14edc4d4c08c97262609a3e8821ff1f6e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a16433b14edc4d4c08c97262609a3e8821ff1f6e/poplib.py | |
if exppart: expo = eval(exppart[1:]) | if exppart: expo = int(exppart[1:]) | def extract(s): res = decoder.match(s) if res is None: raise NotANumber, s sign, intpart, fraction, exppart = res.group(1,2,3,4) if sign == '+': sign = '' if fraction: fraction = fraction[1:] if exppart: expo = eval(exppart[1:]) else: expo = 0 return sign, intpart, fraction, expo | 75ae7e7dfa49a3e1d094d3a4f1dc2782323f347d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/75ae7e7dfa49a3e1d094d3a4f1dc2782323f347d/fpformat.py |
pardir_fsr = Carbon.File.FSRef(fss) | pardir_fsr = Carbon.File.FSRef(pardir_fss) | def AskFileForSave(**args): default_flags = 0x07 args, tpwanted = _process_Nav_args(args, _ALLOWED_KEYS, default_flags) try: rr = Nav.NavPutFile(args) good = 1 except Nav.error, arg: if arg[0] != -128: # userCancelledErr raise Nav.error, arg return None if not rr.validRecord or not rr.selection: return None if issubcla... | e58962af4de4ff3a331be66c4413d1609de40633 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e58962af4de4ff3a331be66c4413d1609de40633/EasyDialogs.py |
return struct.unpack('8', data)[0] | return struct.unpack('d', data)[0] | def unpack_double(self): # XXX i = self.pos self.pos = j = i+8 data = self.buf[i:j] if len(data) < 8: raise EOFError return struct.unpack('8', data)[0] | 5b8b8cd6c08d8efb62d26ee6ec878a792a71d16f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5b8b8cd6c08d8efb62d26ee6ec878a792a71d16f/xdr.py |
while nl < 0: | while (nl < 0 and size > 0): | def readline(self, size=-1): """Read a line with approx. size. If size is negative, read a whole line. readline() and read() must not be mixed up (!). """ if size < 0: size = sys.maxint | c11d6f13ae2f83702f7ed8a26618eb378918c881 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c11d6f13ae2f83702f7ed8a26618eb378918c881/tarfile.py |
if size <= 0: break | def readline(self, size=-1): """Read a line with approx. size. If size is negative, read a whole line. readline() and read() must not be mixed up (!). """ if size < 0: size = sys.maxint | c11d6f13ae2f83702f7ed8a26618eb378918c881 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c11d6f13ae2f83702f7ed8a26618eb378918c881/tarfile.py | |
if os.environ.has_key("MSSdk") and self.find_exe("cl.exe"): | if os.environ.has_key("DISTUTILS_USE_SDK") and os.environ.has_key("MSSdk") and self.find_exe("cl.exe"): | def initialize(self): self.__paths = [] if os.environ.has_key("MSSdk") and self.find_exe("cl.exe"): # Assume that the SDK set up everything alright; don't try to be # smarter self.cc = "cl.exe" self.linker = "link.exe" self.lib = "lib.exe" self.rc = "rc.exe" self.mc = "mc.exe" else: self.__paths = self.get_msvc_paths("... | 8d65681e947e7c95173e0944ec6ea0277e66d591 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8d65681e947e7c95173e0944ec6ea0277e66d591/msvccompiler.py |
text = editwin.text text.bind("<<run-module>>", self.run_module) text.bind("<<run-script>>", self.run_script) text.bind("<<new-shell>>", self.new_shell) | self.flist = self.editwin.flist self.root = self.flist.root | def __init__(self, editwin): self.editwin = editwin text = editwin.text text.bind("<<run-module>>", self.run_module) text.bind("<<run-script>>", self.run_script) text.bind("<<new-shell>>", self.new_shell) | 9f4258490726c15a37484676177913a928b35783 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9f4258490726c15a37484676177913a928b35783/ScriptBinding.py |
def run_module(self, event=None): | def run_module_event(self, event, debugger=None): if not self.editwin.get_saved(): tkMessageBox.showerror("Not saved", "Please save first!", master=self.editwin.text) self.editwin.text.focus_set() return | def run_module(self, event=None): filename = self.editwin.io.filename if not filename: tkMessageBox.showerror("No file name", "This window has no file name", master=self.editwin.text) return modname, ext = os.path.splitext(os.path.basename(filename)) try: mod = sys.modules[modname] except KeyError: mod = imp.new_module... | 9f4258490726c15a37484676177913a928b35783 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9f4258490726c15a37484676177913a928b35783/ScriptBinding.py |
try: | if sys.modules.has_key(modname): | def run_module(self, event=None): filename = self.editwin.io.filename if not filename: tkMessageBox.showerror("No file name", "This window has no file name", master=self.editwin.text) return modname, ext = os.path.splitext(os.path.basename(filename)) try: mod = sys.modules[modname] except KeyError: mod = imp.new_module... | 9f4258490726c15a37484676177913a928b35783 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9f4258490726c15a37484676177913a928b35783/ScriptBinding.py |
except KeyError: | else: | def run_module(self, event=None): filename = self.editwin.io.filename if not filename: tkMessageBox.showerror("No file name", "This window has no file name", master=self.editwin.text) return modname, ext = os.path.splitext(os.path.basename(filename)) try: mod = sys.modules[modname] except KeyError: mod = imp.new_module... | 9f4258490726c15a37484676177913a928b35783 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9f4258490726c15a37484676177913a928b35783/ScriptBinding.py |
source = self.editwin.text.get("1.0", "end") exec source in mod.__dict__ | mod.__file__ = filename saveout = sys.stdout saveerr = sys.stderr owin = OnDemandOutputWindow(self.editwin.flist) try: sys.stderr = PseudoFile(owin, "stderr") try: sys.stdout = PseudoFile(owin, "stdout") try: if debugger: debugger.run("execfile(%s)" % `filename`, mod.__dict__) else: execfile(filename, mod.__dict__) exc... | def run_module(self, event=None): filename = self.editwin.io.filename if not filename: tkMessageBox.showerror("No file name", "This window has no file name", master=self.editwin.text) return modname, ext = os.path.splitext(os.path.basename(filename)) try: mod = sys.modules[modname] except KeyError: mod = imp.new_module... | 9f4258490726c15a37484676177913a928b35783 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9f4258490726c15a37484676177913a928b35783/ScriptBinding.py |
def run_script(self, event=None): | def debug_module_event(self, event): import Debugger debugger = Debugger.Debugger(self) self.run_module_event(event, debugger) def close_debugger(self): | def run_script(self, event=None): pass | 9f4258490726c15a37484676177913a928b35783 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9f4258490726c15a37484676177913a928b35783/ScriptBinding.py |
def new_shell(self, event=None): import PyShell pyshell = PyShell.PyShell(self.editwin.flist) pyshell.begin() | def run_script(self, event=None): pass | 9f4258490726c15a37484676177913a928b35783 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9f4258490726c15a37484676177913a928b35783/ScriptBinding.py | |
args['compiler_so'] = compiler | (ccshared,) = sysconfig.get_config_vars('CCSHARED') args['compiler_so'] = compiler + ' ' + ccshared | def build_extensions(self): | 9eb27a89d8e37504a685651963c390bf8ebf78ca /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9eb27a89d8e37504a685651963c390bf8ebf78ca/setup.py |
def test_getstatus(self): # This pattern should match 'ls -ld /.' on any posix # system, however perversely configured. pat = r'''d......... # It is a directory. \s+\d+ # It has some number of links. \s+\w+\s+\w+ # It has a user and group, which may # be named anything. \s+\d+ # It has a size. [^/]* ... | 884554dfe54fe4015a1ca2c0624e247dce9312f5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/884554dfe54fe4015a1ca2c0624e247dce9312f5/test_commands.py | ||
\s+\w+\s+\w+ \s+\d+ [^/]* | [^/]* | def test_getstatus(self): # This pattern should match 'ls -ld /.' on any posix # system, however perversely configured. pat = r'''d......... # It is a directory. \s+\d+ # It has some number of links. \s+\w+\s+\w+ # It has a user and group, which may # be named anything. \s+\d+ # It has a size. [^/]* ... | 884554dfe54fe4015a1ca2c0624e247dce9312f5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/884554dfe54fe4015a1ca2c0624e247dce9312f5/test_commands.py |
def putrequest(self, method, url): | def putrequest(self, method, url, skip_host=0): | def putrequest(self, method, url): """Send a request to the server. | 3921ff675ec544f3738bcaf606cca745b9a508ea /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3921ff675ec544f3738bcaf606cca745b9a508ea/httplib.py |
if url.startswith('http:'): nil, netloc, nil, nil, nil = urlsplit(url) self.putheader('Host', netloc) elif self.port == HTTP_PORT: self.putheader('Host', netloc) else: self.putheader('Host', "%s:%s" % (self.host, self.port)) | if not skip_host: netloc = '' if url.startswith('http'): nil, netloc, nil, nil, nil = urlsplit(url) if netloc: self.putheader('Host', netloc) elif self.port == HTTP_PORT: self.putheader('Host', self.host) else: self.putheader('Host', "%s:%s" % (self.host, self.port)) | def putrequest(self, method, url): """Send a request to the server. | 3921ff675ec544f3738bcaf606cca745b9a508ea /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3921ff675ec544f3738bcaf606cca745b9a508ea/httplib.py |
self.putrequest(method, url) | if (headers.has_key('Host') or [k for k in headers.iterkeys() if k.lower() == "host"]): self.putrequest(method, url, skip_host=1) else: self.putrequest(method, url) | def _send_request(self, method, url, body, headers): self.putrequest(method, url) | 3921ff675ec544f3738bcaf606cca745b9a508ea /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3921ff675ec544f3738bcaf606cca745b9a508ea/httplib.py |
while not is_all_white(line): | while lineno > 0 and not is_all_white(line): | def find_paragraph(text, mark): lineno, col = map(int, string.split(mark, ".")) line = text.get("%d.0" % lineno, "%d.0 lineend" % lineno) while is_all_white(line): lineno = lineno + 1 line = text.get("%d.0" % lineno, "%d.0 lineend" % lineno) first_lineno = lineno while not is_all_white(line): lineno = lineno + 1 line =... | e911c3e20cfa324e95f49d033cfe636543cce8cb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e911c3e20cfa324e95f49d033cfe636543cce8cb/FormatParagraph.py |
c = cmp(dict1, dict2) | if random.random() < 0.5: c = cmp(dict1, dict2) else: c = dict1 == dict2 | def test_one(n): global mutate, dict1, dict2, dict1keys, dict2keys # Fill the dicts without mutating them. mutate = 0 dict1keys = fill_dict(dict1, range(n), n) dict2keys = fill_dict(dict2, range(n), n) # Enable mutation, then compare the dicts so long as they have the # same size. mutate = 1 if verbose: print "trying... | a22975fb35e1bae0f85fc6ede1572264a7bcd1e6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a22975fb35e1bae0f85fc6ede1572264a7bcd1e6/test_mutants.py |
if netloc: | if netloc or (scheme in uses_netloc and url[:2] == '//'): | def urlunparse((scheme, netloc, url, params, query, fragment)): if netloc: if url[:1] != '/': url = '/' + url url = '//' + netloc + url if scheme: url = scheme + ':' + url if params: url = url + ';' + params if query: url = url + '?' + query if fragment: url = url + '#' + fragment return url | f3963b1269a9f4fde99724524a7afe81e974aa62 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f3963b1269a9f4fde99724524a7afe81e974aa62/urlparse.py |
url = '//' + netloc + url | url = '//' + (netloc or '') + url | def urlunparse((scheme, netloc, url, params, query, fragment)): if netloc: if url[:1] != '/': url = '/' + url url = '//' + netloc + url if scheme: url = scheme + ':' + url if params: url = url + ';' + params if query: url = url + '?' + query if fragment: url = url + '#' + fragment return url | f3963b1269a9f4fde99724524a7afe81e974aa62 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f3963b1269a9f4fde99724524a7afe81e974aa62/urlparse.py |
if self.re._num_regs == 1: return () return apply(self.group, tuple(range(1, self.re._num_regs) ) ) | result = [] for g in range(1, self.re._num_regs): if (self.regs[g][0] == -1) or (self.regs[g][1] == -1): result.append(None) else: result.append(self.string[self.regs[g][0]:self.regs[g][1]]) return tuple(result) | def groups(self): | 2b2b3f9bcb7d1cdf97b68f825489b5abfd42cf22 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/2b2b3f9bcb7d1cdf97b68f825489b5abfd42cf22/re.py |
proxies[protocol] = '%s://%s' % (protocol, address) | type, address = splittype(address) if not type: address = '%s://%s' % (protocol, address) proxies[protocol] = address | def getproxies_registry(): """Return a dictionary of scheme -> proxy server URL mappings. | b955d6c41e80806c8390dba47323ef7fc41f05aa /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b955d6c41e80806c8390dba47323ef7fc41f05aa/urllib.py |
class ListTestCase(unittest.TestCase): | class BaseTestCase(unittest.TestCase): | def __index__(self): return self.ind | 314861c568d4bf10af1102823e23c9efe648fa0c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/314861c568d4bf10af1102823e23c9efe648fa0c/test_index.py |
self.seq = [0,10,20,30,40,50] | def setUp(self): self.seq = [0,10,20,30,40,50] self.o = oldstyle() self.n = newstyle() self.o2 = oldstyle() self.n2 = newstyle() | 314861c568d4bf10af1102823e23c9efe648fa0c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/314861c568d4bf10af1102823e23c9efe648fa0c/test_index.py | |
def test_basic(self): self.o.ind = -2 self.n.ind = 2 assert(self.seq[self.n] == 20) assert(self.seq[self.o] == 40) assert(operator.index(self.o) == -2) assert(operator.index(self.n) == 2) def test_error(self): self.o.ind = 'dumb' self.n.ind = 'bad' myfunc = lambda x, obj: obj.seq[x] self.failUnlessRaises(TypeError, o... | def setUp(self): self.seq = [0,10,20,30,40,50] self.o = oldstyle() self.n = newstyle() self.o2 = oldstyle() self.n2 = newstyle() | 314861c568d4bf10af1102823e23c9efe648fa0c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/314861c568d4bf10af1102823e23c9efe648fa0c/test_index.py | |
class UnicodeTestCase(unittest.TestCase): def setUp(self): self.seq = u"this is a test" self.o = oldstyle() self.n = newstyle() self.o2 = oldstyle() self.n2 = newstyle() | def test_wrappers(self): n = self.n n.ind = 5 assert n.__index__() == 5 assert 6 .__index__() == 6 assert -7L.__index__() == -7 assert self.seq.__getitem__(n) == self.seq[5] assert self.seq.__mul__(n) == self.seq * 5 assert self.seq.__rmul__(n) == self.seq * 5 def test_infinite_recusion(self): class Trap1(int): def __... | def test_slice(self): self.o.ind = 1 self.o2.ind = 3 self.n.ind = 2 self.n2.ind = 4 assert(self.seq[self.o:self.o2] == self.seq[1:3]) assert(self.seq[self.n:self.n2] == self.seq[2:4]) | 314861c568d4bf10af1102823e23c9efe648fa0c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/314861c568d4bf10af1102823e23c9efe648fa0c/test_index.py |
def test_basic(self): | class ListTestCase(BaseTestCase): seq = [0,10,20,30,40,50] def test_setdelitem(self): | def test_basic(self): self.o.ind = -2 self.n.ind = 2 assert(self.seq[self.n] == self.seq[2]) assert(self.seq[self.o] == self.seq[-2]) assert(operator.index(self.o) == -2) assert(operator.index(self.n) == 2) | 314861c568d4bf10af1102823e23c9efe648fa0c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/314861c568d4bf10af1102823e23c9efe648fa0c/test_index.py |
assert(self.seq[self.n] == self.seq[2]) assert(self.seq[self.o] == self.seq[-2]) assert(operator.index(self.o) == -2) assert(operator.index(self.n) == 2) | lst = list('ab!cdefghi!j') del lst[self.o] del lst[self.n] lst[self.o] = 'X' lst[self.n] = 'Y' assert lst == list('abYdefghXj') | def test_basic(self): self.o.ind = -2 self.n.ind = 2 assert(self.seq[self.n] == self.seq[2]) assert(self.seq[self.o] == self.seq[-2]) assert(operator.index(self.o) == -2) assert(operator.index(self.n) == 2) | 314861c568d4bf10af1102823e23c9efe648fa0c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/314861c568d4bf10af1102823e23c9efe648fa0c/test_index.py |
def test_error(self): self.o.ind = 'dumb' self.n.ind = 'bad' myfunc = lambda x, obj: obj.seq[x] self.failUnlessRaises(TypeError, operator.index, self.o) self.failUnlessRaises(TypeError, operator.index, self.n) self.failUnlessRaises(TypeError, myfunc, self.o, self) self.failUnlessRaises(TypeError, myfunc, self.n, self) | lst = [5, 6, 7, 8, 9, 10, 11] lst.__setitem__(self.n, "here") assert lst == [5, 6, "here", 8, 9, 10, 11] lst.__delitem__(self.n) assert lst == [5, 6, 8, 9, 10, 11] | def test_error(self): self.o.ind = 'dumb' self.n.ind = 'bad' myfunc = lambda x, obj: obj.seq[x] self.failUnlessRaises(TypeError, operator.index, self.o) self.failUnlessRaises(TypeError, operator.index, self.n) self.failUnlessRaises(TypeError, myfunc, self.o, self) self.failUnlessRaises(TypeError, myfunc, self.n, self) | 314861c568d4bf10af1102823e23c9efe648fa0c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/314861c568d4bf10af1102823e23c9efe648fa0c/test_index.py |
def test_slice(self): self.o.ind = 1 self.o2.ind = 3 self.n.ind = 2 self.n2.ind = 4 assert(self.seq[self.o:self.o2] == self.seq[1:3]) assert(self.seq[self.n:self.n2] == self.seq[2:4]) | def test_inplace_repeat(self): self.o.ind = 2 self.n.ind = 3 lst = [6, 4] lst *= self.o assert lst == [6, 4, 6, 4] lst *= self.n assert lst == [6, 4, 6, 4] * 3 lst = [5, 6, 7, 8, 9, 11] l2 = lst.__imul__(self.n) assert l2 is lst assert lst == [5, 6, 7, 8, 9, 11] * 3 class TupleTestCase(BaseTestCase): seq = (0,10,20,... | def test_slice(self): self.o.ind = 1 self.o2.ind = 3 self.n.ind = 2 self.n2.ind = 4 assert(self.seq[self.o:self.o2] == self.seq[1:3]) assert(self.seq[self.n:self.n2] == self.seq[2:4]) | 314861c568d4bf10af1102823e23c9efe648fa0c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/314861c568d4bf10af1102823e23c9efe648fa0c/test_index.py |
UnicodeTestCase | UnicodeTestCase, XRangeTestCase, | def test_main(): test_support.run_unittest( ListTestCase, TupleTestCase, StringTestCase, UnicodeTestCase ) | 314861c568d4bf10af1102823e23c9efe648fa0c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/314861c568d4bf10af1102823e23c9efe648fa0c/test_index.py |
result.append('\\') result.append(char) | if char == '\000': result.append(r'\000') else: result.append('\\' + char) else: result.append(char) | def escape(pattern): "Escape all non-alphanumeric characters in pattern." result = [] alphanum=string.letters+'_'+string.digits for char in pattern: if char not in alphanum: result.append('\\') result.append(char) return string.join(result, '') | b1908846af1c70e77917d56798daa8242d80d2b5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b1908846af1c70e77917d56798daa8242d80d2b5/re.py |
if startupinfo == None: startupinfo = STARTUPINFO() if not None in (p2cread, c2pwrite, errwrite): startupinfo.dwFlags |= STARTF_USESTDHANDLES startupinfo.hStdInput = p2cread startupinfo.hStdOutput = c2pwrite startupinfo.hStdError = errwrite | def _execute_child(self, args, executable, preexec_fn, close_fds, cwd, env, universal_newlines, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite): """Execute program (MS Windows version)""" | c1d6536d60c39475895fb8691f81510393b9737b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c1d6536d60c39475895fb8691f81510393b9737b/subprocess.py | |
oparg = ord(code[i]) + ord(code[i+1])*256 | oparg = ord(code[i]) + ord(code[i+1])*256 + extended_arg extended_arg = 0 | def disassemble(co, lasti=-1): """Disassemble a code object.""" code = co.co_code labels = findlabels(code) n = len(code) i = 0 while i < n: c = code[i] op = ord(c) if op == SET_LINENO and i > 0: print # Extra blank line if i == lasti: print '-->', else: print ' ', if i in labels: print '>>', else: print ' ', print ... | ef8ace3a6f6cf8396fa92ae62352e8a29ddfca1d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ef8ace3a6f6cf8396fa92ae62352e8a29ddfca1d/dis.py |
def main(tests=None, testdir=None, verbose=0, quiet=0, generate=0, exclude=0, single=0, randomize=0, fromfile=None, findleaks=0, use_resources=None): | def main(tests=None, testdir=None, verbose=0, quiet=False, generate=False, exclude=False, single=False, randomize=False, fromfile=None, findleaks=False, use_resources=None, trace=False): | def main(tests=None, testdir=None, verbose=0, quiet=0, generate=0, exclude=0, single=0, randomize=0, fromfile=None, findleaks=0, use_resources=None): """Execute a test suite. This also parses command-line options and modifies its behavior accordingly. tests -- a list of strings containing test names (optional) testdi... | 3b6d025d9bc6a0109e9a2ebd28a4864e8007193a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3b6d025d9bc6a0109e9a2ebd28a4864e8007193a/regrtest.py |
The other default arguments (verbose, quiet, generate, exclude, single, randomize, findleaks, and use_resources) allow programmers calling main() directly to set the values that would normally be set by flags on the command line. | The other default arguments (verbose, quiet, generate, exclude, single, randomize, findleaks, use_resources, and trace) allow programmers calling main() directly to set the values that would normally be set by flags on the command line. | def main(tests=None, testdir=None, verbose=0, quiet=0, generate=0, exclude=0, single=0, randomize=0, fromfile=None, findleaks=0, use_resources=None): """Execute a test suite. This also parses command-line options and modifies its behavior accordingly. tests -- a list of strings containing test names (optional) testdi... | 3b6d025d9bc6a0109e9a2ebd28a4864e8007193a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3b6d025d9bc6a0109e9a2ebd28a4864e8007193a/regrtest.py |
opts, args = getopt.getopt(sys.argv[1:], 'hvgqxsrf:lu:t:', | opts, args = getopt.getopt(sys.argv[1:], 'hvgqxsrf:lu:t:T', | def main(tests=None, testdir=None, verbose=0, quiet=0, generate=0, exclude=0, single=0, randomize=0, fromfile=None, findleaks=0, use_resources=None): """Execute a test suite. This also parses command-line options and modifies its behavior accordingly. tests -- a list of strings containing test names (optional) testdi... | 3b6d025d9bc6a0109e9a2ebd28a4864e8007193a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3b6d025d9bc6a0109e9a2ebd28a4864e8007193a/regrtest.py |
'findleaks', 'use=', 'threshold=']) | 'findleaks', 'use=', 'threshold=', 'trace', ]) | def main(tests=None, testdir=None, verbose=0, quiet=0, generate=0, exclude=0, single=0, randomize=0, fromfile=None, findleaks=0, use_resources=None): """Execute a test suite. This also parses command-line options and modifies its behavior accordingly. tests -- a list of strings containing test names (optional) testdi... | 3b6d025d9bc6a0109e9a2ebd28a4864e8007193a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3b6d025d9bc6a0109e9a2ebd28a4864e8007193a/regrtest.py |
quiet = 1; | quiet = True; | def main(tests=None, testdir=None, verbose=0, quiet=0, generate=0, exclude=0, single=0, randomize=0, fromfile=None, findleaks=0, use_resources=None): """Execute a test suite. This also parses command-line options and modifies its behavior accordingly. tests -- a list of strings containing test names (optional) testdi... | 3b6d025d9bc6a0109e9a2ebd28a4864e8007193a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3b6d025d9bc6a0109e9a2ebd28a4864e8007193a/regrtest.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.