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 ...
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 ...
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 ...
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 ...
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 ...
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, "...
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() retur...
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() retur...
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() retur...
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() retur...
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, '****')): _functio...
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) i...
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 o...
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"...
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)....
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 el...
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...
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 = envpat...
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 v...
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 v...
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 ...
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 ...
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('...
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('...
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 ...
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=RIG...
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 conventio...
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 conventio...
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" ...
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): # < ...
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): # < ...
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): # < ...
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): # < ...
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...
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 gaus...
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 gaus...
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 = ...
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