rem
stringlengths 1
322k
| add
stringlengths 0
2.05M
| context
stringlengths 4
228k
| meta
stringlengths 156
215
|
---|---|---|---|
def __init__(self): pass | cd259d0b401f8cdd859bd55167610230d9a44f5d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/cd259d0b401f8cdd859bd55167610230d9a44f5d/socket.py |
||
def __init__(self, sock): | def __init__(self, sock, rw): if rw not in ('r', 'w'): raise ValueError, "mode must be 'r' or 'w'" | def __init__(self, sock): self.sock = sock self.buf = '' | cd259d0b401f8cdd859bd55167610230d9a44f5d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/cd259d0b401f8cdd859bd55167610230d9a44f5d/socket.py |
def read(self, *arg): if arg: length = arg else: | def read(self, length = 0): if length <= 0: | def read(self, *arg): if arg: length = arg else: length = 0x7fffffff while len(self.buf) < length: new = self.sock.recv(0x7fffffff) if not new: break self.buf = self.buf + new rv = self.buf[:length] self.buf = self.buf[length:] return rv | cd259d0b401f8cdd859bd55167610230d9a44f5d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/cd259d0b401f8cdd859bd55167610230d9a44f5d/socket.py |
def readline(self): import string while not '\n' in self.buf: new = self.sock.recv(0x7fffffff) if not new: break self.buf = self.buf + new if not '\n' in self.buf: rv = self.buf self.buf = '' else: i = string.index(self.buf, '\n') rv = self.buf[:i+1] self.buf = self.buf[i+1:] return rv | cd259d0b401f8cdd859bd55167610230d9a44f5d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/cd259d0b401f8cdd859bd55167610230d9a44f5d/socket.py |
||
self.sock.send(buf) | BS = 512 if len(buf) >= BS: self.flush() self.sock.send(buf) elif len(buf) + len(self.buf) >= BS: self.flush() self.buf = buf else: self.buf = self.buf + buf def flush(self): if self.buf and self.rw == 'w': self.sock.send(self.buf) self.buf = '' | def write(self, buf): self.sock.send(buf) | cd259d0b401f8cdd859bd55167610230d9a44f5d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/cd259d0b401f8cdd859bd55167610230d9a44f5d/socket.py |
self.sock.close() | self.flush() | def close(self): self.sock.close() del self.sock | cd259d0b401f8cdd859bd55167610230d9a44f5d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/cd259d0b401f8cdd859bd55167610230d9a44f5d/socket.py |
def close(self): self.sock.close() del self.sock | cd259d0b401f8cdd859bd55167610230d9a44f5d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/cd259d0b401f8cdd859bd55167610230d9a44f5d/socket.py |
||
self.failUnless(3 in p, "proxy didn't support __contains__() properly") | self.failUnless(3 in p, "proxy didn't support __contains__() properly") | def test_basic_proxy(self): o = C() self.check_proxy(o, weakref.proxy(o)) | f425b1ec420b95ce4d6bb6dc35472ad9652110dc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f425b1ec420b95ce4d6bb6dc35472ad9652110dc/test_weakref.py |
self.assert_(len(values) == 0, "itervalues() did not touch all values") | self.assert_(len(values) == 0, "itervalues() did not touch all values") | def check_iters(self, dict): # item iterator: items = dict.items() for item in dict.iteritems(): items.remove(item) self.assert_(len(items) == 0, "iteritems() did not touch all items") | f425b1ec420b95ce4d6bb6dc35472ad9652110dc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f425b1ec420b95ce4d6bb6dc35472ad9652110dc/test_weakref.py |
"""Check that WeakValueDictionary class conforms to the mapping protocol""" | """Check that WeakValueDictionary conforms to the mapping protocol""" | def __eq__(self, other): if mutate: # Side effect that mutates the dict, by removing the # last strong reference to a key. del objs[-1] return self.value == other.value | f425b1ec420b95ce4d6bb6dc35472ad9652110dc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f425b1ec420b95ce4d6bb6dc35472ad9652110dc/test_weakref.py |
"""Check that WeakKeyDictionary class conforms to the mapping protocol""" | """Check that WeakKeyDictionary conforms to the mapping protocol""" | def _reference(self): return self.__ref.copy() | f425b1ec420b95ce4d6bb6dc35472ad9652110dc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f425b1ec420b95ce4d6bb6dc35472ad9652110dc/test_weakref.py |
WeakKeyDictionaryTestCase ) | WeakKeyDictionaryTestCase, ) | def test_main(): test_support.run_unittest( ReferencesTestCase, MappingTestCase, WeakValueDictionaryTestCase, WeakKeyDictionaryTestCase ) | f425b1ec420b95ce4d6bb6dc35472ad9652110dc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f425b1ec420b95ce4d6bb6dc35472ad9652110dc/test_weakref.py |
host, port = self.socket.getsockname() | host, port = self.socket.getsockname()[:2] | def server_bind(self): """Override server_bind to store the server name.""" SocketServer.TCPServer.server_bind(self) host, port = self.socket.getsockname() self.server_name = socket.getfqdn(host) self.server_port = port | 3c120debef6bb1705de1a89cae8f9a87d9b43ae4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3c120debef6bb1705de1a89cae8f9a87d9b43ae4/BaseHTTPServer.py |
host, port = self.client_address | host, port = self.client_address[:2] | def address_string(self): """Return the client address formatted for logging. | 3c120debef6bb1705de1a89cae8f9a87d9b43ae4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3c120debef6bb1705de1a89cae8f9a87d9b43ae4/BaseHTTPServer.py |
return '%s/%s' % (str(self.__num), str(self.__den)) | return '(%s/%s)' % (str(self.__num), str(self.__den)) | def __str__(self): if self.__den == 1: return str(self.__num) else: return '%s/%s' % (str(self.__num), str(self.__den)) | 7ca9a1a466992e556b3192a7a0ba8baa652e342a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7ca9a1a466992e556b3192a7a0ba8baa652e342a/Rat.py |
diff = a - b | diff = Rat(a - b) | def __cmp__(a, b): diff = a - b if diff.__num < 0: return -1 elif diff.__num > 0: return 1 else: return 0 | 7ca9a1a466992e556b3192a7a0ba8baa652e342a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7ca9a1a466992e556b3192a7a0ba8baa652e342a/Rat.py |
11/10 11/10 | (11/10) (11/10) | def test(): '''\ Test function for rat module. The expected output is (module some differences in floating precission): -1 -1 0 0L 0.1 (0.1+0j) [Rat(1,2), Rat(-3,10), Rat(1,25), Rat(1,4)] [Rat(-3,10), Rat(1,25), Rat(1,4), Rat(1,2)] 0 11/10 11/10 1.1 OK 2 1.5 3/2 (1.5+1.5j) 15707963/5000000 2 2 2.0 (2+0j) 4 0 4 1 4 0 3.5 0.5 3.0 1.33333333333 2.82842712475 1 7/2 1/2 3 4/3 2.82842712475 1 (3.5+1.5j) (0.5-1.5j) (3+3j) (0.666666666667-0.666666666667j) (1.43248815986+2.43884761145j) 1 1.5 1 1.5 (1.5+0j) 3.5 -0.5 3.0 0.75 2.25 -1 3.0 0.0 2.25 1.0 1.83711730709 0 3.0 0.0 2.25 1.0 1.83711730709 1 (3+1.5j) -1.5j (2.25+2.25j) (0.5-0.5j) (1.50768393746+1.04970907623j) -1 3/2 1 1.5 (1.5+0j) 7/2 -1/2 3 3/4 9/4 -1 3.0 0.0 2.25 1.0 1.83711730709 -1 3 0 9/4 1 1.83711730709 0 (3+1.5j) -1.5j (2.25+2.25j) (0.5-0.5j) (1.50768393746+1.04970907623j) -1 (1.5+1.5j) (1.5+1.5j) (3.5+1.5j) (-0.5+1.5j) (3+3j) (0.75+0.75j) 4.5j -1 (3+1.5j) 1.5j (2.25+2.25j) (1+1j) (1.18235814075+2.85446505899j) 1 (3+1.5j) 1.5j (2.25+2.25j) (1+1j) (1.18235814075+2.85446505899j) 1 (3+3j) 0j 4.5j (1+0j) (-0.638110484918+0.705394566962j) 0 ''' print rat(-1L, 1) print rat(1, -1) a = rat(1, 10) print int(a), long(a), float(a), complex(a) b = rat(2, 5) l = [a+b, a-b, a*b, a/b] print l l.sort() print l print rat(0, 1) print a+1 print a+1L print a+1.0 try: print rat(1, 0) raise SystemError, 'should have been ZeroDivisionError' except ZeroDivisionError: print 'OK' print rat(2), rat(1.5), rat(3, 2), rat(1.5+1.5j), rat(31415926,10000000) list = [2, 1.5, rat(3,2), 1.5+1.5j] for i in list: print i, if type(i) is not ComplexType: print int(i), float(i), print complex(i) print for j in list: print i + j, i - j, i * j, i / j, i ** j, cmp(i, j) | 7ca9a1a466992e556b3192a7a0ba8baa652e342a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7ca9a1a466992e556b3192a7a0ba8baa652e342a/Rat.py |
2 1.5 3/2 (1.5+1.5j) 15707963/5000000 | 2 1.5 (3/2) (1.5+1.5j) (15707963/5000000) | def test(): '''\ Test function for rat module. The expected output is (module some differences in floating precission): -1 -1 0 0L 0.1 (0.1+0j) [Rat(1,2), Rat(-3,10), Rat(1,25), Rat(1,4)] [Rat(-3,10), Rat(1,25), Rat(1,4), Rat(1,2)] 0 11/10 11/10 1.1 OK 2 1.5 3/2 (1.5+1.5j) 15707963/5000000 2 2 2.0 (2+0j) 4 0 4 1 4 0 3.5 0.5 3.0 1.33333333333 2.82842712475 1 7/2 1/2 3 4/3 2.82842712475 1 (3.5+1.5j) (0.5-1.5j) (3+3j) (0.666666666667-0.666666666667j) (1.43248815986+2.43884761145j) 1 1.5 1 1.5 (1.5+0j) 3.5 -0.5 3.0 0.75 2.25 -1 3.0 0.0 2.25 1.0 1.83711730709 0 3.0 0.0 2.25 1.0 1.83711730709 1 (3+1.5j) -1.5j (2.25+2.25j) (0.5-0.5j) (1.50768393746+1.04970907623j) -1 3/2 1 1.5 (1.5+0j) 7/2 -1/2 3 3/4 9/4 -1 3.0 0.0 2.25 1.0 1.83711730709 -1 3 0 9/4 1 1.83711730709 0 (3+1.5j) -1.5j (2.25+2.25j) (0.5-0.5j) (1.50768393746+1.04970907623j) -1 (1.5+1.5j) (1.5+1.5j) (3.5+1.5j) (-0.5+1.5j) (3+3j) (0.75+0.75j) 4.5j -1 (3+1.5j) 1.5j (2.25+2.25j) (1+1j) (1.18235814075+2.85446505899j) 1 (3+1.5j) 1.5j (2.25+2.25j) (1+1j) (1.18235814075+2.85446505899j) 1 (3+3j) 0j 4.5j (1+0j) (-0.638110484918+0.705394566962j) 0 ''' print rat(-1L, 1) print rat(1, -1) a = rat(1, 10) print int(a), long(a), float(a), complex(a) b = rat(2, 5) l = [a+b, a-b, a*b, a/b] print l l.sort() print l print rat(0, 1) print a+1 print a+1L print a+1.0 try: print rat(1, 0) raise SystemError, 'should have been ZeroDivisionError' except ZeroDivisionError: print 'OK' print rat(2), rat(1.5), rat(3, 2), rat(1.5+1.5j), rat(31415926,10000000) list = [2, 1.5, rat(3,2), 1.5+1.5j] for i in list: print i, if type(i) is not ComplexType: print int(i), float(i), print complex(i) print for j in list: print i + j, i - j, i * j, i / j, i ** j, cmp(i, j) | 7ca9a1a466992e556b3192a7a0ba8baa652e342a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7ca9a1a466992e556b3192a7a0ba8baa652e342a/Rat.py |
7/2 1/2 3 4/3 2.82842712475 1 | (7/2) (1/2) 3 (4/3) 2.82842712475 1 | def test(): '''\ Test function for rat module. The expected output is (module some differences in floating precission): -1 -1 0 0L 0.1 (0.1+0j) [Rat(1,2), Rat(-3,10), Rat(1,25), Rat(1,4)] [Rat(-3,10), Rat(1,25), Rat(1,4), Rat(1,2)] 0 11/10 11/10 1.1 OK 2 1.5 3/2 (1.5+1.5j) 15707963/5000000 2 2 2.0 (2+0j) 4 0 4 1 4 0 3.5 0.5 3.0 1.33333333333 2.82842712475 1 7/2 1/2 3 4/3 2.82842712475 1 (3.5+1.5j) (0.5-1.5j) (3+3j) (0.666666666667-0.666666666667j) (1.43248815986+2.43884761145j) 1 1.5 1 1.5 (1.5+0j) 3.5 -0.5 3.0 0.75 2.25 -1 3.0 0.0 2.25 1.0 1.83711730709 0 3.0 0.0 2.25 1.0 1.83711730709 1 (3+1.5j) -1.5j (2.25+2.25j) (0.5-0.5j) (1.50768393746+1.04970907623j) -1 3/2 1 1.5 (1.5+0j) 7/2 -1/2 3 3/4 9/4 -1 3.0 0.0 2.25 1.0 1.83711730709 -1 3 0 9/4 1 1.83711730709 0 (3+1.5j) -1.5j (2.25+2.25j) (0.5-0.5j) (1.50768393746+1.04970907623j) -1 (1.5+1.5j) (1.5+1.5j) (3.5+1.5j) (-0.5+1.5j) (3+3j) (0.75+0.75j) 4.5j -1 (3+1.5j) 1.5j (2.25+2.25j) (1+1j) (1.18235814075+2.85446505899j) 1 (3+1.5j) 1.5j (2.25+2.25j) (1+1j) (1.18235814075+2.85446505899j) 1 (3+3j) 0j 4.5j (1+0j) (-0.638110484918+0.705394566962j) 0 ''' print rat(-1L, 1) print rat(1, -1) a = rat(1, 10) print int(a), long(a), float(a), complex(a) b = rat(2, 5) l = [a+b, a-b, a*b, a/b] print l l.sort() print l print rat(0, 1) print a+1 print a+1L print a+1.0 try: print rat(1, 0) raise SystemError, 'should have been ZeroDivisionError' except ZeroDivisionError: print 'OK' print rat(2), rat(1.5), rat(3, 2), rat(1.5+1.5j), rat(31415926,10000000) list = [2, 1.5, rat(3,2), 1.5+1.5j] for i in list: print i, if type(i) is not ComplexType: print int(i), float(i), print complex(i) print for j in list: print i + j, i - j, i * j, i / j, i ** j, cmp(i, j) | 7ca9a1a466992e556b3192a7a0ba8baa652e342a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7ca9a1a466992e556b3192a7a0ba8baa652e342a/Rat.py |
3/2 1 1.5 (1.5+0j) 7/2 -1/2 3 3/4 9/4 -1 | (3/2) 1 1.5 (1.5+0j) (7/2) (-1/2) 3 (3/4) (9/4) -1 | def test(): '''\ Test function for rat module. The expected output is (module some differences in floating precission): -1 -1 0 0L 0.1 (0.1+0j) [Rat(1,2), Rat(-3,10), Rat(1,25), Rat(1,4)] [Rat(-3,10), Rat(1,25), Rat(1,4), Rat(1,2)] 0 11/10 11/10 1.1 OK 2 1.5 3/2 (1.5+1.5j) 15707963/5000000 2 2 2.0 (2+0j) 4 0 4 1 4 0 3.5 0.5 3.0 1.33333333333 2.82842712475 1 7/2 1/2 3 4/3 2.82842712475 1 (3.5+1.5j) (0.5-1.5j) (3+3j) (0.666666666667-0.666666666667j) (1.43248815986+2.43884761145j) 1 1.5 1 1.5 (1.5+0j) 3.5 -0.5 3.0 0.75 2.25 -1 3.0 0.0 2.25 1.0 1.83711730709 0 3.0 0.0 2.25 1.0 1.83711730709 1 (3+1.5j) -1.5j (2.25+2.25j) (0.5-0.5j) (1.50768393746+1.04970907623j) -1 3/2 1 1.5 (1.5+0j) 7/2 -1/2 3 3/4 9/4 -1 3.0 0.0 2.25 1.0 1.83711730709 -1 3 0 9/4 1 1.83711730709 0 (3+1.5j) -1.5j (2.25+2.25j) (0.5-0.5j) (1.50768393746+1.04970907623j) -1 (1.5+1.5j) (1.5+1.5j) (3.5+1.5j) (-0.5+1.5j) (3+3j) (0.75+0.75j) 4.5j -1 (3+1.5j) 1.5j (2.25+2.25j) (1+1j) (1.18235814075+2.85446505899j) 1 (3+1.5j) 1.5j (2.25+2.25j) (1+1j) (1.18235814075+2.85446505899j) 1 (3+3j) 0j 4.5j (1+0j) (-0.638110484918+0.705394566962j) 0 ''' print rat(-1L, 1) print rat(1, -1) a = rat(1, 10) print int(a), long(a), float(a), complex(a) b = rat(2, 5) l = [a+b, a-b, a*b, a/b] print l l.sort() print l print rat(0, 1) print a+1 print a+1L print a+1.0 try: print rat(1, 0) raise SystemError, 'should have been ZeroDivisionError' except ZeroDivisionError: print 'OK' print rat(2), rat(1.5), rat(3, 2), rat(1.5+1.5j), rat(31415926,10000000) list = [2, 1.5, rat(3,2), 1.5+1.5j] for i in list: print i, if type(i) is not ComplexType: print int(i), float(i), print complex(i) print for j in list: print i + j, i - j, i * j, i / j, i ** j, cmp(i, j) | 7ca9a1a466992e556b3192a7a0ba8baa652e342a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7ca9a1a466992e556b3192a7a0ba8baa652e342a/Rat.py |
3 0 9/4 1 1.83711730709 0 | 3 0 (9/4) 1 1.83711730709 0 | def test(): '''\ Test function for rat module. The expected output is (module some differences in floating precission): -1 -1 0 0L 0.1 (0.1+0j) [Rat(1,2), Rat(-3,10), Rat(1,25), Rat(1,4)] [Rat(-3,10), Rat(1,25), Rat(1,4), Rat(1,2)] 0 11/10 11/10 1.1 OK 2 1.5 3/2 (1.5+1.5j) 15707963/5000000 2 2 2.0 (2+0j) 4 0 4 1 4 0 3.5 0.5 3.0 1.33333333333 2.82842712475 1 7/2 1/2 3 4/3 2.82842712475 1 (3.5+1.5j) (0.5-1.5j) (3+3j) (0.666666666667-0.666666666667j) (1.43248815986+2.43884761145j) 1 1.5 1 1.5 (1.5+0j) 3.5 -0.5 3.0 0.75 2.25 -1 3.0 0.0 2.25 1.0 1.83711730709 0 3.0 0.0 2.25 1.0 1.83711730709 1 (3+1.5j) -1.5j (2.25+2.25j) (0.5-0.5j) (1.50768393746+1.04970907623j) -1 3/2 1 1.5 (1.5+0j) 7/2 -1/2 3 3/4 9/4 -1 3.0 0.0 2.25 1.0 1.83711730709 -1 3 0 9/4 1 1.83711730709 0 (3+1.5j) -1.5j (2.25+2.25j) (0.5-0.5j) (1.50768393746+1.04970907623j) -1 (1.5+1.5j) (1.5+1.5j) (3.5+1.5j) (-0.5+1.5j) (3+3j) (0.75+0.75j) 4.5j -1 (3+1.5j) 1.5j (2.25+2.25j) (1+1j) (1.18235814075+2.85446505899j) 1 (3+1.5j) 1.5j (2.25+2.25j) (1+1j) (1.18235814075+2.85446505899j) 1 (3+3j) 0j 4.5j (1+0j) (-0.638110484918+0.705394566962j) 0 ''' print rat(-1L, 1) print rat(1, -1) a = rat(1, 10) print int(a), long(a), float(a), complex(a) b = rat(2, 5) l = [a+b, a-b, a*b, a/b] print l l.sort() print l print rat(0, 1) print a+1 print a+1L print a+1.0 try: print rat(1, 0) raise SystemError, 'should have been ZeroDivisionError' except ZeroDivisionError: print 'OK' print rat(2), rat(1.5), rat(3, 2), rat(1.5+1.5j), rat(31415926,10000000) list = [2, 1.5, rat(3,2), 1.5+1.5j] for i in list: print i, if type(i) is not ComplexType: print int(i), float(i), print complex(i) print for j in list: print i + j, i - j, i * j, i / j, i ** j, cmp(i, j) | 7ca9a1a466992e556b3192a7a0ba8baa652e342a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7ca9a1a466992e556b3192a7a0ba8baa652e342a/Rat.py |
applemenu.AppendMenu("All about cgitest...;(-") | applemenu.AppendMenu("About %s...;(-" % self.__class__.__name__) | def __init__(self): self.quitting = 0 # Initialize menu self.appleid = 1 self.quitid = 2 Menu.ClearMenuBar() self.applemenu = applemenu = Menu.NewMenu(self.appleid, "\024") applemenu.AppendMenu("All about cgitest...;(-") applemenu.AppendResMenu('DRVR') applemenu.InsertMenu(0) self.quitmenu = Menu.NewMenu(self.quitid, "File") self.quitmenu.AppendMenu("Quit") self.quitmenu.InsertMenu(0) Menu.DrawMenuBar() | 7ec7c8ad66986c1daabaf0d4636bce55d3c78ce8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7ec7c8ad66986c1daabaf0d4636bce55d3c78ce8/MiniAEFrame.py |
def __del__(self): self.close() | 7ec7c8ad66986c1daabaf0d4636bce55d3c78ce8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7ec7c8ad66986c1daabaf0d4636bce55d3c78ce8/MiniAEFrame.py |
||
def close(self): pass | 7ec7c8ad66986c1daabaf0d4636bce55d3c78ce8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7ec7c8ad66986c1daabaf0d4636bce55d3c78ce8/MiniAEFrame.py |
||
def mainloop(self, mask = everyEvent, timeout = 60*60): while not self.quitting: self.dooneevent(mask, timeout) | 7ec7c8ad66986c1daabaf0d4636bce55d3c78ce8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7ec7c8ad66986c1daabaf0d4636bce55d3c78ce8/MiniAEFrame.py |
||
if c == '.' and modifiers & cmdKey: raise KeyboardInterrupt, "Command-period" | if modifiers & cmdKey: if c == '.': raise KeyboardInterrupt, "Command-period" if c == 'q': self.quitting = 1 | def lowlevelhandler(self, event): what, message, when, where, modifiers = event h, v = where if what == kHighLevelEvent: msg = "High Level Event: %s %s" % \ (`code(message)`, `code(h | (v<<16))`) try: AE.AEProcessAppleEvent(event) except AE.Error, err: print 'AE error: ', err print 'in', msg traceback.print_exc() return elif what == keyDown: c = chr(message & charCodeMask) if c == '.' and modifiers & cmdKey: raise KeyboardInterrupt, "Command-period" elif what == mouseDown: partcode, window = Win.FindWindow(where) if partcode == inMenuBar: result = Menu.MenuSelect(where) id = (result>>16) & 0xffff # Hi word item = result & 0xffff # Lo word if id == self.appleid: if item == 1: EasyDialogs.Message("cgitest - First cgi test") return elif item > 1: name = self.applemenu.GetItem(item) Qd.OpenDeskAcc(name) return if id == self.quitid and item == 1: print "Menu-requested QUIT" self.quitting = 1 # Anything not handled is passed to Python/SIOUX MacOS.HandleEvent(event) | 7ec7c8ad66986c1daabaf0d4636bce55d3c78ce8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7ec7c8ad66986c1daabaf0d4636bce55d3c78ce8/MiniAEFrame.py |
EasyDialogs.Message("cgitest - First cgi test") return | EasyDialogs.Message(self.getabouttext()) | def lowlevelhandler(self, event): what, message, when, where, modifiers = event h, v = where if what == kHighLevelEvent: msg = "High Level Event: %s %s" % \ (`code(message)`, `code(h | (v<<16))`) try: AE.AEProcessAppleEvent(event) except AE.Error, err: print 'AE error: ', err print 'in', msg traceback.print_exc() return elif what == keyDown: c = chr(message & charCodeMask) if c == '.' and modifiers & cmdKey: raise KeyboardInterrupt, "Command-period" elif what == mouseDown: partcode, window = Win.FindWindow(where) if partcode == inMenuBar: result = Menu.MenuSelect(where) id = (result>>16) & 0xffff # Hi word item = result & 0xffff # Lo word if id == self.appleid: if item == 1: EasyDialogs.Message("cgitest - First cgi test") return elif item > 1: name = self.applemenu.GetItem(item) Qd.OpenDeskAcc(name) return if id == self.quitid and item == 1: print "Menu-requested QUIT" self.quitting = 1 # Anything not handled is passed to Python/SIOUX MacOS.HandleEvent(event) | 7ec7c8ad66986c1daabaf0d4636bce55d3c78ce8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7ec7c8ad66986c1daabaf0d4636bce55d3c78ce8/MiniAEFrame.py |
name = self.applemenu.GetItem(item) Qd.OpenDeskAcc(name) return if id == self.quitid and item == 1: print "Menu-requested QUIT" | name = self.applemenu.GetMenuItemText(item) Menu.OpenDeskAcc(name) elif id == self.quitid and item == 1: | def lowlevelhandler(self, event): what, message, when, where, modifiers = event h, v = where if what == kHighLevelEvent: msg = "High Level Event: %s %s" % \ (`code(message)`, `code(h | (v<<16))`) try: AE.AEProcessAppleEvent(event) except AE.Error, err: print 'AE error: ', err print 'in', msg traceback.print_exc() return elif what == keyDown: c = chr(message & charCodeMask) if c == '.' and modifiers & cmdKey: raise KeyboardInterrupt, "Command-period" elif what == mouseDown: partcode, window = Win.FindWindow(where) if partcode == inMenuBar: result = Menu.MenuSelect(where) id = (result>>16) & 0xffff # Hi word item = result & 0xffff # Lo word if id == self.appleid: if item == 1: EasyDialogs.Message("cgitest - First cgi test") return elif item > 1: name = self.applemenu.GetItem(item) Qd.OpenDeskAcc(name) return if id == self.quitid and item == 1: print "Menu-requested QUIT" self.quitting = 1 # Anything not handled is passed to Python/SIOUX MacOS.HandleEvent(event) | 7ec7c8ad66986c1daabaf0d4636bce55d3c78ce8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7ec7c8ad66986c1daabaf0d4636bce55d3c78ce8/MiniAEFrame.py |
MacOS.HandleEvent(event) | Menu.HiliteMenu(0) else: MacOS.HandleEvent(event) def getabouttext(self): return self.__class__.__name__ | def lowlevelhandler(self, event): what, message, when, where, modifiers = event h, v = where if what == kHighLevelEvent: msg = "High Level Event: %s %s" % \ (`code(message)`, `code(h | (v<<16))`) try: AE.AEProcessAppleEvent(event) except AE.Error, err: print 'AE error: ', err print 'in', msg traceback.print_exc() return elif what == keyDown: c = chr(message & charCodeMask) if c == '.' and modifiers & cmdKey: raise KeyboardInterrupt, "Command-period" elif what == mouseDown: partcode, window = Win.FindWindow(where) if partcode == inMenuBar: result = Menu.MenuSelect(where) id = (result>>16) & 0xffff # Hi word item = result & 0xffff # Lo word if id == self.appleid: if item == 1: EasyDialogs.Message("cgitest - First cgi test") return elif item > 1: name = self.applemenu.GetItem(item) Qd.OpenDeskAcc(name) return if id == self.quitid and item == 1: print "Menu-requested QUIT" self.quitting = 1 # Anything not handled is passed to Python/SIOUX MacOS.HandleEvent(event) | 7ec7c8ad66986c1daabaf0d4636bce55d3c78ce8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7ec7c8ad66986c1daabaf0d4636bce55d3c78ce8/MiniAEFrame.py |
def __init__(self): self.ae_handlers = {} | 7ec7c8ad66986c1daabaf0d4636bce55d3c78ce8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7ec7c8ad66986c1daabaf0d4636bce55d3c78ce8/MiniAEFrame.py |
||
def close(self): for classe, type in self.ae_handlers.keys(): AE.AERemoveEventHandler(classe, type) | 7ec7c8ad66986c1daabaf0d4636bce55d3c78ce8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7ec7c8ad66986c1daabaf0d4636bce55d3c78ce8/MiniAEFrame.py |
||
def callback_wrapper(self, _request, _reply): _parameters, _attributes = aetools.unpackevent(_request) _class = _attributes['evcl'].type _type = _attributes['evid'].type if self.ae_handlers.has_key((_class, _type)): _function = self.ae_handlers[(_class, _type)] elif self.ae_handlers.has_key((_class, '****')): _function = self.ae_handlers[(_class, '****')] elif self.ae_handlers.has_key(('****', '****')): _function = self.ae_handlers[('****', '****')] else: raise 'Cannot happen: AE callback without handler', (_class, _type) # XXXX Do key-to-name mapping here _parameters['_attributes'] = _attributes _parameters['_class'] = _class _parameters['_type'] = _type if _parameters.has_key('----'): _object = _parameters['----'] del _parameters['----'] try: rv = apply(_function, (_object,), _parameters) except TypeError, name: raise TypeError, ('AppleEvent handler misses formal keyword argument', _function, name) else: try: rv = apply(_function, (), _parameters) except TypeError, name: raise TypeError, ('AppleEvent handler misses formal keyword argument', _function, name) if rv == None: aetools.packevent(_reply, {}) else: aetools.packevent(_reply, {'----':rv}) | 7ec7c8ad66986c1daabaf0d4636bce55d3c78ce8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7ec7c8ad66986c1daabaf0d4636bce55d3c78ce8/MiniAEFrame.py |
||
self.build_scripts = os.path.join(self.build_base, 'scripts') | self.build_scripts = os.path.join(self.build_base, 'scripts-' + sys.version[0:3]) | def finalize_options (self): | 49bdaede1b688a7efa17257895f3556496a02277 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/49bdaede1b688a7efa17257895f3556496a02277/build.py |
timeaware = timetz(now.hour, now.minute, now.second, now.microsecond, tzinfo=tz55) | timeaware = now.timetz().replace(tzinfo=tz55) | def test_tz_aware_arithmetic(self): import random | 4c0db788e2500ca2140633d24b0c1c6c6d277a92 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4c0db788e2500ca2140633d24b0c1c6c6d277a92/test_datetime.py |
nowawareplus = self.theclass.combine(nowawareplus.date(), timetz(nowawareplus.hour, nowawareplus.minute, nowawareplus.second, nowawareplus.microsecond, tzinfo=tzr)) | nowawareplus = nowawareplus.replace(tzinfo=tzr) | def test_tz_aware_arithmetic(self): import random | 4c0db788e2500ca2140633d24b0c1c6c6d277a92 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4c0db788e2500ca2140633d24b0c1c6c6d277a92/test_datetime.py |
k = match.end(0) | self.__starttag_text = rawdata[start_pos:match.end(1) + 1] | def parse_starttag(self, i): rawdata = self.rawdata if shorttagopen.match(rawdata, i): # SGML shorthand: <tag/data/ == <tag>data</tag> # XXX Can data contain &... (entity or char refs)? # XXX Can data contain < or > (tag characters)? # XXX Can there be whitespace before the first /? match = shorttag.match(rawdata, i) if not match: return -1 tag, data = match.group(1, 2) tag = string.lower(tag) self.finish_shorttag(tag, data) k = match.end(0) return k # XXX The following should skip matching quotes (' or ") match = endbracket.search(rawdata, i+1) if not match: return -1 j = match.start(0) # Now parse the data between i+1 and j into a tag and attrs attrs = [] if rawdata[i:i+2] == '<>': # SGML shorthand: <> == <last open tag seen> k = j tag = self.lasttag else: match = tagfind.match(rawdata, i+1) if not match: raise RuntimeError, 'unexpected call to parse_starttag' k = match.end(0) tag = string.lower(rawdata[i+1:k]) self.lasttag = tag while k < j: match = attrfind.match(rawdata, k) if not match: break attrname, rest, attrvalue = match.group(1, 2, 3) if not rest: attrvalue = attrname elif attrvalue[:1] == '\'' == attrvalue[-1:] or \ attrvalue[:1] == '"' == attrvalue[-1:]: attrvalue = attrvalue[1:-1] attrs.append((string.lower(attrname), attrvalue)) k = match.end(0) if rawdata[j] == '>': j = j+1 self.finish_starttag(tag, attrs) return j | b46696c0ed640992b4524aab888a26a56d993142 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b46696c0ed640992b4524aab888a26a56d993142/sgmllib.py |
if os.path.isabs(curkeyvalue): | if string.lower(curkeyvalue[:10]) == '{compiler}': curkeyvalue = curkeyvalue[10:] self.dict['pathtype'] = 'CodeWarrior' elif string.lower(curkeyvalue[:9]) == '{project}': curkeyvalue = curkeyvalue[9:] self.dict['pathtype'] = 'Project' elif curkeyvalue[0] == '{': raise Error, "Unknown {} escape in %s"%curkeyvalue elif os.path.isabs(curkeyvalue): | def _generate_one_template(self, tmpl): resultname, datasource, dataname, key = tmpl result = '' if key: # This is a multi-element rule. Run for every item in dict[key] if self.dict.has_key(key): keyvalues = self.dict[key] try: if not type(keyvalues) in (type(()), type([])): raise Error, "List or tuple expected for %s"%key for curkeyvalue in keyvalues: if os.path.isabs(curkeyvalue): self.dict['pathtype'] = 'Absolute' else: self.dict['pathtype'] = 'Project' if curkeyvalue[-2:] == ':*': curkeyvalue = curkeyvalue[:-2] self.dict['recursive'] = 'true' else: self.dict['recursive'] = 'false' self.dict[key] = curkeyvalue curkeyvalueresult = self._generate_one_value(datasource, dataname) result = result + curkeyvalueresult finally: # Restore the list self.dict[key] = keyvalues self.dict['pathtype'] = None del self.dict['pathtype'] self.dict['recursive'] = None del self.dict['recursive'] else: # Not a multi-element rule. Simply generate result = self._generate_one_value(datasource, dataname) # And store the result self.dict[resultname] = result | 4a4adf4293f298b5fe47d33d174085070a5a8b2f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4a4adf4293f298b5fe47d33d174085070a5a8b2f/cwxmlgen.py |
raise DistutilsClasserror, \ | raise DistutilsClassError, \ | def parse_command_line (self, args): """Parse the setup script's command line: set any Distribution attributes tied to command-line options, create all command objects, and set their options from the command-line. 'args' must be a list of command-line arguments, most likely 'sys.argv[1:]' (see the 'setup()' function). This list is first processed for "global options" -- options that set attributes of the Distribution instance. Then, it is alternately scanned for Distutils command and options for that command. Each new command terminates the options for the previous command. The allowed options for a command are determined by the 'options' attribute of the command object -- thus, we instantiate (and cache) every command object here, in order to access its 'options' attribute. Any error in that 'options' attribute raises DistutilsGetoptError; any error on the command-line raises DistutilsArgError. If no Distutils commands were found on the command line, raises DistutilsArgError. Return true if command-line successfully parsed and we should carry on with executing commands; false if no errors but we shouldn't execute commands (currently, this only happens if user asks for help).""" | 1bea7ab7bd821b2ae4e4f90f0e0c08de942d41a0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1bea7ab7bd821b2ae4e4f90f0e0c08de942d41a0/core.py |
args = getnewargs() | args = getnewargs() | def save_newobj(self, obj): # Save a new-style class instance, using protocol 2. # XXX This is still experimental. assert self.proto >= 2 # This only works for protocol 2 t = type(obj) getnewargs = getattr(obj, "__getnewargs__", None) if getnewargs: args = getnewargs() # This bette not reference obj else: args = () | d17406830cef6ee1f34e42013ae60e69dc91d71f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d17406830cef6ee1f34e42013ae60e69dc91d71f/pickle.py |
TESTFN = '@test' | import os if os.name !='riscos': TESTFN = '@test' else: TESTFN = 'test' del os | def fcmp(x, y): # fuzzy comparison function if type(x) == type(0.0) or type(y) == type(0.0): try: x, y = coerce(x, y) fuzz = (abs(x) + abs(y)) * FUZZ if abs(x-y) <= fuzz: return 0 except: pass elif type(x) == type(y) and type(x) in (type(()), type([])): for i in range(min(len(x), len(y))): outcome = fcmp(x[i], y[i]) if outcome != 0: return outcome return cmp(len(x), len(y)) return cmp(x, y) | a8f7e5976126c4d0a3acef512e75a87b560ac2ec /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a8f7e5976126c4d0a3acef512e75a87b560ac2ec/test_support.py |
import tempfile try: execv(tempfile.mktemp(), ('blah',)) except error, _notfound: pass | if sys.platform[:4] == 'beos': try: unlink('/_ except error, _notfound: pass else: import tempfile t = tempfile.mktemp() try: execv(t, ('blah',)) except error, _notfound: pass | def _execvpe(file, args, env=None): if env is not None: func = execve argrest = (args, env) else: func = execv argrest = (args,) env = environ global _notfound head, tail = path.split(file) if head: apply(func, (file,) + argrest) return if env.has_key('PATH'): envpath = env['PATH'] else: envpath = defpath PATH = envpath.split(pathsep) if not _notfound: import tempfile # Exec a file that is guaranteed not to exist try: execv(tempfile.mktemp(), ('blah',)) except error, _notfound: pass exc, arg = error, _notfound for dir in PATH: fullname = path.join(dir, file) try: apply(func, (fullname,) + argrest) except error, (errno, msg): if errno != arg[0]: exc, arg = error, (errno, msg) raise exc, arg | b7fe432a8863d876670f6753abb9f92f20bea399 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b7fe432a8863d876670f6753abb9f92f20bea399/os.py |
self.spawn (["zip", "-r", base_dir, base_dir]) | self.spawn (["zip", "-r", base_dir + ".zip", base_dir]) | def make_zipfile (self, base_dir): | 6bad86462b7b433d7fe51e4fde5e65e9a61fd375 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6bad86462b7b433d7fe51e4fde5e65e9a61fd375/dist.py |
Read header lines up to the entirely blank line that terminates them. The (normally blank) line that ends the headers is skipped, but not included in the returned list. If a non-header line ends the headers, (which is an error), an attempt is made to backspace over it; it is never included in the returned list. The variable self.status is set to the empty string if all went well, otherwise it is an error message. The variable self.headers is a completely uninterpreted list of lines contained in the header (so printing them will reproduce the header exactly as it appears in the file). | Read header lines up to the entirely blank line that terminates them. The (normally blank) line that ends the headers is skipped, but not included in the returned list. If a non-header line ends the headers, (which is an error), an attempt is made to backspace over it; it is never included in the returned list. The variable self.status is set to the empty string if all went well, otherwise it is an error message. The variable self.headers is a completely uninterpreted list of lines contained in the header (so printing them will reproduce the header exactly as it appears in the file). | def readheaders(self): """Read header lines. | 9ec58aaef2d0124bd42e30e6029fe8a7bdb906e7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9ec58aaef2d0124bd42e30e6029fe8a7bdb906e7/rfc822.py |
You may override this method in order to use Message parsing on tagged data in RFC822-like formats with special header formats. | You may override this method in order to use Message parsing on tagged data in RFC 2822-like formats with special header formats. | def isheader(self, line): """Determine whether a given line is a legal header. | 9ec58aaef2d0124bd42e30e6029fe8a7bdb906e7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9ec58aaef2d0124bd42e30e6029fe8a7bdb906e7/rfc822.py |
"""Determine whether a line is a legal end of RFC-822 headers. You may override this method if your application wants to bend the rules, e.g. to strip trailing whitespace, or to recognize MH template separators ('--------'). For convenience (e.g. for code reading from sockets) a line consisting of \r\n also matches. | """Determine whether a line is a legal end of RFC 2822 headers. You may override this method if your application wants to bend the rules, e.g. to strip trailing whitespace, or to recognize MH template separators ('--------'). For convenience (e.g. for code reading from sockets) a line consisting of \r\n also matches. | def islast(self, line): """Determine whether a line is a legal end of RFC-822 headers. | 9ec58aaef2d0124bd42e30e6029fe8a7bdb906e7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9ec58aaef2d0124bd42e30e6029fe8a7bdb906e7/rfc822.py |
You may override this method in order to use Message parsing on tagged data in RFC822-like formats that support embedded comments or free-text data. | You may override this method in order to use Message parsing on tagged data in RFC 2822-like formats that support embedded comments or free-text data. | def iscomment(self, line): """Determine whether a line should be skipped entirely. | 9ec58aaef2d0124bd42e30e6029fe8a7bdb906e7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9ec58aaef2d0124bd42e30e6029fe8a7bdb906e7/rfc822.py |
Look through the list of headers and find all lines matching a given header name (and their continuation lines). A list of the lines is returned, without interpretation. If the header does not occur, an empty list is returned. If the header occurs multiple times, all occurrences are returned. Case is not important in the header name. | Look through the list of headers and find all lines matching a given header name (and their continuation lines). A list of the lines is returned, without interpretation. If the header does not occur, an empty list is returned. If the header occurs multiple times, all occurrences are returned. Case is not important in the header name. | def getallmatchingheaders(self, name): """Find all header lines matching a given header name. | 9ec58aaef2d0124bd42e30e6029fe8a7bdb906e7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9ec58aaef2d0124bd42e30e6029fe8a7bdb906e7/rfc822.py |
This is similar to getallmatchingheaders, but it returns only the first matching header (and its continuation lines). | This is similar to getallmatchingheaders, but it returns only the first matching header (and its continuation lines). | def getfirstmatchingheader(self, name): """Get the first header line matching name. | 9ec58aaef2d0124bd42e30e6029fe8a7bdb906e7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9ec58aaef2d0124bd42e30e6029fe8a7bdb906e7/rfc822.py |
Return a string containing the literal text of the header but with the keyword stripped. All leading, trailing and embedded whitespace is kept in the string, however. Return None if the header does not occur. | Return a string containing the literal text of the header but with the keyword stripped. All leading, trailing and embedded whitespace is kept in the string, however. Return None if the header does not occur. | def getrawheader(self, name): """A higher-level interface to getfirstmatchingheader(). | 9ec58aaef2d0124bd42e30e6029fe8a7bdb906e7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9ec58aaef2d0124bd42e30e6029fe8a7bdb906e7/rfc822.py |
This is the normal interface: it returns a stripped version of the header value for a given header name, or None if it doesn't exist. This uses the dictionary version which finds the *last* such header. | This is the normal interface: it returns a stripped version of the header value for a given header name, or None if it doesn't exist. This uses the dictionary version which finds the *last* such header. | def getheader(self, name, default=None): """Get the header value for a name. | 9ec58aaef2d0124bd42e30e6029fe8a7bdb906e7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9ec58aaef2d0124bd42e30e6029fe8a7bdb906e7/rfc822.py |
This returns a list of values for headers given more than once; each value in the result list is stripped in the same way as the result of getheader(). If the header is not given, return an empty list. | This returns a list of values for headers given more than once; each value in the result list is stripped in the same way as the result of getheader(). If the header is not given, return an empty list. | def getheaders(self, name): """Get all values for a header. | 9ec58aaef2d0124bd42e30e6029fe8a7bdb906e7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9ec58aaef2d0124bd42e30e6029fe8a7bdb906e7/rfc822.py |
def getaddrlist(self, name): """Get a list of addresses from a header. | 9ec58aaef2d0124bd42e30e6029fe8a7bdb906e7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9ec58aaef2d0124bd42e30e6029fe8a7bdb906e7/rfc822.py |
||
Retrieves a date field from the named header, returning a tuple compatible with time.mktime(). | Retrieves a date field from the named header, returning a tuple compatible with time.mktime(). | def getdate(self, name): """Retrieve a date field from a header. | 9ec58aaef2d0124bd42e30e6029fe8a7bdb906e7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9ec58aaef2d0124bd42e30e6029fe8a7bdb906e7/rfc822.py |
The first 9 elements make up a tuple compatible with time.mktime(), and the 10th is the offset of the poster's time zone from GMT/UTC. | The first 9 elements make up a tuple compatible with time.mktime(), and the 10th is the offset of the poster's time zone from GMT/UTC. | def getdate_tz(self, name): """Retrieve a date field from a header as a 10-tuple. | 9ec58aaef2d0124bd42e30e6029fe8a7bdb906e7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9ec58aaef2d0124bd42e30e6029fe8a7bdb906e7/rfc822.py |
Note: This is not a perfect inversion of __getitem__, because any changed headers get stuck at the end of the raw-headers list rather than where the altered header was. | Note: This is not a perfect inversion of __getitem__, because any changed headers get stuck at the end of the raw-headers list rather than where the altered header was. | def __setitem__(self, name, value): """Set the value of a header. | 9ec58aaef2d0124bd42e30e6029fe8a7bdb906e7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9ec58aaef2d0124bd42e30e6029fe8a7bdb906e7/rfc822.py |
RFC-822 in front of you. | RFC 2822 in front of you. http://www.faqs.org/rfcs/rfc2822.html | def parseaddr(address): """Parse an address into a (realname, mailaddr) tuple.""" a = AddrlistClass(address) list = a.getaddrlist() if not list: return (None, None) else: return list[0] | 9ec58aaef2d0124bd42e30e6029fe8a7bdb906e7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9ec58aaef2d0124bd42e30e6029fe8a7bdb906e7/rfc822.py |
`field' is an unparsed address header field, containing one or more addresses. | `field' is an unparsed address header field, containing one or more addresses. | def __init__(self, field): """Initialize a new instance. | 9ec58aaef2d0124bd42e30e6029fe8a7bdb906e7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9ec58aaef2d0124bd42e30e6029fe8a7bdb906e7/rfc822.py |
"""Parse an RFC-822 addr-spec.""" | """Parse an RFC 2822 addr-spec.""" | def getaddrspec(self): """Parse an RFC-822 addr-spec.""" aslist = [] | 9ec58aaef2d0124bd42e30e6029fe8a7bdb906e7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9ec58aaef2d0124bd42e30e6029fe8a7bdb906e7/rfc822.py |
`beginchar' is the start character for the fragment. If self is not looking at an instance of `beginchar' then getdelimited returns the empty string. | `beginchar' is the start character for the fragment. If self is not looking at an instance of `beginchar' then getdelimited returns the empty string. | def getdelimited(self, beginchar, endchars, allowcomments = 1): """Parse a header fragment delimited by special characters. | 9ec58aaef2d0124bd42e30e6029fe8a7bdb906e7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9ec58aaef2d0124bd42e30e6029fe8a7bdb906e7/rfc822.py |
If `allowcomments' is non-zero, embedded RFC-822 comments are allowed within the parsed fragment. | If `allowcomments' is non-zero, embedded RFC 2822 comments are allowed within the parsed fragment. | def getdelimited(self, beginchar, endchars, allowcomments = 1): """Parse a header fragment delimited by special characters. | 9ec58aaef2d0124bd42e30e6029fe8a7bdb906e7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9ec58aaef2d0124bd42e30e6029fe8a7bdb906e7/rfc822.py |
"""Parse an RFC-822 domain-literal.""" | """Parse an RFC 2822 domain-literal.""" | def getdomainliteral(self): """Parse an RFC-822 domain-literal.""" return '[%s]' % self.getdelimited('[', ']\r', 0) | 9ec58aaef2d0124bd42e30e6029fe8a7bdb906e7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9ec58aaef2d0124bd42e30e6029fe8a7bdb906e7/rfc822.py |
def getatom(self): """Parse an RFC-822 atom.""" | def getatom(self, atomends=None): """Parse an RFC 2822 atom. Optional atomends specifies a different set of end token delimiters (the default is to use self.atomends). This is used e.g. in getphraselist() since phrase endings must not include the `.' (which is legal in phrases).""" | def getatom(self): """Parse an RFC-822 atom.""" atomlist = [''] | 9ec58aaef2d0124bd42e30e6029fe8a7bdb906e7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9ec58aaef2d0124bd42e30e6029fe8a7bdb906e7/rfc822.py |
if self.field[self.pos] in self.atomends: | if self.field[self.pos] in atomends: | def getatom(self): """Parse an RFC-822 atom.""" atomlist = [''] | 9ec58aaef2d0124bd42e30e6029fe8a7bdb906e7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9ec58aaef2d0124bd42e30e6029fe8a7bdb906e7/rfc822.py |
"""Parse a sequence of RFC-822 phrases. A phrase is a sequence of words, which are in turn either RFC-822 atoms or quoted-strings. Phrases are canonicalized by squeezing all runs of continuous whitespace into one space. | """Parse a sequence of RFC 2822 phrases. A phrase is a sequence of words, which are in turn either RFC 2822 atoms or quoted-strings. Phrases are canonicalized by squeezing all runs of continuous whitespace into one space. | def getphraselist(self): """Parse a sequence of RFC-822 phrases. | 9ec58aaef2d0124bd42e30e6029fe8a7bdb906e7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9ec58aaef2d0124bd42e30e6029fe8a7bdb906e7/rfc822.py |
elif self.field[self.pos] in self.atomends: | elif self.field[self.pos] in self.phraseends: | def getphraselist(self): """Parse a sequence of RFC-822 phrases. | 9ec58aaef2d0124bd42e30e6029fe8a7bdb906e7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9ec58aaef2d0124bd42e30e6029fe8a7bdb906e7/rfc822.py |
else: plist.append(self.getatom()) | else: plist.append(self.getatom(self.phraseends)) | def getphraselist(self): """Parse a sequence of RFC-822 phrases. | 9ec58aaef2d0124bd42e30e6029fe8a7bdb906e7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9ec58aaef2d0124bd42e30e6029fe8a7bdb906e7/rfc822.py |
"""An AddressList encapsulates a list of parsed RFC822 addresses.""" | """An AddressList encapsulates a list of parsed RFC 2822 addresses.""" | def getphraselist(self): """Parse a sequence of RFC-822 phrases. | 9ec58aaef2d0124bd42e30e6029fe8a7bdb906e7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9ec58aaef2d0124bd42e30e6029fe8a7bdb906e7/rfc822.py |
gui = GUI(Tkinter.Tk()) Tkinter.mainloop() | root = Tkinter.Tk() try: gui = GUI(root) root.mainloop() finally: root.destroy() | def hide(self, event=None): self.stop() self.collapse() | e09bd93685d59fc115d2cfdbe29d6857161c7e2a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e09bd93685d59fc115d2cfdbe29d6857161c7e2a/pydoc.py |
labelEmail.grid(row=6,column=0,columnspan=2,sticky=W,padx=10,pady=0) | labelEmail.grid(row=6, column=0, columnspan=2, sticky=W, padx=10, pady=0) | def CreateWidgets(self): frameMain = Frame(self, borderwidth=2, relief=SUNKEN) frameButtons = Frame(self) frameButtons.pack(side=BOTTOM, fill=X) frameMain.pack(side=TOP, expand=TRUE, fill=BOTH) self.buttonOk = Button(frameButtons, text='Close', command=self.Ok) self.buttonOk.pack(padx=5, pady=5) #self.picture = Image('photo', data=self.pictureData) frameBg = Frame(frameMain, bg=self.bg) frameBg.pack(expand=TRUE, fill=BOTH) labelTitle = Label(frameBg, text='IDLE', fg=self.fg, bg=self.bg, font=('courier', 24, 'bold')) labelTitle.grid(row=0, column=0, sticky=W, padx=10, pady=10) #labelPicture = Label(frameBg, text='[picture]') #image=self.picture, bg=self.bg) #labelPicture.grid(row=1, column=1, sticky=W, rowspan=2, # padx=0, pady=3) byline = "Python's Integrated DeveLopment Environment" + 5*'\n' labelDesc = Label(frameBg, text=byline, justify=LEFT, fg=self.fg, bg=self.bg) labelDesc.grid(row=2, column=0, sticky=W, columnspan=3, padx=10, pady=5) labelEmail = Label(frameBg, text='email: [email protected]', justify=LEFT, fg=self.fg, bg=self.bg) labelEmail.grid(row=6,column=0,columnspan=2,sticky=W,padx=10,pady=0) labelWWW = Label(frameBg, text='www: http://www.python.org/idle/', justify=LEFT, fg=self.fg, bg=self.bg) labelWWW.grid(row=7, column=0, columnspan=2, sticky=W, padx=10, pady=0) Frame(frameBg, borderwidth=1, relief=SUNKEN, height=2, bg=self.bg).grid(row=8, column=0, sticky=EW, columnspan=3, padx=5, pady=5) labelPythonVer = Label(frameBg, text='Python version: ' + \ sys.version.split()[0], fg=self.fg, bg=self.bg) labelPythonVer.grid(row=9, column=0, sticky=W, padx=10, pady=0) # handle weird tk version num in windoze python >= 1.6 (?!?) tkVer = `TkVersion`.split('.') tkVer[len(tkVer)-1] = str('%.3g' % (float('.'+tkVer[len(tkVer)-1])))[2:] if tkVer[len(tkVer)-1] == '': tkVer[len(tkVer)-1] = '0' tkVer = string.join(tkVer,'.') labelTkVer = Label(frameBg, text='Tk version: '+ tkVer, fg=self.fg, bg=self.bg) labelTkVer.grid(row=9, column=1, sticky=W, padx=2, pady=0) py_button_f = Frame(frameBg, bg=self.bg) py_button_f.grid(row=10, column=0, columnspan=2, sticky=NSEW) buttonLicense = Button(py_button_f, text='License', width=8, highlightbackground=self.bg, command=self.ShowLicense) buttonLicense.pack(side=LEFT, padx=10, pady=10) buttonCopyright = Button(py_button_f, text='Copyright', width=8, highlightbackground=self.bg, command=self.ShowCopyright) buttonCopyright.pack(side=LEFT, padx=10, pady=10) buttonCredits = Button(py_button_f, text='Credits', width=8, highlightbackground=self.bg, command=self.ShowPythonCredits) buttonCredits.pack(side=LEFT, padx=10, pady=10) Frame(frameBg, borderwidth=1, relief=SUNKEN, height=2, bg=self.bg).grid(row=11, column=0, sticky=EW, columnspan=3, padx=5, pady=5) idle_v = Label(frameBg, text='IDLE version ' + idlever.IDLE_VERSION, fg=self.fg, bg=self.bg) idle_v.grid(row=12, column=0, sticky=W, padx=10, pady=0) idle_button_f = Frame(frameBg, bg=self.bg) idle_button_f.grid(row=13, column=0, columnspan=3, sticky=NSEW) idle_about_b = Button(idle_button_f, text='README', width=8, highlightbackground=self.bg, command=self.ShowIDLEAbout) idle_about_b.pack(side=LEFT, padx=10, pady=10) idle_news_b = Button(idle_button_f, text='NEWS', width=8, highlightbackground=self.bg, command=self.ShowIDLENEWS) idle_news_b.pack(side=LEFT, padx=10, pady=10) idle_credits_b = Button(idle_button_f, text='Credits', width=8, highlightbackground=self.bg, command=self.ShowIDLECredits) idle_credits_b.pack(side=LEFT, padx=10, pady=10) | 73453757718f13af156356dabdd0dea7ccc396ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/73453757718f13af156356dabdd0dea7ccc396ba/aboutDialog.py |
idle_v = Label(frameBg, text='IDLE version ' + idlever.IDLE_VERSION, | idle_v = Label(frameBg, text='IDLE version: ' + idlever.IDLE_VERSION, | def CreateWidgets(self): frameMain = Frame(self, borderwidth=2, relief=SUNKEN) frameButtons = Frame(self) frameButtons.pack(side=BOTTOM, fill=X) frameMain.pack(side=TOP, expand=TRUE, fill=BOTH) self.buttonOk = Button(frameButtons, text='Close', command=self.Ok) self.buttonOk.pack(padx=5, pady=5) #self.picture = Image('photo', data=self.pictureData) frameBg = Frame(frameMain, bg=self.bg) frameBg.pack(expand=TRUE, fill=BOTH) labelTitle = Label(frameBg, text='IDLE', fg=self.fg, bg=self.bg, font=('courier', 24, 'bold')) labelTitle.grid(row=0, column=0, sticky=W, padx=10, pady=10) #labelPicture = Label(frameBg, text='[picture]') #image=self.picture, bg=self.bg) #labelPicture.grid(row=1, column=1, sticky=W, rowspan=2, # padx=0, pady=3) byline = "Python's Integrated DeveLopment Environment" + 5*'\n' labelDesc = Label(frameBg, text=byline, justify=LEFT, fg=self.fg, bg=self.bg) labelDesc.grid(row=2, column=0, sticky=W, columnspan=3, padx=10, pady=5) labelEmail = Label(frameBg, text='email: [email protected]', justify=LEFT, fg=self.fg, bg=self.bg) labelEmail.grid(row=6,column=0,columnspan=2,sticky=W,padx=10,pady=0) labelWWW = Label(frameBg, text='www: http://www.python.org/idle/', justify=LEFT, fg=self.fg, bg=self.bg) labelWWW.grid(row=7, column=0, columnspan=2, sticky=W, padx=10, pady=0) Frame(frameBg, borderwidth=1, relief=SUNKEN, height=2, bg=self.bg).grid(row=8, column=0, sticky=EW, columnspan=3, padx=5, pady=5) labelPythonVer = Label(frameBg, text='Python version: ' + \ sys.version.split()[0], fg=self.fg, bg=self.bg) labelPythonVer.grid(row=9, column=0, sticky=W, padx=10, pady=0) # handle weird tk version num in windoze python >= 1.6 (?!?) tkVer = `TkVersion`.split('.') tkVer[len(tkVer)-1] = str('%.3g' % (float('.'+tkVer[len(tkVer)-1])))[2:] if tkVer[len(tkVer)-1] == '': tkVer[len(tkVer)-1] = '0' tkVer = string.join(tkVer,'.') labelTkVer = Label(frameBg, text='Tk version: '+ tkVer, fg=self.fg, bg=self.bg) labelTkVer.grid(row=9, column=1, sticky=W, padx=2, pady=0) py_button_f = Frame(frameBg, bg=self.bg) py_button_f.grid(row=10, column=0, columnspan=2, sticky=NSEW) buttonLicense = Button(py_button_f, text='License', width=8, highlightbackground=self.bg, command=self.ShowLicense) buttonLicense.pack(side=LEFT, padx=10, pady=10) buttonCopyright = Button(py_button_f, text='Copyright', width=8, highlightbackground=self.bg, command=self.ShowCopyright) buttonCopyright.pack(side=LEFT, padx=10, pady=10) buttonCredits = Button(py_button_f, text='Credits', width=8, highlightbackground=self.bg, command=self.ShowPythonCredits) buttonCredits.pack(side=LEFT, padx=10, pady=10) Frame(frameBg, borderwidth=1, relief=SUNKEN, height=2, bg=self.bg).grid(row=11, column=0, sticky=EW, columnspan=3, padx=5, pady=5) idle_v = Label(frameBg, text='IDLE version ' + idlever.IDLE_VERSION, fg=self.fg, bg=self.bg) idle_v.grid(row=12, column=0, sticky=W, padx=10, pady=0) idle_button_f = Frame(frameBg, bg=self.bg) idle_button_f.grid(row=13, column=0, columnspan=3, sticky=NSEW) idle_about_b = Button(idle_button_f, text='README', width=8, highlightbackground=self.bg, command=self.ShowIDLEAbout) idle_about_b.pack(side=LEFT, padx=10, pady=10) idle_news_b = Button(idle_button_f, text='NEWS', width=8, highlightbackground=self.bg, command=self.ShowIDLENEWS) idle_news_b.pack(side=LEFT, padx=10, pady=10) idle_credits_b = Button(idle_button_f, text='Credits', width=8, highlightbackground=self.bg, command=self.ShowIDLECredits) idle_credits_b.pack(side=LEFT, padx=10, pady=10) | 73453757718f13af156356dabdd0dea7ccc396ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/73453757718f13af156356dabdd0dea7ccc396ba/aboutDialog.py |
fn=os.path.join(os.path.abspath(os.path.dirname(__file__)),viewFile) | fn = os.path.join(os.path.abspath(os.path.dirname(__file__)), viewFile) | def ViewFile(self, viewTitle, viewFile, encoding=None): fn=os.path.join(os.path.abspath(os.path.dirname(__file__)),viewFile) if encoding: import codecs try: textFile = codecs.open(fn, 'r') except IOError: tkMessageBox.showerror(title='File Load Error', message='Unable to load file '+ `fileName`+' .') return else: data = textFile.read() else: data = None textView.TextViewer(self, viewTitle, fn, data=data) | 73453757718f13af156356dabdd0dea7ccc396ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/73453757718f13af156356dabdd0dea7ccc396ba/aboutDialog.py |
aboutDialog.AboutDialog(root,'About') | aboutDialog.AboutDialog(root, 'About') | def run(): import aboutDialog aboutDialog.AboutDialog(root,'About') | 73453757718f13af156356dabdd0dea7ccc396ba /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/73453757718f13af156356dabdd0dea7ccc396ba/aboutDialog.py |
for m in Pack.__dict__.keys(): | methods = Pack.__dict__.keys() methods = methods + Grid.__dict__.keys() methods = methods + Place.__dict__.keys() for m in methods: | def __init__(self, master=None, cnf=None, **kw): if cnf is None: cnf = {} if kw: cnf = _cnfmerge((cnf, kw)) fcnf = {} for k in cnf.keys(): if type(k) == ClassType or k == 'name': fcnf[k] = cnf[k] del cnf[k] self.frame = apply(Frame, (master,), fcnf) self.vbar = Scrollbar(self.frame, name='vbar') self.vbar.pack(side=RIGHT, fill=Y) cnf['name'] = 'text' apply(Text.__init__, (self, self.frame), cnf) self.pack(side=LEFT, fill=BOTH, expand=1) self['yscrollcommand'] = self.vbar.set self.vbar['command'] = self.yview | 61d3637ff8616d3e231a20f8f0da3237e27ca40c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/61d3637ff8616d3e231a20f8f0da3237e27ca40c/ScrolledText.py |
import AppleScript_Suite import AppleScript_Suite | def select(self, _object, _attributes={}, **_arguments): """select: Select the specified object(s) Required argument: the object to select Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'misc' _subcode = 'slct' | ead4c80ac2380eb0380e66e9d59ad2c359ef38f2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ead4c80ac2380eb0380e66e9d59ad2c359ef38f2/Standard_Suite.py |
|
import macfs | import macfs | def islink(s): """Return true if the pathname refers to a symbolic link.""" try: import macfs return macfs.ResolveAliasFile(s)[2] except: return False | ae7639dbfb743f613fe92da1ed72216a49cccf1a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ae7639dbfb743f613fe92da1ed72216a49cccf1a/macpath.py |
if os.path.isdir(dir) and dir not in dirlist: | if dir is not None and os.path.isdir(dir) and dir not in dirlist: | def add_dir_to_list(dirlist, dir): """Add the directory 'dir' to the list 'dirlist' (at the front) if 1) 'dir' is not already in 'dirlist' 2) 'dir' actually exists, and is a directory.""" if os.path.isdir(dir) and dir not in dirlist: dirlist.insert(0, dir) | 4439b7c67e057db24067e723f1f553258dfa9d94 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4439b7c67e057db24067e723f1f553258dfa9d94/setup.py |
if platform == 'darwin': | if platform in ('darwin', 'mac'): | def build_extensions(self): | 4439b7c67e057db24067e723f1f553258dfa9d94 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4439b7c67e057db24067e723f1f553258dfa9d94/setup.py |
input = text_file.TextFile('Modules/Setup', join_lines=1) remove_modules = [] while 1: line = input.readline() if not line: break line = line.split() remove_modules.append( line[0] ) input.close() for ext in self.extensions[:]: if ext.name in remove_modules: self.extensions.remove(ext) | if platform != 'mac': input = text_file.TextFile('Modules/Setup', join_lines=1) remove_modules = [] while 1: line = input.readline() if not line: break line = line.split() remove_modules.append( line[0] ) input.close() for ext in self.extensions[:]: if ext.name in remove_modules: self.extensions.remove(ext) | def build_extensions(self): | 4439b7c67e057db24067e723f1f553258dfa9d94 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4439b7c67e057db24067e723f1f553258dfa9d94/setup.py |
if platform in ['darwin', 'beos']: | if platform in ['darwin', 'beos', 'mac']: | 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') | 4439b7c67e057db24067e723f1f553258dfa9d94 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4439b7c67e057db24067e723f1f553258dfa9d94/setup.py |
if pathname[0] == '/': | if pathname and pathname[0] == '/': | def convert_path (pathname): """Return 'pathname' as a name that will work on the native filesystem, i.e. split it on '/' and put it back together again using the current directory separator. Needed because filenames in the setup script are always supplied in Unix style, and have to be converted to the local convention before we can actually use them in the filesystem. Raises ValueError on non-Unix-ish systems if 'pathname' either starts or ends with a slash. """ if os.sep == '/': return pathname if pathname[0] == '/': raise ValueError, "path '%s' cannot be absolute" % pathname if pathname[-1] == '/': raise ValueError, "path '%s' cannot end with '/'" % pathname paths = string.split(pathname, '/') while '.' in paths: paths.remove('.') if not paths: return os.curdir return apply(os.path.join, paths) | 0b5c11252da09a244cb39de47909ed07f4fa82cf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0b5c11252da09a244cb39de47909ed07f4fa82cf/util.py |
if pathname[-1] == '/': | if pathname and pathname[-1] == '/': | def convert_path (pathname): """Return 'pathname' as a name that will work on the native filesystem, i.e. split it on '/' and put it back together again using the current directory separator. Needed because filenames in the setup script are always supplied in Unix style, and have to be converted to the local convention before we can actually use them in the filesystem. Raises ValueError on non-Unix-ish systems if 'pathname' either starts or ends with a slash. """ if os.sep == '/': return pathname if pathname[0] == '/': raise ValueError, "path '%s' cannot be absolute" % pathname if pathname[-1] == '/': raise ValueError, "path '%s' cannot end with '/'" % pathname paths = string.split(pathname, '/') while '.' in paths: paths.remove('.') if not paths: return os.curdir return apply(os.path.join, paths) | 0b5c11252da09a244cb39de47909ed07f4fa82cf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0b5c11252da09a244cb39de47909ed07f4fa82cf/util.py |
'raw_unicode_escape', 'unicode_escape', 'unicode_internal'): | 'unicode_escape', 'unicode_internal'): | def __str__(self): return self.x | 80d1dd5f3b83c96c5c8e4a51417f1c748318de94 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/80d1dd5f3b83c96c5c8e4a51417f1c748318de94/test_unicode.py |
def deepcopyrecursive(): if verbose: print "Testing deepcopy of recursive objects..." class Node: pass a = Node() b = Node() a.b = b b.a = a z = deepcopy(a) | def strops(): try: 'a' + 5 except TypeError: pass else: raise TestFailed, "'' + 5 doesn't raise TypeError" try: ''.split('') except ValueError: pass else: raise TestFailed, "''.split('') doesn't raise ValueError" try: ''.join([0]) except TypeError: pass else: raise TestFailed, "''.join([0]) doesn't raise TypeError" try: ''.rindex('5') except ValueError: pass else: raise TestFailed, "''.rindex('5') doesn't raise ValueError" try: ''.replace('', '') except ValueError: pass else: raise TestFailed, "''.replace('', '') doesn't raise ValueError" try: '%(n)s' % None except TypeError: pass else: raise TestFailed, "'%(n)s' % None doesn't raise TypeError" try: '%(n' % {} except ValueError: pass else: raise TestFailed, "'%(n' % {} '' doesn't raise ValueError" try: '%*s' % ('abc') except TypeError: pass else: raise TestFailed, "'%*s' % ('abc') doesn't raise TypeError" try: '%*.*s' % ('abc', 5) except TypeError: pass else: raise TestFailed, "'%*.*s' % ('abc', 5) doesn't raise TypeError" try: '%s' % (1, 2) except TypeError: pass else: raise TestFailed, "'%s' % (1, 2) doesn't raise TypeError" try: '%' % None except ValueError: pass else: raise TestFailed, "'%' % None doesn't raise ValueError" vereq('534253'.isdigit(), 1) vereq('534253x'.isdigit(), 0) vereq('%c' % 5, '\x05') vereq('%c' % '5', '5') | 2764a3a50ebb467690d77f8925a3414d71756311 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/2764a3a50ebb467690d77f8925a3414d71756311/test_descr.py |
|
else: | elif (i + 1) < n: | def goahead(self, end): rawdata = self.rawdata i = 0 n = len(rawdata) while i < n: match = self.interesting.search(rawdata, i) # < or & if match: j = match.start() else: j = n if i < j: self.handle_data(rawdata[i:j]) i = self.updatepos(i, j) if i == n: break if rawdata[i] == '<': if starttagopen.match(rawdata, i): # < + letter k = self.parse_starttag(i) elif endtagopen.match(rawdata, i): # </ k = self.parse_endtag(i) if k >= 0: self.clear_cdata_mode() elif commentopen.match(rawdata, i): # <!-- k = self.parse_comment(i) elif piopen.match(rawdata, i): # <? k = self.parse_pi(i) elif declopen.match(rawdata, i): # <! k = self.parse_declaration(i) else: self.handle_data("<") k = i + 1 if k < 0: if end: raise HTMLParseError("EOF in middle of construct", self.getpos()) break i = self.updatepos(i, k) elif rawdata[i] == '&': match = charref.match(rawdata, i) if match: name = match.group()[2:-1] self.handle_charref(name) k = match.end() if rawdata[k-1] != ';': k = k - 1 i = self.updatepos(i, k) continue match = entityref.match(rawdata, i) if match: name = match.group(1) self.handle_entityref(name) k = match.end() if rawdata[k-1] != ';': k = k - 1 i = self.updatepos(i, k) continue match = incomplete.match(rawdata, i) if match: rest = rawdata[i:] if end and rest != "&" and match.group() == rest: raise HTMLParseError( "EOF in middle of entity or char ref", self.getpos()) return -1 # incomplete self.handle_data("&") i = self.updatepos(i, i + 1) else: assert 0, "interesting.search() lied" # end while if end and i < n: self.handle_data(rawdata[i:n]) i = self.updatepos(i, n) self.rawdata = rawdata[i:] | 68eac2b574ed837099998d68ea592d02bd8ca129 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/68eac2b574ed837099998d68ea592d02bd8ca129/HTMLParser.py |
elif rawdata[i] == '&': | elif rawdata[i:i+2] == "& | def goahead(self, end): rawdata = self.rawdata i = 0 n = len(rawdata) while i < n: match = self.interesting.search(rawdata, i) # < or & if match: j = match.start() else: j = n if i < j: self.handle_data(rawdata[i:j]) i = self.updatepos(i, j) if i == n: break if rawdata[i] == '<': if starttagopen.match(rawdata, i): # < + letter k = self.parse_starttag(i) elif endtagopen.match(rawdata, i): # </ k = self.parse_endtag(i) if k >= 0: self.clear_cdata_mode() elif commentopen.match(rawdata, i): # <!-- k = self.parse_comment(i) elif piopen.match(rawdata, i): # <? k = self.parse_pi(i) elif declopen.match(rawdata, i): # <! k = self.parse_declaration(i) else: self.handle_data("<") k = i + 1 if k < 0: if end: raise HTMLParseError("EOF in middle of construct", self.getpos()) break i = self.updatepos(i, k) elif rawdata[i] == '&': match = charref.match(rawdata, i) if match: name = match.group()[2:-1] self.handle_charref(name) k = match.end() if rawdata[k-1] != ';': k = k - 1 i = self.updatepos(i, k) continue match = entityref.match(rawdata, i) if match: name = match.group(1) self.handle_entityref(name) k = match.end() if rawdata[k-1] != ';': k = k - 1 i = self.updatepos(i, k) continue match = incomplete.match(rawdata, i) if match: rest = rawdata[i:] if end and rest != "&" and match.group() == rest: raise HTMLParseError( "EOF in middle of entity or char ref", self.getpos()) return -1 # incomplete self.handle_data("&") i = self.updatepos(i, i + 1) else: assert 0, "interesting.search() lied" # end while if end and i < n: self.handle_data(rawdata[i:n]) i = self.updatepos(i, n) self.rawdata = rawdata[i:] | 68eac2b574ed837099998d68ea592d02bd8ca129 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/68eac2b574ed837099998d68ea592d02bd8ca129/HTMLParser.py |
if end and rest != "&" and match.group() == rest: | if end and match.group() == rest: | def goahead(self, end): rawdata = self.rawdata i = 0 n = len(rawdata) while i < n: match = self.interesting.search(rawdata, i) # < or & if match: j = match.start() else: j = n if i < j: self.handle_data(rawdata[i:j]) i = self.updatepos(i, j) if i == n: break if rawdata[i] == '<': if starttagopen.match(rawdata, i): # < + letter k = self.parse_starttag(i) elif endtagopen.match(rawdata, i): # </ k = self.parse_endtag(i) if k >= 0: self.clear_cdata_mode() elif commentopen.match(rawdata, i): # <!-- k = self.parse_comment(i) elif piopen.match(rawdata, i): # <? k = self.parse_pi(i) elif declopen.match(rawdata, i): # <! k = self.parse_declaration(i) else: self.handle_data("<") k = i + 1 if k < 0: if end: raise HTMLParseError("EOF in middle of construct", self.getpos()) break i = self.updatepos(i, k) elif rawdata[i] == '&': match = charref.match(rawdata, i) if match: name = match.group()[2:-1] self.handle_charref(name) k = match.end() if rawdata[k-1] != ';': k = k - 1 i = self.updatepos(i, k) continue match = entityref.match(rawdata, i) if match: name = match.group(1) self.handle_entityref(name) k = match.end() if rawdata[k-1] != ';': k = k - 1 i = self.updatepos(i, k) continue match = incomplete.match(rawdata, i) if match: rest = rawdata[i:] if end and rest != "&" and match.group() == rest: raise HTMLParseError( "EOF in middle of entity or char ref", self.getpos()) return -1 # incomplete self.handle_data("&") i = self.updatepos(i, i + 1) else: assert 0, "interesting.search() lied" # end while if end and i < n: self.handle_data(rawdata[i:n]) i = self.updatepos(i, n) self.rawdata = rawdata[i:] | 68eac2b574ed837099998d68ea592d02bd8ca129 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/68eac2b574ed837099998d68ea592d02bd8ca129/HTMLParser.py |
return -1 self.handle_data("&") i = self.updatepos(i, i + 1) | break elif (i + 1) < n: self.handle_data("&") i = self.updatepos(i, i + 1) else: break | def goahead(self, end): rawdata = self.rawdata i = 0 n = len(rawdata) while i < n: match = self.interesting.search(rawdata, i) # < or & if match: j = match.start() else: j = n if i < j: self.handle_data(rawdata[i:j]) i = self.updatepos(i, j) if i == n: break if rawdata[i] == '<': if starttagopen.match(rawdata, i): # < + letter k = self.parse_starttag(i) elif endtagopen.match(rawdata, i): # </ k = self.parse_endtag(i) if k >= 0: self.clear_cdata_mode() elif commentopen.match(rawdata, i): # <!-- k = self.parse_comment(i) elif piopen.match(rawdata, i): # <? k = self.parse_pi(i) elif declopen.match(rawdata, i): # <! k = self.parse_declaration(i) else: self.handle_data("<") k = i + 1 if k < 0: if end: raise HTMLParseError("EOF in middle of construct", self.getpos()) break i = self.updatepos(i, k) elif rawdata[i] == '&': match = charref.match(rawdata, i) if match: name = match.group()[2:-1] self.handle_charref(name) k = match.end() if rawdata[k-1] != ';': k = k - 1 i = self.updatepos(i, k) continue match = entityref.match(rawdata, i) if match: name = match.group(1) self.handle_entityref(name) k = match.end() if rawdata[k-1] != ';': k = k - 1 i = self.updatepos(i, k) continue match = incomplete.match(rawdata, i) if match: rest = rawdata[i:] if end and rest != "&" and match.group() == rest: raise HTMLParseError( "EOF in middle of entity or char ref", self.getpos()) return -1 # incomplete self.handle_data("&") i = self.updatepos(i, i + 1) else: assert 0, "interesting.search() lied" # end while if end and i < n: self.handle_data(rawdata[i:n]) i = self.updatepos(i, n) self.rawdata = rawdata[i:] | 68eac2b574ed837099998d68ea592d02bd8ca129 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/68eac2b574ed837099998d68ea592d02bd8ca129/HTMLParser.py |
def parse_comment(self, i): | def parse_comment(self, i, report=1): | def parse_comment(self, i): rawdata = self.rawdata assert rawdata[i:i+4] == '<!--', 'unexpected call to parse_comment()' match = commentclose.search(rawdata, i+4) if not match: return -1 j = match.start() self.handle_comment(rawdata[i+4: j]) j = match.end() return j | 68eac2b574ed837099998d68ea592d02bd8ca129 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/68eac2b574ed837099998d68ea592d02bd8ca129/HTMLParser.py |
j = match.start() self.handle_comment(rawdata[i+4: j]) | if report: j = match.start() self.handle_comment(rawdata[i+4: j]) | def parse_comment(self, i): rawdata = self.rawdata assert rawdata[i:i+4] == '<!--', 'unexpected call to parse_comment()' match = commentclose.search(rawdata, i+4) if not match: return -1 j = match.start() self.handle_comment(rawdata[i+4: j]) j = match.end() return j | 68eac2b574ed837099998d68ea592d02bd8ca129 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/68eac2b574ed837099998d68ea592d02bd8ca129/HTMLParser.py |
self.handle_decl(rawdata[i+2:j]) | data = rawdata[i+2:j] if decltype == "doctype": self.handle_decl(data) else: self.unknown_decl(data) | def parse_declaration(self, i): # This is some sort of declaration; in "HTML as # deployed," this should only be the document type # declaration ("<!DOCTYPE html...>"). rawdata = self.rawdata j = i + 2 assert rawdata[i:j] == "<!", "unexpected call to parse_declaration" if rawdata[j:j+1] in ("-", ""): # Start of comment followed by buffer boundary, # or just a buffer boundary. return -1 # in practice, this should look like: ((name|stringlit) S*)+ '>' n = len(rawdata) while j < n: c = rawdata[j] if c == ">": # end of declaration syntax self.handle_decl(rawdata[i+2:j]) return j + 1 if c in "\"'": m = declstringlit.match(rawdata, j) if not m: return -1 # incomplete j = m.end() elif c in "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ": m = declname.match(rawdata, j) if not m: return -1 # incomplete j = m.end() else: raise HTMLParseError( "unexpected char in declaration: %s" % `rawdata[j]`, self.getpos()) return -1 # incomplete | 68eac2b574ed837099998d68ea592d02bd8ca129 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/68eac2b574ed837099998d68ea592d02bd8ca129/HTMLParser.py |
def gauss(mu, sigma): # When x and y are two variables from [0, 1), uniformly # distributed, then # # cos(2*pi*x)*log(1-y) # sin(2*pi*x)*log(1-y) # # are two *independent* variables with normal distribution # (mu = 0, sigma = 1). # (Lambert Meertens) global gauss_next if gauss_next != None: z = gauss_next gauss_next = None else: x2pi = random() * TWOPI log1_y = log(1.0 - random()) z = cos(x2pi) * log1_y gauss_next = sin(x2pi) * log1_y return mu + z*sigma | 72c2e1b56e35c7fc4a80e90b14541494426e3cd0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/72c2e1b56e35c7fc4a80e90b14541494426e3cd0/random.py |
||
log1_y = log(1.0 - random()) z = cos(x2pi) * log1_y gauss_next = sin(x2pi) * log1_y | g2rad = sqrt(-2.0 * log(1.0 - random())) z = cos(x2pi) * g2rad gauss_next = sin(x2pi) * g2rad | def gauss(mu, sigma): # When x and y are two variables from [0, 1), uniformly # distributed, then # # cos(2*pi*x)*log(1-y) # sin(2*pi*x)*log(1-y) # # are two *independent* variables with normal distribution # (mu = 0, sigma = 1). # (Lambert Meertens) global gauss_next if gauss_next != None: z = gauss_next gauss_next = None else: x2pi = random() * TWOPI log1_y = log(1.0 - random()) z = cos(x2pi) * log1_y gauss_next = sin(x2pi) * log1_y return mu + z*sigma | 72c2e1b56e35c7fc4a80e90b14541494426e3cd0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/72c2e1b56e35c7fc4a80e90b14541494426e3cd0/random.py |
USE_FROZEN = hasattr(imp, "set_frozenmodules") | USE_ZIPIMPORT = "zipimport" in sys.builtin_module_names | def report(self): # XXX something decent pass | 109ecbf7a52786df6114cfb678bd19e19102e076 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/109ecbf7a52786df6114cfb678bd19e19102e076/bundlebuilder.py |
if USE_FROZEN: FROZEN_ARCHIVE = "FrozenModules.marshal" SITE_PY += """\ import imp, marshal f = open(sys.path[0] + "/%s", "rb") imp.set_frozenmodules(marshal.load(f)) f.close() """ % FROZEN_ARCHIVE | if USE_ZIPIMPORT: ZIP_ARCHIVE = "Modules.zip" SITE_PY += "sys.path.append(sys.path[0] + '/%s')\n" % ZIP_ARCHIVE def getPycData(fullname, code, ispkg): if ispkg: fullname += ".__init__" path = fullname.replace(".", os.sep) + PYC_EXT return path, MAGIC + '\0\0\0\0' + marshal.dumps(code) | def report(self): # XXX something decent pass | 109ecbf7a52786df6114cfb678bd19e19102e076 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/109ecbf7a52786df6114cfb678bd19e19102e076/bundlebuilder.py |
import imp, sys, os for p in sys.path: path = os.path.join(p, "%(filename)s") if os.path.exists(path): break else: assert 0, "file not found: %(filename)s" mod = imp.load_dynamic("%(name)s", path) sys.modules["%(name)s"] = mod | def __load(): import imp, sys, os for p in sys.path: path = os.path.join(p, "%(filename)s") if os.path.exists(path): break else: assert 0, "file not found: %(filename)s" mod = imp.load_dynamic("%(name)s", path) __load() del __load | def report(self): # XXX something decent pass | 109ecbf7a52786df6114cfb678bd19e19102e076 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/109ecbf7a52786df6114cfb678bd19e19102e076/bundlebuilder.py |
if USE_FROZEN: frozenmodules = [] | if USE_ZIPIMPORT: import zipfile relpath = pathjoin("Contents", "Resources", ZIP_ARCHIVE) abspath = pathjoin(self.bundlepath, relpath) zf = zipfile.ZipFile(abspath, "w", zipfile.ZIP_DEFLATED) | def addPythonModules(self): self.message("Adding Python modules", 1) | 109ecbf7a52786df6114cfb678bd19e19102e076 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/109ecbf7a52786df6114cfb678bd19e19102e076/bundlebuilder.py |
if ispkg: self.message("Adding Python package %s" % name, 2) else: self.message("Adding Python module %s" % name, 2) frozenmodules.append((name, marshal.dumps(code), ispkg)) frozenmodules = tuple(frozenmodules) relpath = pathjoin("Contents", "Resources", FROZEN_ARCHIVE) abspath = pathjoin(self.bundlepath, relpath) f = open(abspath, "wb") marshal.dump(frozenmodules, f) f.close() | self.message("Adding Python module %s" % name, 2) path, pyc = getPycData(name, code, ispkg) zf.writestr(path, pyc) zf.close() | def addPythonModules(self): self.message("Adding Python modules", 1) | 109ecbf7a52786df6114cfb678bd19e19102e076 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/109ecbf7a52786df6114cfb678bd19e19102e076/bundlebuilder.py |
if USE_FROZEN: | if USE_ZIPIMPORT: | def findDependencies(self): self.message("Finding module dependencies", 1) import modulefinder mf = modulefinder.ModuleFinder(excludes=self.excludeModules) # manually add our own site.py site = mf.add_module("site") site.__code__ = SITE_CO mf.scan_code(SITE_CO, site) | 109ecbf7a52786df6114cfb678bd19e19102e076 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/109ecbf7a52786df6114cfb678bd19e19102e076/bundlebuilder.py |
if not USE_FROZEN or name != "site": | if not USE_ZIPIMPORT or name != "site": | def findDependencies(self): self.message("Finding module dependencies", 1) import modulefinder mf = modulefinder.ModuleFinder(excludes=self.excludeModules) # manually add our own site.py site = mf.add_module("site") site.__code__ = SITE_CO mf.scan_code(SITE_CO, site) | 109ecbf7a52786df6114cfb678bd19e19102e076 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/109ecbf7a52786df6114cfb678bd19e19102e076/bundlebuilder.py |
def findDependencies(self): self.message("Finding module dependencies", 1) import modulefinder mf = modulefinder.ModuleFinder(excludes=self.excludeModules) # manually add our own site.py site = mf.add_module("site") site.__code__ = SITE_CO mf.scan_code(SITE_CO, site) | 109ecbf7a52786df6114cfb678bd19e19102e076 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/109ecbf7a52786df6114cfb678bd19e19102e076/bundlebuilder.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.