rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
if chunks[0].strip() == '' and lines: del chunks[0]
if chunks[-1].strip() == '' and lines: del chunks[-1]
def _wrap_chunks(self, chunks): """_wrap_chunks(chunks : [string]) -> [string]
d6b1aef33b7c7d40bfb1081d307451a71781d2bc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d6b1aef33b7c7d40bfb1081d307451a71781d2bc/textwrap.py
l = len(chunks[0])
l = len(chunks[-1])
def _wrap_chunks(self, chunks): """_wrap_chunks(chunks : [string]) -> [string]
d6b1aef33b7c7d40bfb1081d307451a71781d2bc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d6b1aef33b7c7d40bfb1081d307451a71781d2bc/textwrap.py
cur_line.append(chunks.pop(0))
cur_line.append(chunks.pop())
def _wrap_chunks(self, chunks): """_wrap_chunks(chunks : [string]) -> [string]
d6b1aef33b7c7d40bfb1081d307451a71781d2bc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d6b1aef33b7c7d40bfb1081d307451a71781d2bc/textwrap.py
if chunks and len(chunks[0]) > width:
if chunks and len(chunks[-1]) > width:
def _wrap_chunks(self, chunks): """_wrap_chunks(chunks : [string]) -> [string]
d6b1aef33b7c7d40bfb1081d307451a71781d2bc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d6b1aef33b7c7d40bfb1081d307451a71781d2bc/textwrap.py
self.pos = self.pos + length return self.fp.read(length)
data = self.fp.read(length) self.pos = self.fp.tell() return data
def read(self, length = None): if self.pos >= self.stop: return '' remaining = self.stop - self.pos if length is None or length < 0: length = remaining elif length > remaining: length = remaining self.fp.seek(self.pos) self.pos = self.pos + length return self.fp.read(length)
5e2f3fce2233c6cc5720814fb07fb30a4d661f14 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5e2f3fce2233c6cc5720814fb07fb30a4d661f14/mailbox.py
if len(data) < length: length = len(data) self.pos = self.pos + length
self.pos = self.fp.tell()
def readline(self, length = None): if self.pos >= self.stop: return '' if length is None: length = self.stop - self.pos self.fp.seek(self.pos) data = self.fp.readline(length) if len(data) < length: length = len(data) self.pos = self.pos + length return data
5e2f3fce2233c6cc5720814fb07fb30a4d661f14 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5e2f3fce2233c6cc5720814fb07fb30a4d661f14/mailbox.py
pass
del self.fp
def close(self): pass
5e2f3fce2233c6cc5720814fb07fb30a4d661f14 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5e2f3fce2233c6cc5720814fb07fb30a4d661f14/mailbox.py
index = self._tclCommands.index(name) del self._tclCommands[index]
try: self._tclCommands.remove(name) except ValueError: pass
def deletecommand(self, name): #print '- Tkinter: deleted command', name self.tk.deletecommand(name) index = self._tclCommands.index(name) del self._tclCommands[index]
48044b41c45fe4093db593d53822db0a1eb635ae /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/48044b41c45fe4093db593d53822db0a1eb635ae/Tkinter.py
def _bind(self, what, sequence, func, add):
def _bind(self, what, sequence, func, add, needcleanup=1):
def _bind(self, what, sequence, func, add): if func: cmd = ("%sset _tkinter_break [%s %s]\n" 'if {"$_tkinter_break" == "break"} break\n') \ % (add and '+' or '', self._register(func, self._substitute), _string.join(self._subst_format)) apply(self.tk.call, what + (sequence, cmd)) elif func == '': apply(self.tk.call, what + (sequence, func)) else: return apply(self.tk.call, what + (sequence,))
48044b41c45fe4093db593d53822db0a1eb635ae /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/48044b41c45fe4093db593d53822db0a1eb635ae/Tkinter.py
self._register(func, self._substitute),
self._register(func, self._substitute, needcleanup),
def _bind(self, what, sequence, func, add): if func: cmd = ("%sset _tkinter_break [%s %s]\n" 'if {"$_tkinter_break" == "break"} break\n') \ % (add and '+' or '', self._register(func, self._substitute), _string.join(self._subst_format)) apply(self.tk.call, what + (sequence, cmd)) elif func == '': apply(self.tk.call, what + (sequence, func)) else: return apply(self.tk.call, what + (sequence,))
48044b41c45fe4093db593d53822db0a1eb635ae /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/48044b41c45fe4093db593d53822db0a1eb635ae/Tkinter.py
return self._bind(('bind', 'all'), sequence, func, add)
return self._bind(('bind', 'all'), sequence, func, add, 0)
def bind_all(self, sequence=None, func=None, add=None): return self._bind(('bind', 'all'), sequence, func, add)
48044b41c45fe4093db593d53822db0a1eb635ae /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/48044b41c45fe4093db593d53822db0a1eb635ae/Tkinter.py
return self._bind(('bind', className), sequence, func, add)
return self._bind(('bind', className), sequence, func, add, 0)
def bind_class(self, className, sequence=None, func=None, add=None): return self._bind(('bind', className), sequence, func, add)
48044b41c45fe4093db593d53822db0a1eb635ae /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/48044b41c45fe4093db593d53822db0a1eb635ae/Tkinter.py
def _register(self, func, subst=None):
def _register(self, func, subst=None, needcleanup=1):
def _register(self, func, subst=None): f = CallWrapper(func, subst, self).__call__ name = `id(f)` try: func = func.im_func except AttributeError: pass try: name = name + func.__name__ except AttributeError: pass self.tk.createcommand(name, f) if self._tclCommands is None: self._tclCommands = [] self._tclCommands.append(name) #print '+ Tkinter created command', name return name
48044b41c45fe4093db593d53822db0a1eb635ae /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/48044b41c45fe4093db593d53822db0a1eb635ae/Tkinter.py
if self._tclCommands is None: self._tclCommands = [] self._tclCommands.append(name)
if needcleanup: if self._tclCommands is None: self._tclCommands = [] self._tclCommands.append(name)
def _register(self, func, subst=None): f = CallWrapper(func, subst, self).__call__ name = `id(f)` try: func = func.im_func except AttributeError: pass try: name = name + func.__name__ except AttributeError: pass self.tk.createcommand(name, f) if self._tclCommands is None: self._tclCommands = [] self._tclCommands.append(name) #print '+ Tkinter created command', name return name
48044b41c45fe4093db593d53822db0a1eb635ae /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/48044b41c45fe4093db593d53822db0a1eb635ae/Tkinter.py
def change_root (new_root, pathname): """Return 'pathname' with 'new_root' prepended. If 'pathname' is relative, this is equivalent to "os.path.join(new_root,pathname)". Otherwise, it requires making 'pathname' relative and then joining the two, which is tricky on DOS/Windows and Mac OS.""" if not abspath (pathname): return os.path.join (new_root, pathname) elif os.name == 'posix': return os.path.join (new_root, pathname[1:]) elif os.name == 'nt': (root_drive, root_path) = os.path.splitdrive (new_root) (drive, path) = os.path.splitdrive (pathname) raise RuntimeError, "I give up -- not sure how to do this on Windows" elif os.name == 'mac': raise RuntimeError, "no clue how to do this on Mac OS" else: raise DistutilsPlatformError, \ "nothing known about platform '%s'" % os.name
7c3f7a4a3d61490de1c6e92609311b7216e3dfb9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/7c3f7a4a3d61490de1c6e92609311b7216e3dfb9/util.py
two, which is tricky on DOS/Windows and Mac OS.""" if not abspath (pathname): return os.path.join (new_root, pathname) elif os.name == 'posix': return os.path.join (new_root, pathname[1:])
two, which is tricky on DOS/Windows and Mac OS. """ if os.name == 'posix': if not os.path.isabs (pathname): return os.path.join (new_root, pathname) else: return os.path.join (new_root, pathname[1:])
def change_root (new_root, pathname): """Return 'pathname' with 'new_root' prepended. If 'pathname' is relative, this is equivalent to "os.path.join(new_root,pathname)". Otherwise, it requires making 'pathname' relative and then joining the two, which is tricky on DOS/Windows and Mac OS.""" if not abspath (pathname): return os.path.join (new_root, pathname) elif os.name == 'posix': return os.path.join (new_root, pathname[1:]) elif os.name == 'nt': (root_drive, root_path) = os.path.splitdrive (new_root) (drive, path) = os.path.splitdrive (pathname) raise RuntimeError, "I give up -- not sure how to do this on Windows" elif os.name == 'mac': raise RuntimeError, "no clue how to do this on Mac OS" else: raise DistutilsPlatformError, \ "nothing known about platform '%s'" % os.name
7c3f7a4a3d61490de1c6e92609311b7216e3dfb9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/7c3f7a4a3d61490de1c6e92609311b7216e3dfb9/util.py
(root_drive, root_path) = os.path.splitdrive (new_root)
def change_root (new_root, pathname): """Return 'pathname' with 'new_root' prepended. If 'pathname' is relative, this is equivalent to "os.path.join(new_root,pathname)". Otherwise, it requires making 'pathname' relative and then joining the two, which is tricky on DOS/Windows and Mac OS.""" if not abspath (pathname): return os.path.join (new_root, pathname) elif os.name == 'posix': return os.path.join (new_root, pathname[1:]) elif os.name == 'nt': (root_drive, root_path) = os.path.splitdrive (new_root) (drive, path) = os.path.splitdrive (pathname) raise RuntimeError, "I give up -- not sure how to do this on Windows" elif os.name == 'mac': raise RuntimeError, "no clue how to do this on Mac OS" else: raise DistutilsPlatformError, \ "nothing known about platform '%s'" % os.name
7c3f7a4a3d61490de1c6e92609311b7216e3dfb9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/7c3f7a4a3d61490de1c6e92609311b7216e3dfb9/util.py
raise RuntimeError, "I give up -- not sure how to do this on Windows"
if path[0] == '\\': path = path[1:] return os.path.join (new_root, path)
def change_root (new_root, pathname): """Return 'pathname' with 'new_root' prepended. If 'pathname' is relative, this is equivalent to "os.path.join(new_root,pathname)". Otherwise, it requires making 'pathname' relative and then joining the two, which is tricky on DOS/Windows and Mac OS.""" if not abspath (pathname): return os.path.join (new_root, pathname) elif os.name == 'posix': return os.path.join (new_root, pathname[1:]) elif os.name == 'nt': (root_drive, root_path) = os.path.splitdrive (new_root) (drive, path) = os.path.splitdrive (pathname) raise RuntimeError, "I give up -- not sure how to do this on Windows" elif os.name == 'mac': raise RuntimeError, "no clue how to do this on Mac OS" else: raise DistutilsPlatformError, \ "nothing known about platform '%s'" % os.name
7c3f7a4a3d61490de1c6e92609311b7216e3dfb9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/7c3f7a4a3d61490de1c6e92609311b7216e3dfb9/util.py
fn = os.path.join(fn, os.pardir, os.pardir, "Doc", "index.html")
fn = os.path.join(fn, os.pardir, os.pardir, "pythlp.chm")
def help_dialog(self, event=None): try: helpfile = os.path.join(os.path.dirname(__file__), self.helpfile) except NameError: helpfile = self.helpfile if self.flist: self.flist.open(helpfile) else: self.io.loadfile(helpfile)
7e3d991be5fd5e96095647dd6e875e85cb37bec4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/7e3d991be5fd5e96095647dd6e875e85cb37bec4/EditorWindow.py
def python_docs(self, event=None): webbrowser.open(self.help_url)
def python_docs(self, event=None): os.startfile(self.help_url) else: def python_docs(self, event=None): webbrowser.open(self.help_url)
def python_docs(self, event=None): webbrowser.open(self.help_url)
7e3d991be5fd5e96095647dd6e875e85cb37bec4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/7e3d991be5fd5e96095647dd6e875e85cb37bec4/EditorWindow.py
def install_opener(opener): global _opener _opener = opener
412928886f3c414218f58a9d1bb94d424baff23f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/412928886f3c414218f58a9d1bb94d424baff23f/urllib2.py
print 'Option', opt, 'require integer argument'
print 'Option', opt, 'requires integer argument'
def main(): global debug, looping, magnify, mindelta, nowait, quiet, regen, speed global threading, xoff, yoff # Parse command line try: opts, args = getopt.getopt(sys.argv[1:], 'M:dlm:nqr:s:tx:y:') except getopt.error, msg: sys.stdout = sys.stderr print 'Error:', msg, '\n' help() sys.exit(2) # Interpret options try: for opt, arg in opts: if opt == '-M': magnify = float(eval(arg)) if opt == '-d': debug = debug + 1 if opt == '-l': looping = 1 if opt == '-m': mindelta = string.atoi(arg) if opt == '-n': nowait = 1 if opt == '-q': quiet = 1 if opt == '-r': regen = string.atoi(arg) if opt == '-s': try: speed = float(eval(arg)) except: sys.stdout = sys.stderr print 'Option -s needs float argument' sys.exit(2) if opt == '-t': try: import thread threading = 1 except ImportError: print 'Sorry, this version of Python', print 'does not support threads:', print '-t ignored' if opt == '-x': xoff = string.atoi(arg) if opt == '-y': yoff = string.atoi(arg) except string.atoi_error: sys.stdout = sys.stderr print 'Option', opt, 'require integer argument' sys.exit(2) # Check validity of certain options combinations if nowait and looping: print 'Warning: -n and -l are mutually exclusive; -n ignored' nowait = 0 if xoff <> None and yoff == None: print 'Warning: -x without -y ignored' if xoff == None and yoff <> None: print 'Warning: -y without -x ignored' # Process all files if not args: args = ['film.video'] sts = 0 for filename in args: sts = (process(filename) or sts) # Exit with proper exit status sys.exit(sts)
af8f188ada691095b945befc9facaed49e1f1241 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/af8f188ada691095b945befc9facaed49e1f1241/Vplay.py
def _execute_child(self, args, executable, preexec_fn, close_fds, cwd, env, universal_newlines, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite): """Execute program (MS Windows version)"""
1aabbaa1d4f0768d744c6da64b91ab8be5492f4a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1aabbaa1d4f0768d744c6da64b91ab8be5492f4a/subprocess.py
"""Normalize case of pathname. Makes all characters lowercase and all slashes into backslashes""" return string.translate(s, _normtable)
"""Normalize case of pathname. Makes all characters lowercase and all slashes into backslashes. """ return string.lower(string.replace(s, "/", "\\"))
def normcase(s): """Normalize case of pathname. Makes all characters lowercase and all
e215977a4169455bf2f06e510338c5fe06e83f40 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e215977a4169455bf2f06e510338c5fe06e83f40/ntpath.py
'debug_script',
def _test(): import doctest doctest.testmod()
4c31e7dae362337dd1984da2bf4b919e8bf0cde1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4c31e7dae362337dd1984da2bf4b919e8bf0cde1/doctest.py
class AnotherDateTimeClass(object): def __cmp__(self, other): return 0 their = AnotherDateTimeClass()
class SomeClass: pass their = SomeClass() self.assertEqual(our == their, False) self.assertEqual(their == our, False) self.assertEqual(our != their, True) self.assertEqual(their != our, True) self.assertRaises(TypeError, lambda: our < their) self.assertRaises(TypeError, lambda: their < our)
def test_mixed_compare(self): our = self.theclass(2000, 4, 5) self.assertRaises(TypeError, cmp, our, 1) self.assertRaises(TypeError, cmp, 1, our)
32f1a50c1803d7a8233c24675c2ee983173c2612 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/32f1a50c1803d7a8233c24675c2ee983173c2612/test_datetime.py
class Comparable(AnotherDateTimeClass): def timetuple(self): return () their = Comparable() self.assertEqual(cmp(our, their), 0) self.assertEqual(cmp(their, our), 0) self.failUnless(our == their) self.failUnless(their == our)
self.assertRaises(TypeError, cmp, their, our) class LargerThanAnything: def __lt__(self, other): return False def __le__(self, other): return isinstance(other, LargerThanAnything) def __eq__(self, other): return isinstance(other, LargerThanAnything) def __ne__(self, other): return not isinstance(other, LargerThanAnything) def __gt__(self, other): return not isinstance(other, LargerThanAnything) def __ge__(self, other): return True their = LargerThanAnything() self.assertEqual(our == their, False) self.assertEqual(their == our, False) self.assertEqual(our != their, True) self.assertEqual(their != our, True) self.assertEqual(our < their, True) self.assertEqual(their < our, False) self.assertEqual(cmp(our, their), -1) self.assertEqual(cmp(their, our), 1)
def __cmp__(self, other): # Return "equal" so calling this can't be confused with # compare-by-address (which never says "equal" for distinct # objects). return 0
32f1a50c1803d7a8233c24675c2ee983173c2612 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/32f1a50c1803d7a8233c24675c2ee983173c2612/test_datetime.py
self.assert_(as_date.__eq__(as_datetime))
self.assertEqual(as_date.__eq__(as_datetime), True)
def test_bug_1028306(self): # Trying to compare a date to a datetime should act like a mixed- # type comparison, despite that datetime is a subclass of date. as_date = date.today() as_datetime = datetime.combine(as_date, time()) self.assert_(as_date != as_datetime) self.assert_(as_datetime != as_date) self.assert_(not as_date == as_datetime) self.assert_(not as_datetime == as_date) self.assertRaises(TypeError, lambda: as_date < as_datetime) self.assertRaises(TypeError, lambda: as_datetime < as_date) self.assertRaises(TypeError, lambda: as_date <= as_datetime) self.assertRaises(TypeError, lambda: as_datetime <= as_date) self.assertRaises(TypeError, lambda: as_date > as_datetime) self.assertRaises(TypeError, lambda: as_datetime > as_date) self.assertRaises(TypeError, lambda: as_date >= as_datetime) self.assertRaises(TypeError, lambda: as_datetime >= as_date)
32f1a50c1803d7a8233c24675c2ee983173c2612 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/32f1a50c1803d7a8233c24675c2ee983173c2612/test_datetime.py
self.assert_(not as_date.__eq__(as_datetime.replace(day= different_day)))
as_different = as_datetime.replace(day= different_day) self.assertEqual(as_date.__eq__(as_different), False)
def test_bug_1028306(self): # Trying to compare a date to a datetime should act like a mixed- # type comparison, despite that datetime is a subclass of date. as_date = date.today() as_datetime = datetime.combine(as_date, time()) self.assert_(as_date != as_datetime) self.assert_(as_datetime != as_date) self.assert_(not as_date == as_datetime) self.assert_(not as_datetime == as_date) self.assertRaises(TypeError, lambda: as_date < as_datetime) self.assertRaises(TypeError, lambda: as_datetime < as_date) self.assertRaises(TypeError, lambda: as_date <= as_datetime) self.assertRaises(TypeError, lambda: as_datetime <= as_date) self.assertRaises(TypeError, lambda: as_date > as_datetime) self.assertRaises(TypeError, lambda: as_datetime > as_date) self.assertRaises(TypeError, lambda: as_date >= as_datetime) self.assertRaises(TypeError, lambda: as_datetime >= as_date)
32f1a50c1803d7a8233c24675c2ee983173c2612 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/32f1a50c1803d7a8233c24675c2ee983173c2612/test_datetime.py
def test(openmethod, what):
def test(openmethod, what, ondisk=1):
def test(openmethod, what): if verbose: print '\nTesting: ', what fname = tempfile.mktemp() f = openmethod(fname, 'c') verify(f.keys() == []) if verbose: print 'creation...' f['0'] = '' f['a'] = 'Guido' f['b'] = 'van' f['c'] = 'Rossum' f['d'] = 'invented' f['f'] = 'Python' if verbose: print '%s %s %s' % (f['a'], f['b'], f['c']) if what == 'BTree' : if verbose: print 'key ordering...' f.set_location(f.first()[0]) while 1: try: rec = f.next() except KeyError: if rec != f.last(): print 'Error, last != last!' f.previous() break if verbose: print rec if not f.has_key('a'): print 'Error, missing key!' f.sync() f.close() if verbose: print 'modification...' f = openmethod(fname, 'w') f['d'] = 'discovered' if verbose: print 'access...' for key in f.keys(): word = f[key] if verbose: print word f.close() try: os.remove(fname) except os.error: pass
0dcc016ee3b6d67d7aa6fe8fd037ff610198a2fd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/0dcc016ee3b6d67d7aa6fe8fd037ff610198a2fd/test_bsddb.py
print '\nTesting: ', what
print '\nTesting: ', what, (ondisk and "on disk" or "in memory")
def test(openmethod, what): if verbose: print '\nTesting: ', what fname = tempfile.mktemp() f = openmethod(fname, 'c') verify(f.keys() == []) if verbose: print 'creation...' f['0'] = '' f['a'] = 'Guido' f['b'] = 'van' f['c'] = 'Rossum' f['d'] = 'invented' f['f'] = 'Python' if verbose: print '%s %s %s' % (f['a'], f['b'], f['c']) if what == 'BTree' : if verbose: print 'key ordering...' f.set_location(f.first()[0]) while 1: try: rec = f.next() except KeyError: if rec != f.last(): print 'Error, last != last!' f.previous() break if verbose: print rec if not f.has_key('a'): print 'Error, missing key!' f.sync() f.close() if verbose: print 'modification...' f = openmethod(fname, 'w') f['d'] = 'discovered' if verbose: print 'access...' for key in f.keys(): word = f[key] if verbose: print word f.close() try: os.remove(fname) except os.error: pass
0dcc016ee3b6d67d7aa6fe8fd037ff610198a2fd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/0dcc016ee3b6d67d7aa6fe8fd037ff610198a2fd/test_bsddb.py
fname = tempfile.mktemp()
if ondisk: fname = tempfile.mktemp() else: fname = None
def test(openmethod, what): if verbose: print '\nTesting: ', what fname = tempfile.mktemp() f = openmethod(fname, 'c') verify(f.keys() == []) if verbose: print 'creation...' f['0'] = '' f['a'] = 'Guido' f['b'] = 'van' f['c'] = 'Rossum' f['d'] = 'invented' f['f'] = 'Python' if verbose: print '%s %s %s' % (f['a'], f['b'], f['c']) if what == 'BTree' : if verbose: print 'key ordering...' f.set_location(f.first()[0]) while 1: try: rec = f.next() except KeyError: if rec != f.last(): print 'Error, last != last!' f.previous() break if verbose: print rec if not f.has_key('a'): print 'Error, missing key!' f.sync() f.close() if verbose: print 'modification...' f = openmethod(fname, 'w') f['d'] = 'discovered' if verbose: print 'access...' for key in f.keys(): word = f[key] if verbose: print word f.close() try: os.remove(fname) except os.error: pass
0dcc016ee3b6d67d7aa6fe8fd037ff610198a2fd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/0dcc016ee3b6d67d7aa6fe8fd037ff610198a2fd/test_bsddb.py
if verbose: print 'modification...' f = openmethod(fname, 'w') f['d'] = 'discovered'
if ondisk: if verbose: print 'modification...' f = openmethod(fname, 'w') f['d'] = 'discovered'
def test(openmethod, what): if verbose: print '\nTesting: ', what fname = tempfile.mktemp() f = openmethod(fname, 'c') verify(f.keys() == []) if verbose: print 'creation...' f['0'] = '' f['a'] = 'Guido' f['b'] = 'van' f['c'] = 'Rossum' f['d'] = 'invented' f['f'] = 'Python' if verbose: print '%s %s %s' % (f['a'], f['b'], f['c']) if what == 'BTree' : if verbose: print 'key ordering...' f.set_location(f.first()[0]) while 1: try: rec = f.next() except KeyError: if rec != f.last(): print 'Error, last != last!' f.previous() break if verbose: print rec if not f.has_key('a'): print 'Error, missing key!' f.sync() f.close() if verbose: print 'modification...' f = openmethod(fname, 'w') f['d'] = 'discovered' if verbose: print 'access...' for key in f.keys(): word = f[key] if verbose: print word f.close() try: os.remove(fname) except os.error: pass
0dcc016ee3b6d67d7aa6fe8fd037ff610198a2fd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/0dcc016ee3b6d67d7aa6fe8fd037ff610198a2fd/test_bsddb.py
if verbose: print 'access...' for key in f.keys(): word = f[key]
def test(openmethod, what): if verbose: print '\nTesting: ', what fname = tempfile.mktemp() f = openmethod(fname, 'c') verify(f.keys() == []) if verbose: print 'creation...' f['0'] = '' f['a'] = 'Guido' f['b'] = 'van' f['c'] = 'Rossum' f['d'] = 'invented' f['f'] = 'Python' if verbose: print '%s %s %s' % (f['a'], f['b'], f['c']) if what == 'BTree' : if verbose: print 'key ordering...' f.set_location(f.first()[0]) while 1: try: rec = f.next() except KeyError: if rec != f.last(): print 'Error, last != last!' f.previous() break if verbose: print rec if not f.has_key('a'): print 'Error, missing key!' f.sync() f.close() if verbose: print 'modification...' f = openmethod(fname, 'w') f['d'] = 'discovered' if verbose: print 'access...' for key in f.keys(): word = f[key] if verbose: print word f.close() try: os.remove(fname) except os.error: pass
0dcc016ee3b6d67d7aa6fe8fd037ff610198a2fd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/0dcc016ee3b6d67d7aa6fe8fd037ff610198a2fd/test_bsddb.py
print word
print 'access...' for key in f.keys(): word = f[key] if verbose: print word
def test(openmethod, what): if verbose: print '\nTesting: ', what fname = tempfile.mktemp() f = openmethod(fname, 'c') verify(f.keys() == []) if verbose: print 'creation...' f['0'] = '' f['a'] = 'Guido' f['b'] = 'van' f['c'] = 'Rossum' f['d'] = 'invented' f['f'] = 'Python' if verbose: print '%s %s %s' % (f['a'], f['b'], f['c']) if what == 'BTree' : if verbose: print 'key ordering...' f.set_location(f.first()[0]) while 1: try: rec = f.next() except KeyError: if rec != f.last(): print 'Error, last != last!' f.previous() break if verbose: print rec if not f.has_key('a'): print 'Error, missing key!' f.sync() f.close() if verbose: print 'modification...' f = openmethod(fname, 'w') f['d'] = 'discovered' if verbose: print 'access...' for key in f.keys(): word = f[key] if verbose: print word f.close() try: os.remove(fname) except os.error: pass
0dcc016ee3b6d67d7aa6fe8fd037ff610198a2fd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/0dcc016ee3b6d67d7aa6fe8fd037ff610198a2fd/test_bsddb.py
f.close() try: os.remove(fname) except os.error: pass
f.close() try: os.remove(fname) except os.error: pass
def test(openmethod, what): if verbose: print '\nTesting: ', what fname = tempfile.mktemp() f = openmethod(fname, 'c') verify(f.keys() == []) if verbose: print 'creation...' f['0'] = '' f['a'] = 'Guido' f['b'] = 'van' f['c'] = 'Rossum' f['d'] = 'invented' f['f'] = 'Python' if verbose: print '%s %s %s' % (f['a'], f['b'], f['c']) if what == 'BTree' : if verbose: print 'key ordering...' f.set_location(f.first()[0]) while 1: try: rec = f.next() except KeyError: if rec != f.last(): print 'Error, last != last!' f.previous() break if verbose: print rec if not f.has_key('a'): print 'Error, missing key!' f.sync() f.close() if verbose: print 'modification...' f = openmethod(fname, 'w') f['d'] = 'discovered' if verbose: print 'access...' for key in f.keys(): word = f[key] if verbose: print word f.close() try: os.remove(fname) except os.error: pass
0dcc016ee3b6d67d7aa6fe8fd037ff610198a2fd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/0dcc016ee3b6d67d7aa6fe8fd037ff610198a2fd/test_bsddb.py
test(type[0], type[1])
test(*type)
def test(openmethod, what): if verbose: print '\nTesting: ', what fname = tempfile.mktemp() f = openmethod(fname, 'c') verify(f.keys() == []) if verbose: print 'creation...' f['0'] = '' f['a'] = 'Guido' f['b'] = 'van' f['c'] = 'Rossum' f['d'] = 'invented' f['f'] = 'Python' if verbose: print '%s %s %s' % (f['a'], f['b'], f['c']) if what == 'BTree' : if verbose: print 'key ordering...' f.set_location(f.first()[0]) while 1: try: rec = f.next() except KeyError: if rec != f.last(): print 'Error, last != last!' f.previous() break if verbose: print rec if not f.has_key('a'): print 'Error, missing key!' f.sync() f.close() if verbose: print 'modification...' f = openmethod(fname, 'w') f['d'] = 'discovered' if verbose: print 'access...' for key in f.keys(): word = f[key] if verbose: print word f.close() try: os.remove(fname) except os.error: pass
0dcc016ee3b6d67d7aa6fe8fd037ff610198a2fd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/0dcc016ee3b6d67d7aa6fe8fd037ff610198a2fd/test_bsddb.py
toaddrs = ','.split(prompt("To"))
toaddrs = prompt("To").split(',')
def prompt(prompt): sys.stdout.write(prompt + ": ") return sys.stdin.readline().strip()
11cd61222cd0f846220b7518c4ab2af39336159f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/11cd61222cd0f846220b7518c4ab2af39336159f/smtplib.py
SyntaxError: assignment to None (<doctest test.test_syntax[13]>, line 1)
SyntaxError: assignment to None (<doctest test.test_syntax[14]>, line 1)
>>> def f(None=1):
70e76ec773b0317f9a87ce674bacec91d8b5bdac /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/70e76ec773b0317f9a87ce674bacec91d8b5bdac/test_syntax.py
SyntaxError: non-default argument follows default argument (<doctest test.test_syntax[14]>, line 1)
SyntaxError: non-default argument follows default argument (<doctest test.test_syntax[15]>, line 1)
>>> def f(x, y=1, z):
70e76ec773b0317f9a87ce674bacec91d8b5bdac /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/70e76ec773b0317f9a87ce674bacec91d8b5bdac/test_syntax.py
SyntaxError: assignment to None (<doctest test.test_syntax[15]>, line 1)
SyntaxError: assignment to None (<doctest test.test_syntax[16]>, line 1)
>>> def f(x, None):
70e76ec773b0317f9a87ce674bacec91d8b5bdac /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/70e76ec773b0317f9a87ce674bacec91d8b5bdac/test_syntax.py
SyntaxError: assignment to None (<doctest test.test_syntax[16]>, line 1)
SyntaxError: assignment to None (<doctest test.test_syntax[17]>, line 1)
>>> def f(*None):
70e76ec773b0317f9a87ce674bacec91d8b5bdac /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/70e76ec773b0317f9a87ce674bacec91d8b5bdac/test_syntax.py
SyntaxError: assignment to None (<doctest test.test_syntax[17]>, line 1)
SyntaxError: assignment to None (<doctest test.test_syntax[18]>, line 1)
>>> def f(**None):
70e76ec773b0317f9a87ce674bacec91d8b5bdac /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/70e76ec773b0317f9a87ce674bacec91d8b5bdac/test_syntax.py
SyntaxError: assignment to None (<doctest test.test_syntax[18]>, line 1)
SyntaxError: assignment to None (<doctest test.test_syntax[19]>, line 1)
>>> def None(x):
70e76ec773b0317f9a87ce674bacec91d8b5bdac /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/70e76ec773b0317f9a87ce674bacec91d8b5bdac/test_syntax.py
SyntaxError: Generator expression must be parenthesized if not sole argument (<doctest test.test_syntax[22]>, line 1)
SyntaxError: Generator expression must be parenthesized if not sole argument (<doctest test.test_syntax[23]>, line 1)
>>> def f(it, *varargs):
70e76ec773b0317f9a87ce674bacec91d8b5bdac /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/70e76ec773b0317f9a87ce674bacec91d8b5bdac/test_syntax.py
SyntaxError: more than 255 arguments (<doctest test.test_syntax[24]>, line 1)
SyntaxError: more than 255 arguments (<doctest test.test_syntax[25]>, line 1)
>>> def f(it, *varargs):
70e76ec773b0317f9a87ce674bacec91d8b5bdac /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/70e76ec773b0317f9a87ce674bacec91d8b5bdac/test_syntax.py
SyntaxError: more than 255 arguments (<doctest test.test_syntax[25]>, line 1)
SyntaxError: more than 255 arguments (<doctest test.test_syntax[26]>, line 1)
>>> def f(it, *varargs):
70e76ec773b0317f9a87ce674bacec91d8b5bdac /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/70e76ec773b0317f9a87ce674bacec91d8b5bdac/test_syntax.py
SyntaxError: lambda cannot contain assignment (<doctest test.test_syntax[26]>, line 1)
SyntaxError: lambda cannot contain assignment (<doctest test.test_syntax[27]>, line 1)
>>> def f(it, *varargs):
70e76ec773b0317f9a87ce674bacec91d8b5bdac /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/70e76ec773b0317f9a87ce674bacec91d8b5bdac/test_syntax.py
SyntaxError: keyword can't be an expression (<doctest test.test_syntax[27]>, line 1)
SyntaxError: keyword can't be an expression (<doctest test.test_syntax[28]>, line 1)
>>> def f(it, *varargs):
70e76ec773b0317f9a87ce674bacec91d8b5bdac /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/70e76ec773b0317f9a87ce674bacec91d8b5bdac/test_syntax.py
SyntaxError: keyword can't be an expression (<doctest test.test_syntax[28]>, line 1)
SyntaxError: keyword can't be an expression (<doctest test.test_syntax[29]>, line 1)
>>> def f(it, *varargs):
70e76ec773b0317f9a87ce674bacec91d8b5bdac /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/70e76ec773b0317f9a87ce674bacec91d8b5bdac/test_syntax.py
SyntaxError: keyword can't be an expression (<doctest test.test_syntax[29]>, line 1)
SyntaxError: keyword can't be an expression (<doctest test.test_syntax[30]>, line 1)
>>> def f(it, *varargs):
70e76ec773b0317f9a87ce674bacec91d8b5bdac /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/70e76ec773b0317f9a87ce674bacec91d8b5bdac/test_syntax.py
SyntaxError: augmented assignment to generator expression not possible (<doctest test.test_syntax[30]>, line 1)
SyntaxError: augmented assignment to generator expression not possible (<doctest test.test_syntax[31]>, line 1)
>>> def f(it, *varargs):
70e76ec773b0317f9a87ce674bacec91d8b5bdac /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/70e76ec773b0317f9a87ce674bacec91d8b5bdac/test_syntax.py
SyntaxError: assignment to None (<doctest test.test_syntax[31]>, line 1)
SyntaxError: assignment to None (<doctest test.test_syntax[32]>, line 1)
>>> def f(it, *varargs):
70e76ec773b0317f9a87ce674bacec91d8b5bdac /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/70e76ec773b0317f9a87ce674bacec91d8b5bdac/test_syntax.py
SyntaxError: illegal expression for augmented assignment (<doctest test.test_syntax[32]>, line 1)
SyntaxError: illegal expression for augmented assignment (<doctest test.test_syntax[33]>, line 1)
>>> def f(it, *varargs):
70e76ec773b0317f9a87ce674bacec91d8b5bdac /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/70e76ec773b0317f9a87ce674bacec91d8b5bdac/test_syntax.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'
a1267156366d3fed555bbda305d62cd45ec79f7a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a1267156366d3fed555bbda305d62cd45ec79f7a/Standard_Suite.py
self.doc.append(readme)
self.doc_files.append(readme)
def finalize_package_data (self): self.ensure_string('group', "Development/Libraries") self.ensure_string('vendor', "%s <%s>" % (self.distribution.get_contact(), self.distribution.get_contact_email())) self.ensure_string('packager') self.ensure_string_list('doc_files') if type(self.doc_files) is ListType: for readme in ('README', 'README.txt'): if os.path.exists(readme) and readme not in self.doc_files: self.doc.append(readme)
af475fa5b63d33e555430c64fc9bc649c1256240 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/af475fa5b63d33e555430c64fc9bc649c1256240/bdist_rpm.py
str = in_file.readline() while str and str != 'end\n': out_file.write(binascii.a2b_uu(str)) str = in_file.readline()
s = in_file.readline() while s and s != 'end\n': try: data = binascii.a2b_uu(s) except binascii.Error, v: nbytes = (((ord(s[0])-32) & 63) * 4 + 5) / 3 data = binascii.a2b_uu(s[:nbytes]) sys.stderr.write("Warning: %s\n" % str(v)) out_file.write(data) s = in_file.readline()
def decode(in_file, out_file=None, mode=None): """Decode uuencoded file""" # # Open the input file, if needed. # if in_file == '-': in_file = sys.stdin elif type(in_file) == type(''): in_file = open(in_file) # # Read until a begin is encountered or we've exhausted the file # while 1: hdr = in_file.readline() if not hdr: raise Error, 'No valid begin line found in input file' if hdr[:5] != 'begin': continue hdrfields = string.split(hdr) if len(hdrfields) == 3 and hdrfields[0] == 'begin': try: string.atoi(hdrfields[1], 8) break except ValueError: pass if out_file == None: out_file = hdrfields[2] if mode == None: mode = string.atoi(hdrfields[1], 8) # # Open the output file # if out_file == '-': out_file = sys.stdout elif type(out_file) == type(''): fp = open(out_file, 'wb') try: os.path.chmod(out_file, mode) except AttributeError: pass out_file = fp # # Main decoding loop # str = in_file.readline() while str and str != 'end\n': out_file.write(binascii.a2b_uu(str)) str = in_file.readline() if not str: raise Error, 'Truncated input file'
4db052951ebaa83c972bb66cf48a7ae44c4983ea /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4db052951ebaa83c972bb66cf48a7ae44c4983ea/uu.py
def translation(domain, localedir=None, languages=None, class_=None):
def translation(domain, localedir=None, languages=None, class_=None, fallback=0):
def translation(domain, localedir=None, languages=None, class_=None): if class_ is None: class_ = GNUTranslations mofile = find(domain, localedir, languages) if mofile is None: raise IOError(ENOENT, 'No translation file found for domain', domain) key = os.path.abspath(mofile) # TBD: do we need to worry about the file pointer getting collected? # Avoid opening, reading, and parsing the .mo file after it's been done # once. t = _translations.get(key) if t is None: t = _translations.setdefault(key, class_(open(mofile, 'rb'))) return t
bcdc47e92804d0f280595dcd7559bd55c85b2024 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/bcdc47e92804d0f280595dcd7559bd55c85b2024/gettext.py
translation(domain, localedir).install(unicode)
translation(domain, localedir, fallback=1).install(unicode)
def install(domain, localedir=None, unicode=0): translation(domain, localedir).install(unicode)
bcdc47e92804d0f280595dcd7559bd55c85b2024 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/bcdc47e92804d0f280595dcd7559bd55c85b2024/gettext.py
if sys.platform == 'aix4': python_lib = get_python_lib(standard_lib=1) ld_so_aix = os.path.join(python_lib, 'config', 'ld_so_aix') python_exp = os.path.join(python_lib, 'config', 'python.exp') g['LDSHARED'] = "%s %s -bI:%s" % (ld_so_aix, g['CC'], python_exp) elif sys.platform == 'beos': python_lib = get_python_lib(standard_lib=1) linkerscript_name = os.path.basename(string.split(g['LDSHARED'])[0]) linkerscript = os.path.join(python_lib, 'config', linkerscript_name) g['LDSHARED'] = ("%s -L%s/lib -lpython%s" % (linkerscript, PREFIX, sys.version[0:3]))
if python_build: g['LDSHARED'] = g['BLDSHARED']
def _init_posix(): """Initialize the module as appropriate for POSIX systems.""" g = {} # load the installed Makefile: try: filename = get_makefile_filename() parse_makefile(filename, g) except IOError, msg: my_msg = "invalid Python installation: unable to open %s" % filename if hasattr(msg, "strerror"): my_msg = my_msg + " (%s)" % msg.strerror raise DistutilsPlatformError, my_msg # On AIX, there are wrong paths to the linker scripts in the Makefile # -- these paths are relative to the Python source, but when installed # the scripts are in another directory. if sys.platform == 'aix4': # what about AIX 3.x ? # Linker script is in the config directory, not in Modules as the # Makefile says. python_lib = get_python_lib(standard_lib=1) ld_so_aix = os.path.join(python_lib, 'config', 'ld_so_aix') python_exp = os.path.join(python_lib, 'config', 'python.exp') g['LDSHARED'] = "%s %s -bI:%s" % (ld_so_aix, g['CC'], python_exp) elif sys.platform == 'beos': # Linker script is in the config directory. In the Makefile it is # relative to the srcdir, which after installation no longer makes # sense. python_lib = get_python_lib(standard_lib=1) linkerscript_name = os.path.basename(string.split(g['LDSHARED'])[0]) linkerscript = os.path.join(python_lib, 'config', linkerscript_name) # XXX this isn't the right place to do this: adding the Python # library to the link, if needed, should be in the "build_ext" # command. (It's also needed for non-MS compilers on Windows, and # it's taken care of for them by the 'build_ext.get_libraries()' # method.) g['LDSHARED'] = ("%s -L%s/lib -lpython%s" % (linkerscript, PREFIX, sys.version[0:3])) global _config_vars _config_vars = g
375861983f22c05d6b98f28b5759ac2b8806c523 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/375861983f22c05d6b98f28b5759ac2b8806c523/sysconfig.py
return self.getdelimited('[', ']\r', 0)
return '[%s]' % self.getdelimited('[', ']\r', 0)
def getdomainliteral(self): """Parse an RFC-822 domain-literal.""" return self.getdelimited('[', ']\r', 0)
95e3865ba83e2684b8003e48a5a8a2cc9b311974 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/95e3865ba83e2684b8003e48a5a8a2cc9b311974/rfc822.py
def _msgobj(self, filename):
def _msgobj(self, filename, strict=False):
def _msgobj(self, filename): fp = openfile(findfile(filename)) try: msg = email.message_from_file(fp) finally: fp.close() return msg
b36834747c3a469dec3b8cd4b2797d3571eb7537 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b36834747c3a469dec3b8cd4b2797d3571eb7537/test_email.py
msg = email.message_from_file(fp)
msg = email.message_from_file(fp, strict=strict)
def _msgobj(self, filename): fp = openfile(findfile(filename)) try: msg = email.message_from_file(fp) finally: fp.close() return msg
b36834747c3a469dec3b8cd4b2797d3571eb7537 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b36834747c3a469dec3b8cd4b2797d3571eb7537/test_email.py
eq(msg.get_payload(decode=1), None)
eq(msg.get_payload(decode=True), None)
def test_get_decoded_payload(self): eq = self.assertEqual msg = self._msgobj('msg_10.txt') # The outer message is a multipart eq(msg.get_payload(decode=1), None) # Subpart 1 is 7bit encoded eq(msg.get_payload(0).get_payload(decode=1), 'This is a 7bit encoded message.\n') # Subpart 2 is quopri eq(msg.get_payload(1).get_payload(decode=1), '\xa1This is a Quoted Printable encoded message!\n') # Subpart 3 is base64 eq(msg.get_payload(2).get_payload(decode=1), 'This is a Base64 encoded message.') # Subpart 4 has no Content-Transfer-Encoding: header. eq(msg.get_payload(3).get_payload(decode=1), 'This has no Content-Transfer-Encoding: header.\n')
b36834747c3a469dec3b8cd4b2797d3571eb7537 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b36834747c3a469dec3b8cd4b2797d3571eb7537/test_email.py
eq(msg.get_payload(0).get_payload(decode=1),
eq(msg.get_payload(0).get_payload(decode=True),
def test_get_decoded_payload(self): eq = self.assertEqual msg = self._msgobj('msg_10.txt') # The outer message is a multipart eq(msg.get_payload(decode=1), None) # Subpart 1 is 7bit encoded eq(msg.get_payload(0).get_payload(decode=1), 'This is a 7bit encoded message.\n') # Subpart 2 is quopri eq(msg.get_payload(1).get_payload(decode=1), '\xa1This is a Quoted Printable encoded message!\n') # Subpart 3 is base64 eq(msg.get_payload(2).get_payload(decode=1), 'This is a Base64 encoded message.') # Subpart 4 has no Content-Transfer-Encoding: header. eq(msg.get_payload(3).get_payload(decode=1), 'This has no Content-Transfer-Encoding: header.\n')
b36834747c3a469dec3b8cd4b2797d3571eb7537 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b36834747c3a469dec3b8cd4b2797d3571eb7537/test_email.py
eq(msg.get_payload(1).get_payload(decode=1),
eq(msg.get_payload(1).get_payload(decode=True),
def test_get_decoded_payload(self): eq = self.assertEqual msg = self._msgobj('msg_10.txt') # The outer message is a multipart eq(msg.get_payload(decode=1), None) # Subpart 1 is 7bit encoded eq(msg.get_payload(0).get_payload(decode=1), 'This is a 7bit encoded message.\n') # Subpart 2 is quopri eq(msg.get_payload(1).get_payload(decode=1), '\xa1This is a Quoted Printable encoded message!\n') # Subpart 3 is base64 eq(msg.get_payload(2).get_payload(decode=1), 'This is a Base64 encoded message.') # Subpart 4 has no Content-Transfer-Encoding: header. eq(msg.get_payload(3).get_payload(decode=1), 'This has no Content-Transfer-Encoding: header.\n')
b36834747c3a469dec3b8cd4b2797d3571eb7537 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b36834747c3a469dec3b8cd4b2797d3571eb7537/test_email.py
eq(msg.get_payload(2).get_payload(decode=1),
eq(msg.get_payload(2).get_payload(decode=True),
def test_get_decoded_payload(self): eq = self.assertEqual msg = self._msgobj('msg_10.txt') # The outer message is a multipart eq(msg.get_payload(decode=1), None) # Subpart 1 is 7bit encoded eq(msg.get_payload(0).get_payload(decode=1), 'This is a 7bit encoded message.\n') # Subpart 2 is quopri eq(msg.get_payload(1).get_payload(decode=1), '\xa1This is a Quoted Printable encoded message!\n') # Subpart 3 is base64 eq(msg.get_payload(2).get_payload(decode=1), 'This is a Base64 encoded message.') # Subpart 4 has no Content-Transfer-Encoding: header. eq(msg.get_payload(3).get_payload(decode=1), 'This has no Content-Transfer-Encoding: header.\n')
b36834747c3a469dec3b8cd4b2797d3571eb7537 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b36834747c3a469dec3b8cd4b2797d3571eb7537/test_email.py
eq(msg.get_payload(3).get_payload(decode=1),
eq(msg.get_payload(3).get_payload(decode=True),
def test_get_decoded_payload(self): eq = self.assertEqual msg = self._msgobj('msg_10.txt') # The outer message is a multipart eq(msg.get_payload(decode=1), None) # Subpart 1 is 7bit encoded eq(msg.get_payload(0).get_payload(decode=1), 'This is a 7bit encoded message.\n') # Subpart 2 is quopri eq(msg.get_payload(1).get_payload(decode=1), '\xa1This is a Quoted Printable encoded message!\n') # Subpart 3 is base64 eq(msg.get_payload(2).get_payload(decode=1), 'This is a Base64 encoded message.') # Subpart 4 has no Content-Transfer-Encoding: header. eq(msg.get_payload(3).get_payload(decode=1), 'This has no Content-Transfer-Encoding: header.\n')
b36834747c3a469dec3b8cd4b2797d3571eb7537 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b36834747c3a469dec3b8cd4b2797d3571eb7537/test_email.py
eq(msg.get_param('importance', unquote=0), '"high value"')
eq(msg.get_param('importance', unquote=False), '"high value"')
def test_set_param(self): eq = self.assertEqual msg = Message() msg.set_param('charset', 'iso-2022-jp') eq(msg.get_param('charset'), 'iso-2022-jp') msg.set_param('importance', 'high value') eq(msg.get_param('importance'), 'high value') eq(msg.get_param('importance', unquote=0), '"high value"') eq(msg.get_params(), [('text/plain', ''), ('charset', 'iso-2022-jp'), ('importance', 'high value')]) eq(msg.get_params(unquote=0), [('text/plain', ''), ('charset', '"iso-2022-jp"'), ('importance', '"high value"')]) msg.set_param('charset', 'iso-9999-xx', header='X-Jimmy') eq(msg.get_param('charset', header='X-Jimmy'), 'iso-9999-xx')
b36834747c3a469dec3b8cd4b2797d3571eb7537 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b36834747c3a469dec3b8cd4b2797d3571eb7537/test_email.py
eq(msg.get_params(unquote=0), [('text/plain', ''),
eq(msg.get_params(unquote=False), [('text/plain', ''),
def test_set_param(self): eq = self.assertEqual msg = Message() msg.set_param('charset', 'iso-2022-jp') eq(msg.get_param('charset'), 'iso-2022-jp') msg.set_param('importance', 'high value') eq(msg.get_param('importance'), 'high value') eq(msg.get_param('importance', unquote=0), '"high value"') eq(msg.get_params(), [('text/plain', ''), ('charset', 'iso-2022-jp'), ('importance', 'high value')]) eq(msg.get_params(unquote=0), [('text/plain', ''), ('charset', '"iso-2022-jp"'), ('importance', '"high value"')]) msg.set_param('charset', 'iso-9999-xx', header='X-Jimmy') eq(msg.get_param('charset', header='X-Jimmy'), 'iso-9999-xx')
b36834747c3a469dec3b8cd4b2797d3571eb7537 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b36834747c3a469dec3b8cd4b2797d3571eb7537/test_email.py
g = Generator(s, mangle_from_=1)
g = Generator(s, mangle_from_=True)
def test_mangled_from(self): s = StringIO() g = Generator(s, mangle_from_=1) g.flatten(self.msg) self.assertEqual(s.getvalue(), """\
b36834747c3a469dec3b8cd4b2797d3571eb7537 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b36834747c3a469dec3b8cd4b2797d3571eb7537/test_email.py
g = Generator(s, mangle_from_=0)
g = Generator(s, mangle_from_=False)
def test_dont_mangle_from(self): s = StringIO() g = Generator(s, mangle_from_=0) g.flatten(self.msg) self.assertEqual(s.getvalue(), """\
b36834747c3a469dec3b8cd4b2797d3571eb7537 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b36834747c3a469dec3b8cd4b2797d3571eb7537/test_email.py
p = Parser(strict=1)
p = Parser(strict=True)
def test_bogus_boundary(self): fp = openfile(findfile('msg_15.txt')) try: data = fp.read() finally: fp.close() p = Parser(strict=1) # Note, under a future non-strict parsing mode, this would parse the # message into the intended message tree. self.assertRaises(Errors.BoundaryError, p.parsestr, data)
b36834747c3a469dec3b8cd4b2797d3571eb7537 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b36834747c3a469dec3b8cd4b2797d3571eb7537/test_email.py
Utils.parsedate(Utils.formatdate(now, localtime=1))[:6],
Utils.parsedate(Utils.formatdate(now, localtime=True))[:6],
def test_formatdate_localtime(self): now = time.time() self.assertEqual( Utils.parsedate(Utils.formatdate(now, localtime=1))[:6], time.localtime(now)[:6])
b36834747c3a469dec3b8cd4b2797d3571eb7537 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b36834747c3a469dec3b8cd4b2797d3571eb7537/test_email.py
eq(he('hello\nworld', keep_eols=1),
eq(he('hello\nworld', keep_eols=True),
def test_header_encode(self): eq = self.assertEqual he = base64MIME.header_encode eq(he('hello'), '=?iso-8859-1?b?aGVsbG8=?=') eq(he('hello\nworld'), '=?iso-8859-1?b?aGVsbG8NCndvcmxk?=') # Test the charset option eq(he('hello', charset='iso-8859-2'), '=?iso-8859-2?b?aGVsbG8=?=') # Test the keep_eols flag eq(he('hello\nworld', keep_eols=1), '=?iso-8859-1?b?aGVsbG8Kd29ybGQ=?=') # Test the maxlinelen argument eq(he('xxxx ' * 20, maxlinelen=40), """\
b36834747c3a469dec3b8cd4b2797d3571eb7537 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b36834747c3a469dec3b8cd4b2797d3571eb7537/test_email.py
eq(he('hello\nworld', keep_eols=1), '=?iso-8859-1?q?hello=0Aworld?=')
eq(he('hello\nworld', keep_eols=True), '=?iso-8859-1?q?hello=0Aworld?=')
def test_header_encode(self): eq = self.assertEqual he = quopriMIME.header_encode eq(he('hello'), '=?iso-8859-1?q?hello?=') eq(he('hello\nworld'), '=?iso-8859-1?q?hello=0D=0Aworld?=') # Test the charset option eq(he('hello', charset='iso-8859-2'), '=?iso-8859-2?q?hello?=') # Test the keep_eols flag eq(he('hello\nworld', keep_eols=1), '=?iso-8859-1?q?hello=0Aworld?=') # Test a non-ASCII character eq(he('hello\xc7there'), '=?iso-8859-1?q?hello=C7there?=') # Test the maxlinelen argument eq(he('xxxx ' * 20, maxlinelen=40), """\
b36834747c3a469dec3b8cd4b2797d3571eb7537 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b36834747c3a469dec3b8cd4b2797d3571eb7537/test_email.py
eq(msg.get_param('title', unquote=0),
eq(msg.get_param('title', unquote=False),
def test_get_param(self): eq = self.assertEqual msg = self._msgobj('msg_29.txt') eq(msg.get_param('title'), ('us-ascii', 'en', 'This is even more ***fun*** isn\'t it!')) eq(msg.get_param('title', unquote=0), ('us-ascii', 'en', '"This is even more ***fun*** isn\'t it!"'))
b36834747c3a469dec3b8cd4b2797d3571eb7537 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b36834747c3a469dec3b8cd4b2797d3571eb7537/test_email.py
if type(self.__optiondb) <> DictType:
if not isinstance(self.__optiondb, DictType):
def __init__(self, initfile): self.__initfile = initfile self.__colordb = None self.__optiondb = {} self.__views = [] self.__red = 0 self.__green = 0 self.__blue = 0 self.__canceled = 0 # read the initialization file fp = None if initfile: try: try: fp = open(initfile) self.__optiondb = marshal.load(fp) if type(self.__optiondb) <> DictType: print >> sys.stderr, \ 'Problem reading options from file:', initfile self.__optiondb = {} except (IOError, EOFError, ValueError): pass finally: if fp: fp.close()
320e09a4f338604823e0527621f6f5127d9d994b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/320e09a4f338604823e0527621f6f5127d9d994b/Switchboard.py
def NodeList(): return []
190052b779b7543367444194a1c4243f94187b59 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/190052b779b7543367444194a1c4243f94187b59/minidom.py
return _getElementsByTagNameHelper(self, name, [])
return _getElementsByTagNameHelper(self, name, NodeList())
def getElementsByTagName(self, name): return _getElementsByTagNameHelper(self, name, [])
190052b779b7543367444194a1c4243f94187b59 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/190052b779b7543367444194a1c4243f94187b59/minidom.py
return _getElementsByTagNameNSHelper(self, namespaceURI, localName, [])
return _getElementsByTagNameNSHelper(self, namespaceURI, localName, NodeList())
def getElementsByTagNameNS(self, namespaceURI, localName): return _getElementsByTagNameNSHelper(self, namespaceURI, localName, [])
190052b779b7543367444194a1c4243f94187b59 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/190052b779b7543367444194a1c4243f94187b59/minidom.py
return _getElementsByTagNameHelper(self, name, [])
return _getElementsByTagNameHelper(self, name, NodeList())
def getElementsByTagName(self, name): return _getElementsByTagNameHelper(self, name, [])
190052b779b7543367444194a1c4243f94187b59 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/190052b779b7543367444194a1c4243f94187b59/minidom.py
return _getElementsByTagNameNSHelper(self, namespaceURI, localName, [])
return _getElementsByTagNameNSHelper(self, namespaceURI, localName, NodeList())
def getElementsByTagNameNS(self, namespaceURI, localName): return _getElementsByTagNameNSHelper(self, namespaceURI, localName, [])
190052b779b7543367444194a1c4243f94187b59 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/190052b779b7543367444194a1c4243f94187b59/minidom.py
def open_https(self, url):
def open_https(self, url, data=None):
def open_https(self, url): """Use HTTPS protocol.""" import httplib if type(url) is type(""): host, selector = splithost(url) user_passwd, host = splituser(host) else: host, selector = url urltype, rest = splittype(selector) if string.lower(urltype) == 'https': realhost, rest = splithost(rest) user_passwd, realhost = splituser(realhost) if user_passwd: selector = "%s://%s%s" % (urltype, realhost, rest) print "proxy via https:", host, selector if not host: raise IOError, ('https error', 'no host given') if user_passwd: import base64 auth = string.strip(base64.encodestring(user_passwd)) else: auth = None h = httplib.HTTPS(host, 0, key_file=self.key_file, cert_file=self.cert_file) h.putrequest('GET', selector) if auth: h.putheader('Authorization: Basic %s' % auth) for args in self.addheaders: apply(h.putheader, args) h.endheaders() errcode, errmsg, headers = h.getreply() fp = h.getfile() if errcode == 200: return addinfourl(fp, headers, url) else: return self.http_error(url, fp, errcode, errmsg, headers)
c67a9688e05efa1e44af68ff854c3feeb12fa68b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c67a9688e05efa1e44af68ff854c3feeb12fa68b/urllib.py
h.putrequest('GET', selector)
if data is not None: h.putrequest('POST', selector) h.putheader('Content-type', 'application/x-www-form-urlencoded') h.putheader('Content-length', '%d' % len(data)) else: h.putrequest('GET', selector)
def open_https(self, url): """Use HTTPS protocol.""" import httplib if type(url) is type(""): host, selector = splithost(url) user_passwd, host = splituser(host) else: host, selector = url urltype, rest = splittype(selector) if string.lower(urltype) == 'https': realhost, rest = splithost(rest) user_passwd, realhost = splituser(realhost) if user_passwd: selector = "%s://%s%s" % (urltype, realhost, rest) print "proxy via https:", host, selector if not host: raise IOError, ('https error', 'no host given') if user_passwd: import base64 auth = string.strip(base64.encodestring(user_passwd)) else: auth = None h = httplib.HTTPS(host, 0, key_file=self.key_file, cert_file=self.cert_file) h.putrequest('GET', selector) if auth: h.putheader('Authorization: Basic %s' % auth) for args in self.addheaders: apply(h.putheader, args) h.endheaders() errcode, errmsg, headers = h.getreply() fp = h.getfile() if errcode == 200: return addinfourl(fp, headers, url) else: return self.http_error(url, fp, errcode, errmsg, headers)
c67a9688e05efa1e44af68ff854c3feeb12fa68b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c67a9688e05efa1e44af68ff854c3feeb12fa68b/urllib.py
import string str = '' email = '' comment = ''
token = [] tokens = []
def parseaddr(address): import string str = '' email = '' comment = '' backslash = 0 dquote = 0 space = 0 paren = 0 bracket = 0 seen_bracket = 0 for c in address: if backslash: str = str + c backslash = 0 continue if c == '\\': backslash = 1 continue if dquote: if c == '"': dquote = 0 else: str = str + c continue if c == '"': dquote = 1 continue if c in string.whitespace: space = 1 continue if space: str = str + ' ' space = 0 if paren: if c == '(': paren = paren + 1 str = str + c continue if c == ')': paren = paren - 1 if paren == 0: comment = comment + str str = '' continue if c == '(': paren = paren + 1 if bracket: email = email + str str = '' elif not seen_bracket: email = email + str str = '' continue if bracket: if c == '>': bracket = 0 email = email + str str = '' continue if c == '<': bracket = 1 seen_bracket = 1 comment = comment + str str = '' email = '' continue if c == '#' and not bracket and not paren: # rest is comment break str = str + c if str: if seen_bracket: if bracket: email = str else: comment = comment + str else: if paren: comment = comment + str else: email = email + str return string.strip(comment), string.strip(email)
4fc35f6fe9840dd900330fa5e979466e53ea44e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4fc35f6fe9840dd900330fa5e979466e53ea44e5/rfc822.py
bracket = 0 seen_bracket = 0
def parseaddr(address): import string str = '' email = '' comment = '' backslash = 0 dquote = 0 space = 0 paren = 0 bracket = 0 seen_bracket = 0 for c in address: if backslash: str = str + c backslash = 0 continue if c == '\\': backslash = 1 continue if dquote: if c == '"': dquote = 0 else: str = str + c continue if c == '"': dquote = 1 continue if c in string.whitespace: space = 1 continue if space: str = str + ' ' space = 0 if paren: if c == '(': paren = paren + 1 str = str + c continue if c == ')': paren = paren - 1 if paren == 0: comment = comment + str str = '' continue if c == '(': paren = paren + 1 if bracket: email = email + str str = '' elif not seen_bracket: email = email + str str = '' continue if bracket: if c == '>': bracket = 0 email = email + str str = '' continue if c == '<': bracket = 1 seen_bracket = 1 comment = comment + str str = '' email = '' continue if c == '#' and not bracket and not paren: # rest is comment break str = str + c if str: if seen_bracket: if bracket: email = str else: comment = comment + str else: if paren: comment = comment + str else: email = email + str return string.strip(comment), string.strip(email)
4fc35f6fe9840dd900330fa5e979466e53ea44e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4fc35f6fe9840dd900330fa5e979466e53ea44e5/rfc822.py
str = str + c
token.append(c)
def parseaddr(address): import string str = '' email = '' comment = '' backslash = 0 dquote = 0 space = 0 paren = 0 bracket = 0 seen_bracket = 0 for c in address: if backslash: str = str + c backslash = 0 continue if c == '\\': backslash = 1 continue if dquote: if c == '"': dquote = 0 else: str = str + c continue if c == '"': dquote = 1 continue if c in string.whitespace: space = 1 continue if space: str = str + ' ' space = 0 if paren: if c == '(': paren = paren + 1 str = str + c continue if c == ')': paren = paren - 1 if paren == 0: comment = comment + str str = '' continue if c == '(': paren = paren + 1 if bracket: email = email + str str = '' elif not seen_bracket: email = email + str str = '' continue if bracket: if c == '>': bracket = 0 email = email + str str = '' continue if c == '<': bracket = 1 seen_bracket = 1 comment = comment + str str = '' email = '' continue if c == '#' and not bracket and not paren: # rest is comment break str = str + c if str: if seen_bracket: if bracket: email = str else: comment = comment + str else: if paren: comment = comment + str else: email = email + str return string.strip(comment), string.strip(email)
4fc35f6fe9840dd900330fa5e979466e53ea44e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4fc35f6fe9840dd900330fa5e979466e53ea44e5/rfc822.py
continue
def parseaddr(address): import string str = '' email = '' comment = '' backslash = 0 dquote = 0 space = 0 paren = 0 bracket = 0 seen_bracket = 0 for c in address: if backslash: str = str + c backslash = 0 continue if c == '\\': backslash = 1 continue if dquote: if c == '"': dquote = 0 else: str = str + c continue if c == '"': dquote = 1 continue if c in string.whitespace: space = 1 continue if space: str = str + ' ' space = 0 if paren: if c == '(': paren = paren + 1 str = str + c continue if c == ')': paren = paren - 1 if paren == 0: comment = comment + str str = '' continue if c == '(': paren = paren + 1 if bracket: email = email + str str = '' elif not seen_bracket: email = email + str str = '' continue if bracket: if c == '>': bracket = 0 email = email + str str = '' continue if c == '<': bracket = 1 seen_bracket = 1 comment = comment + str str = '' email = '' continue if c == '#' and not bracket and not paren: # rest is comment break str = str + c if str: if seen_bracket: if bracket: email = str else: comment = comment + str else: if paren: comment = comment + str else: email = email + str return string.strip(comment), string.strip(email)
4fc35f6fe9840dd900330fa5e979466e53ea44e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4fc35f6fe9840dd900330fa5e979466e53ea44e5/rfc822.py
str = str + c
token.append(c)
def parseaddr(address): import string str = '' email = '' comment = '' backslash = 0 dquote = 0 space = 0 paren = 0 bracket = 0 seen_bracket = 0 for c in address: if backslash: str = str + c backslash = 0 continue if c == '\\': backslash = 1 continue if dquote: if c == '"': dquote = 0 else: str = str + c continue if c == '"': dquote = 1 continue if c in string.whitespace: space = 1 continue if space: str = str + ' ' space = 0 if paren: if c == '(': paren = paren + 1 str = str + c continue if c == ')': paren = paren - 1 if paren == 0: comment = comment + str str = '' continue if c == '(': paren = paren + 1 if bracket: email = email + str str = '' elif not seen_bracket: email = email + str str = '' continue if bracket: if c == '>': bracket = 0 email = email + str str = '' continue if c == '<': bracket = 1 seen_bracket = 1 comment = comment + str str = '' email = '' continue if c == '#' and not bracket and not paren: # rest is comment break str = str + c if str: if seen_bracket: if bracket: email = str else: comment = comment + str else: if paren: comment = comment + str else: email = email + str return string.strip(comment), string.strip(email)
4fc35f6fe9840dd900330fa5e979466e53ea44e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4fc35f6fe9840dd900330fa5e979466e53ea44e5/rfc822.py
continue if c in string.whitespace: space = 1 continue if space: str = str + ' ' space = 0
was_quoted = 1 continue
def parseaddr(address): import string str = '' email = '' comment = '' backslash = 0 dquote = 0 space = 0 paren = 0 bracket = 0 seen_bracket = 0 for c in address: if backslash: str = str + c backslash = 0 continue if c == '\\': backslash = 1 continue if dquote: if c == '"': dquote = 0 else: str = str + c continue if c == '"': dquote = 1 continue if c in string.whitespace: space = 1 continue if space: str = str + ' ' space = 0 if paren: if c == '(': paren = paren + 1 str = str + c continue if c == ')': paren = paren - 1 if paren == 0: comment = comment + str str = '' continue if c == '(': paren = paren + 1 if bracket: email = email + str str = '' elif not seen_bracket: email = email + str str = '' continue if bracket: if c == '>': bracket = 0 email = email + str str = '' continue if c == '<': bracket = 1 seen_bracket = 1 comment = comment + str str = '' email = '' continue if c == '#' and not bracket and not paren: # rest is comment break str = str + c if str: if seen_bracket: if bracket: email = str else: comment = comment + str else: if paren: comment = comment + str else: email = email + str return string.strip(comment), string.strip(email)
4fc35f6fe9840dd900330fa5e979466e53ea44e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4fc35f6fe9840dd900330fa5e979466e53ea44e5/rfc822.py
str = str + c continue if c == ')':
elif c == ')':
def parseaddr(address): import string str = '' email = '' comment = '' backslash = 0 dquote = 0 space = 0 paren = 0 bracket = 0 seen_bracket = 0 for c in address: if backslash: str = str + c backslash = 0 continue if c == '\\': backslash = 1 continue if dquote: if c == '"': dquote = 0 else: str = str + c continue if c == '"': dquote = 1 continue if c in string.whitespace: space = 1 continue if space: str = str + ' ' space = 0 if paren: if c == '(': paren = paren + 1 str = str + c continue if c == ')': paren = paren - 1 if paren == 0: comment = comment + str str = '' continue if c == '(': paren = paren + 1 if bracket: email = email + str str = '' elif not seen_bracket: email = email + str str = '' continue if bracket: if c == '>': bracket = 0 email = email + str str = '' continue if c == '<': bracket = 1 seen_bracket = 1 comment = comment + str str = '' email = '' continue if c == '#' and not bracket and not paren: # rest is comment break str = str + c if str: if seen_bracket: if bracket: email = str else: comment = comment + str else: if paren: comment = comment + str else: email = email + str return string.strip(comment), string.strip(email)
4fc35f6fe9840dd900330fa5e979466e53ea44e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4fc35f6fe9840dd900330fa5e979466e53ea44e5/rfc822.py
comment = comment + str str = ''
token = string.join(token, '') tokens.append((2, token)) token = []
def parseaddr(address): import string str = '' email = '' comment = '' backslash = 0 dquote = 0 space = 0 paren = 0 bracket = 0 seen_bracket = 0 for c in address: if backslash: str = str + c backslash = 0 continue if c == '\\': backslash = 1 continue if dquote: if c == '"': dquote = 0 else: str = str + c continue if c == '"': dquote = 1 continue if c in string.whitespace: space = 1 continue if space: str = str + ' ' space = 0 if paren: if c == '(': paren = paren + 1 str = str + c continue if c == ')': paren = paren - 1 if paren == 0: comment = comment + str str = '' continue if c == '(': paren = paren + 1 if bracket: email = email + str str = '' elif not seen_bracket: email = email + str str = '' continue if bracket: if c == '>': bracket = 0 email = email + str str = '' continue if c == '<': bracket = 1 seen_bracket = 1 comment = comment + str str = '' email = '' continue if c == '#' and not bracket and not paren: # rest is comment break str = str + c if str: if seen_bracket: if bracket: email = str else: comment = comment + str else: if paren: comment = comment + str else: email = email + str return string.strip(comment), string.strip(email)
4fc35f6fe9840dd900330fa5e979466e53ea44e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4fc35f6fe9840dd900330fa5e979466e53ea44e5/rfc822.py
paren = paren + 1 if bracket: email = email + str str = '' elif not seen_bracket: email = email + str str = '' continue if bracket: if c == '>': bracket = 0 email = email + str str = ''
paren = 1 token = string.join(token, '') tokens.append((was_quoted, token)) was_quoted = 0 token = [] continue if c in string.whitespace: space = 1 continue if c in '<>@,;:.[]': token = string.join(token, '') tokens.append((was_quoted, token)) was_quoted = 0 token = [] tokens.append((0, c)) space = 0 continue if space: token = string.join(token, '') tokens.append((was_quoted, token)) was_quoted = 0 token = [] space = 0 token.append(c) token = string.join(token, '') tokens.append((was_quoted, token)) if (0, '<') in tokens: name = [] addr = [] cur = name for token in tokens: if token[1] == '':
def parseaddr(address): import string str = '' email = '' comment = '' backslash = 0 dquote = 0 space = 0 paren = 0 bracket = 0 seen_bracket = 0 for c in address: if backslash: str = str + c backslash = 0 continue if c == '\\': backslash = 1 continue if dquote: if c == '"': dquote = 0 else: str = str + c continue if c == '"': dquote = 1 continue if c in string.whitespace: space = 1 continue if space: str = str + ' ' space = 0 if paren: if c == '(': paren = paren + 1 str = str + c continue if c == ')': paren = paren - 1 if paren == 0: comment = comment + str str = '' continue if c == '(': paren = paren + 1 if bracket: email = email + str str = '' elif not seen_bracket: email = email + str str = '' continue if bracket: if c == '>': bracket = 0 email = email + str str = '' continue if c == '<': bracket = 1 seen_bracket = 1 comment = comment + str str = '' email = '' continue if c == '#' and not bracket and not paren: # rest is comment break str = str + c if str: if seen_bracket: if bracket: email = str else: comment = comment + str else: if paren: comment = comment + str else: email = email + str return string.strip(comment), string.strip(email)
4fc35f6fe9840dd900330fa5e979466e53ea44e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4fc35f6fe9840dd900330fa5e979466e53ea44e5/rfc822.py
if c == '<': bracket = 1 seen_bracket = 1 comment = comment + str str = '' email = '' continue if c == ' break str = str + c if str: if seen_bracket: if bracket: email = str
if token == (0, '<'): if addr: raise error, 'syntax error' cur = addr elif token == (0, '>'): if cur is not addr: raise error, 'syntax error' cur = name elif token[0] == 2: if cur is name: name.append('(' + token[1] + ')') else: name.append(token[1]) elif token[0] == 1 and cur is addr: if specials.search(token[1]) >= 0: cur.append(quote(token[1])) else: cur.append(token[1])
def parseaddr(address): import string str = '' email = '' comment = '' backslash = 0 dquote = 0 space = 0 paren = 0 bracket = 0 seen_bracket = 0 for c in address: if backslash: str = str + c backslash = 0 continue if c == '\\': backslash = 1 continue if dquote: if c == '"': dquote = 0 else: str = str + c continue if c == '"': dquote = 1 continue if c in string.whitespace: space = 1 continue if space: str = str + ' ' space = 0 if paren: if c == '(': paren = paren + 1 str = str + c continue if c == ')': paren = paren - 1 if paren == 0: comment = comment + str str = '' continue if c == '(': paren = paren + 1 if bracket: email = email + str str = '' elif not seen_bracket: email = email + str str = '' continue if bracket: if c == '>': bracket = 0 email = email + str str = '' continue if c == '<': bracket = 1 seen_bracket = 1 comment = comment + str str = '' email = '' continue if c == '#' and not bracket and not paren: # rest is comment break str = str + c if str: if seen_bracket: if bracket: email = str else: comment = comment + str else: if paren: comment = comment + str else: email = email + str return string.strip(comment), string.strip(email)
4fc35f6fe9840dd900330fa5e979466e53ea44e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4fc35f6fe9840dd900330fa5e979466e53ea44e5/rfc822.py
comment = comment + str else: if paren: comment = comment + str
cur.append(token[1]) else: name = [] addr = [] for token in tokens: if token[1] == '': continue if token[0] == 2: name.append(token[1]) elif token[0] == 1: if specials.search(token[1]) >= 0: addr.append(quote(token[1])) else: addr.append(token[1])
def parseaddr(address): import string str = '' email = '' comment = '' backslash = 0 dquote = 0 space = 0 paren = 0 bracket = 0 seen_bracket = 0 for c in address: if backslash: str = str + c backslash = 0 continue if c == '\\': backslash = 1 continue if dquote: if c == '"': dquote = 0 else: str = str + c continue if c == '"': dquote = 1 continue if c in string.whitespace: space = 1 continue if space: str = str + ' ' space = 0 if paren: if c == '(': paren = paren + 1 str = str + c continue if c == ')': paren = paren - 1 if paren == 0: comment = comment + str str = '' continue if c == '(': paren = paren + 1 if bracket: email = email + str str = '' elif not seen_bracket: email = email + str str = '' continue if bracket: if c == '>': bracket = 0 email = email + str str = '' continue if c == '<': bracket = 1 seen_bracket = 1 comment = comment + str str = '' email = '' continue if c == '#' and not bracket and not paren: # rest is comment break str = str + c if str: if seen_bracket: if bracket: email = str else: comment = comment + str else: if paren: comment = comment + str else: email = email + str return string.strip(comment), string.strip(email)
4fc35f6fe9840dd900330fa5e979466e53ea44e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4fc35f6fe9840dd900330fa5e979466e53ea44e5/rfc822.py
email = email + str return string.strip(comment), string.strip(email)
addr.append(token[1]) return string.join(name, ' '), string.join(addr, '')
def parseaddr(address): import string str = '' email = '' comment = '' backslash = 0 dquote = 0 space = 0 paren = 0 bracket = 0 seen_bracket = 0 for c in address: if backslash: str = str + c backslash = 0 continue if c == '\\': backslash = 1 continue if dquote: if c == '"': dquote = 0 else: str = str + c continue if c == '"': dquote = 1 continue if c in string.whitespace: space = 1 continue if space: str = str + ' ' space = 0 if paren: if c == '(': paren = paren + 1 str = str + c continue if c == ')': paren = paren - 1 if paren == 0: comment = comment + str str = '' continue if c == '(': paren = paren + 1 if bracket: email = email + str str = '' elif not seen_bracket: email = email + str str = '' continue if bracket: if c == '>': bracket = 0 email = email + str str = '' continue if c == '<': bracket = 1 seen_bracket = 1 comment = comment + str str = '' email = '' continue if c == '#' and not bracket and not paren: # rest is comment break str = str + c if str: if seen_bracket: if bracket: email = str else: comment = comment + str else: if paren: comment = comment + str else: email = email + str return string.strip(comment), string.strip(email)
4fc35f6fe9840dd900330fa5e979466e53ea44e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4fc35f6fe9840dd900330fa5e979466e53ea44e5/rfc822.py
r = (24 - currentHour) * 60 * 60 r = r + (59 - currentMinute) * 60 r = r + (59 - currentSecond)
if (currentMinute == 0) and (currentSecond == 0): r = (24 - currentHour) * 60 * 60 else: r = (23 - currentHour) * 60 * 60 r = r + (59 - currentMinute) * 60 r = r + (60 - currentSecond)
def __init__(self, filename, when='h', interval=1, backupCount=0, encoding=None): BaseRotatingHandler.__init__(self, filename, 'a', encoding) self.when = string.upper(when) self.backupCount = backupCount # Calculate the real rollover interval, which is just the number of # seconds between rollovers. Also set the filename suffix used when # a rollover occurs. Current 'when' events supported: # S - Seconds # M - Minutes # H - Hours # D - Days # midnight - roll over at midnight # W{0-6} - roll over on a certain day; 0 - Monday # # Case of the 'when' specifier is not important; lower or upper case # will work. currentTime = int(time.time()) if self.when == 'S': self.interval = 1 # one second self.suffix = "%Y-%m-%d_%H-%M-%S" elif self.when == 'M': self.interval = 60 # one minute self.suffix = "%Y-%m-%d_%H-%M" elif self.when == 'H': self.interval = 60 * 60 # one hour self.suffix = "%Y-%m-%d_%H" elif self.when == 'D' or self.when == 'MIDNIGHT': self.interval = 60 * 60 * 24 # one day self.suffix = "%Y-%m-%d" elif self.when.startswith('W'): self.interval = 60 * 60 * 24 * 7 # one week if len(self.when) != 2: raise ValueError("You must specify a day for weekly rollover from 0 to 6 (0 is Monday): %s" % self.when) if self.when[1] < '0' or self.when[1] > '6': raise ValueError("Invalid day specified for weekly rollover: %s" % self.when) self.dayOfWeek = int(self.when[1]) self.suffix = "%Y-%m-%d" else: raise ValueError("Invalid rollover interval specified: %s" % self.when)
8d9928ff6aabf72d951ee643d79ceb3829fb3533 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8d9928ff6aabf72d951ee643d79ceb3829fb3533/handlers.py
def get(self, section, option, raw=0):
def get(self, section, option, raw=0, vars=None):
def get(self, section, option, raw=0): """Get an option value for a given section.
3f9250cbcdfb86bfe4349b5aa09a3ebbda7fedf6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/3f9250cbcdfb86bfe4349b5aa09a3ebbda7fedf6/ConfigParser.py
argument `raw' is true.
argument `raw' is true. Additional substitutions may be provided using the vars keyword argument, which override any pre-existing defaults.
def get(self, section, option, raw=0): """Get an option value for a given section.
3f9250cbcdfb86bfe4349b5aa09a3ebbda7fedf6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/3f9250cbcdfb86bfe4349b5aa09a3ebbda7fedf6/ConfigParser.py