rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
l = [1L, 2L, 3L, 4L, 5L] * (size // 5)
l = [1L, 2L, 3L, 4L, 5L] * size size *= 5
def test_index(self, size): l = [1L, 2L, 3L, 4L, 5L] * (size // 5) self.assertEquals(l.index(1), 0) self.assertEquals(l.index(5, size - 5), size - 1) self.assertEquals(l.index(5, size - 5, size), size - 1) self.assertRaises(ValueError, l.index, 1, size - 4, size) self.assertRaises(ValueError, l.index, 6L)
58ac820523228252b5516333377d351fed0a2095 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/58ac820523228252b5516333377d351fed0a2095/test_bigmem.py
@bigmemtest(minsize=_2G + 20, memuse=8)
@bigmemtest(minsize=_2G // 5 + 4, memuse=8 * 5)
def test_insert(self, size): l = [1.0] * size l.insert(size - 1, "A") size += 1 self.assertEquals(len(l), size) self.assertEquals(l[-3:], [1.0, "A", 1.0])
58ac820523228252b5516333377d351fed0a2095 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/58ac820523228252b5516333377d351fed0a2095/test_bigmem.py
l = [u"a", u"b", u"c", u"d", u"e"] * (size // 5)
l = [u"a", u"b", u"c", u"d", u"e"] * size size *= 5
def test_pop(self, size): l = [u"a", u"b", u"c", u"d", u"e"] * (size // 5) self.assertEquals(len(l), size)
58ac820523228252b5516333377d351fed0a2095 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/58ac820523228252b5516333377d351fed0a2095/test_bigmem.py
@bigmemtest(minsize=_2G + 10, memuse=8)
@bigmemtest(minsize=_2G // 5 + 2, memuse=8 * 5)
def test_remove(self, size): l = [10] * size self.assertEquals(len(l), size)
58ac820523228252b5516333377d351fed0a2095 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/58ac820523228252b5516333377d351fed0a2095/test_bigmem.py
l = [1, 2, 3, 4, 5] * (size // 5)
l = [1, 2, 3, 4, 5] * size
def test_reverse(self, size): l = [1, 2, 3, 4, 5] * (size // 5) l.reverse() self.assertEquals(len(l), size) self.assertEquals(l[-5:], [5, 4, 3, 2, 1]) self.assertEquals(l[:5], [5, 4, 3, 2, 1])
58ac820523228252b5516333377d351fed0a2095 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/58ac820523228252b5516333377d351fed0a2095/test_bigmem.py
self.assertEquals(len(l), size)
self.assertEquals(len(l), size * 5)
def test_reverse(self, size): l = [1, 2, 3, 4, 5] * (size // 5) l.reverse() self.assertEquals(len(l), size) self.assertEquals(l[-5:], [5, 4, 3, 2, 1]) self.assertEquals(l[:5], [5, 4, 3, 2, 1])
58ac820523228252b5516333377d351fed0a2095 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/58ac820523228252b5516333377d351fed0a2095/test_bigmem.py
@bigmemtest(minsize=_2G + 10, memuse=8)
@bigmemtest(minsize=_2G // 5 + 2, memuse=8 * 5)
def test_reverse(self, size): l = [1, 2, 3, 4, 5] * (size // 5) l.reverse() self.assertEquals(len(l), size) self.assertEquals(l[-5:], [5, 4, 3, 2, 1]) self.assertEquals(l[:5], [5, 4, 3, 2, 1])
58ac820523228252b5516333377d351fed0a2095 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/58ac820523228252b5516333377d351fed0a2095/test_bigmem.py
l = [1, 2, 3, 4, 5] * (size // 5)
l = [1, 2, 3, 4, 5] * size
def test_sort(self, size): l = [1, 2, 3, 4, 5] * (size // 5) l.sort() self.assertEquals(len(l), size) self.assertEquals(l.count(1), size // 5) self.assertEquals(l[:10], [1] * 10) self.assertEquals(l[-10:], [5] * 10)
58ac820523228252b5516333377d351fed0a2095 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/58ac820523228252b5516333377d351fed0a2095/test_bigmem.py
self.assertEquals(len(l), size) self.assertEquals(l.count(1), size // 5)
self.assertEquals(len(l), size * 5) self.assertEquals(l.count(1), size)
def test_sort(self, size): l = [1, 2, 3, 4, 5] * (size // 5) l.sort() self.assertEquals(len(l), size) self.assertEquals(l.count(1), size // 5) self.assertEquals(l[:10], [1] * 10) self.assertEquals(l[-10:], [5] * 10)
58ac820523228252b5516333377d351fed0a2095 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/58ac820523228252b5516333377d351fed0a2095/test_bigmem.py
_userprog = re.compile('^([^@]*)@(.*)$')
_userprog = re.compile('^(.*)@(.*)$')
def splituser(host): """splituser('user[:passwd]@host[:port]') --> 'user[:passwd]', 'host[:port]'.""" global _userprog if _userprog is None: import re _userprog = re.compile('^([^@]*)@(.*)$') match = _userprog.match(host) if match: return map(unquote, match.group(1, 2)) return None, host
f2e45dd9dde5fa45afeb2bb42660a5a1a2d199d5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f2e45dd9dde5fa45afeb2bb42660a5a1a2d199d5/urllib.py
return None
return False
def begin(self): self.resetoutput() if use_subprocess: nosub = '' client = self.interp.start_subprocess() if not client: self.close() return None else: nosub = "==== No Subprocess ====" self.write("Python %s on %s\n%s\n%s\nIDLE %s %s\n" % (sys.version, sys.platform, self.COPYRIGHT, self.firewallmessage, idlever.IDLE_VERSION, nosub)) self.showprompt() import Tkinter Tkinter._default_root = None # 03Jan04 KBK What's this? return client
7663729ec72f5ffe44b8e7f76bdb56d8663c5e6e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7663729ec72f5ffe44b8e7f76bdb56d8663c5e6e/PyShell.py
return client
return True
def begin(self): self.resetoutput() if use_subprocess: nosub = '' client = self.interp.start_subprocess() if not client: self.close() return None else: nosub = "==== No Subprocess ====" self.write("Python %s on %s\n%s\n%s\nIDLE %s %s\n" % (sys.version, sys.platform, self.COPYRIGHT, self.firewallmessage, idlever.IDLE_VERSION, nosub)) self.showprompt() import Tkinter Tkinter._default_root = None # 03Jan04 KBK What's this? return client
7663729ec72f5ffe44b8e7f76bdb56d8663c5e6e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7663729ec72f5ffe44b8e7f76bdb56d8663c5e6e/PyShell.py
gotone, evt = Evt.WaitNextEvent(-1, 0)
gotone, evt = Evt.WaitNextEvent(0xffff, 0)
def main(): print 'hello world' # XXXX # skip the toolbox initializations, already done # XXXX Should use gestalt here to check for quicktime version Qt.EnterMovies() # Get the movie file fss, ok = macfs.StandardGetFile(QuickTime.MovieFileType) if not ok: sys.exit(0) # Open the window bounds = (175, 75, 175+160, 75+120) theWindow = Win.NewCWindow(bounds, fss.as_tuple()[2], 0, 0, -1, 1, 0) # XXXX Needed? SetGWorld((CGrafPtr)theWindow, nil) Qd.SetPort(theWindow) # Get the movie theMovie = loadMovie(fss) # Relocate to (0, 0) bounds = theMovie.GetMovieBox() bounds = 0, 0, bounds[2]-bounds[0], bounds[3]-bounds[1] theMovie.SetMovieBox(bounds) # Create a controller theController = theMovie.NewMovieController(bounds, QuickTime.mcTopLeftMovie) # Get movie size and update window parameters rv, bounds = theController.MCGetControllerBoundsRect() theWindow.SizeWindow(bounds[2], bounds[3], 0) # XXXX or [3] [2]? Qt.AlignWindow(theWindow, 0) theWindow.ShowWindow() # XXXX MCDoAction(theController, mcActionSetGrowBoxBounds, &maxBounds) theController.MCDoAction(QuickTime.mcActionSetKeysEnabled, '1') # XXXX MCSetActionFilterWithRefCon(theController, movieControllerEventFilter, (long)theWindow) done = 0 while not done: gotone, evt = Evt.WaitNextEvent(-1, 0) (what, message, when, where, modifiers) = evt
19f273c7b6e7c7e7b1911518fdfc1fcba9fefd30 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/19f273c7b6e7c7e7b1911518fdfc1fcba9fefd30/VerySimplePlayer.py
def basename(s): return split(s)[1]
03c06ee7fc62512c4b2af0ed3c57a09128f4b2ce /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/03c06ee7fc62512c4b2af0ed3c57a09128f4b2ce/macpath.py
n = m[:] for i in range(len(n)): n[i] = n[i].split(os.sep) if os.altsep and len(n[i]) == 1: n[i] = n[i].split(os.altsep) prefix = n[0] for item in n:
prefix = m[0] for item in m:
def commonprefix(m): "Given a list of pathnames, returns the longest common leading component" if not m: return '' n = m[:] for i in range(len(n)): n[i] = n[i].split(os.sep) # if os.sep didn't have any effect, try os.altsep if os.altsep and len(n[i]) == 1: n[i] = n[i].split(os.altsep) prefix = n[0] for item in n: for i in range(len(prefix)): if prefix[:i+1] <> item[:i+1]: prefix = prefix[:i] if i == 0: return '' break return os.sep.join(prefix)
03c06ee7fc62512c4b2af0ed3c57a09128f4b2ce /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/03c06ee7fc62512c4b2af0ed3c57a09128f4b2ce/macpath.py
return os.sep.join(prefix) def isdir(s): """Return true if the pathname refers to an existing directory.""" try: st = os.stat(s) except os.error: return 0 return S_ISDIR(st[ST_MODE]) def getsize(filename): """Return the size of a file, reported by os.stat().""" st = os.stat(filename) return st[ST_SIZE] def getmtime(filename): """Return the last modification time of a file, reported by os.stat().""" st = os.stat(filename) return st[ST_MTIME] def getatime(filename): """Return the last access time of a file, reported by os.stat().""" st = os.stat(filename) return st[ST_ATIME] def islink(s): """Return true if the pathname refers to a symbolic link. Always false on the Mac, until we understand Aliases.)""" return 0 def isfile(s): """Return true if the pathname refers to an existing regular file.""" try: st = os.stat(s) except os.error: return 0 return S_ISREG(st[ST_MODE]) def exists(s): """Return true if the pathname refers to an existing file or directory.""" try: st = os.stat(s) except os.error: return 0 return 1
return prefix
def commonprefix(m): "Given a list of pathnames, returns the longest common leading component" if not m: return '' n = m[:] for i in range(len(n)): n[i] = n[i].split(os.sep) # if os.sep didn't have any effect, try os.altsep if os.altsep and len(n[i]) == 1: n[i] = n[i].split(os.altsep) prefix = n[0] for item in n: for i in range(len(prefix)): if prefix[:i+1] <> item[:i+1]: prefix = prefix[:i] if i == 0: return '' break return os.sep.join(prefix)
03c06ee7fc62512c4b2af0ed3c57a09128f4b2ce /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/03c06ee7fc62512c4b2af0ed3c57a09128f4b2ce/macpath.py
pat = re.compile(r'^\s*class\s*' + name + r'\b')
pat = re.compile(r'^(\s*)class\s*' + name + r'\b') candidates = []
def findsource(object): """Return the entire source file and starting line number for an object. The argument may be a module, class, method, function, traceback, frame, or code object. The source code is returned as a list of all the lines in the file and the line number indexes a line in that list. An IOError is raised if the source code cannot be retrieved.""" file = getsourcefile(object) or getfile(object) module = getmodule(object, file) if module: lines = linecache.getlines(file, module.__dict__) else: lines = linecache.getlines(file) if not lines: raise IOError('could not get source code') if ismodule(object): return lines, 0 if isclass(object): name = object.__name__ pat = re.compile(r'^\s*class\s*' + name + r'\b') for i in range(len(lines)): if pat.match(lines[i]): return lines, i else: raise IOError('could not find class definition') if ismethod(object): object = object.im_func if isfunction(object): object = object.func_code if istraceback(object): object = object.tb_frame if isframe(object): object = object.f_code if iscode(object): if not hasattr(object, 'co_firstlineno'): raise IOError('could not find function definition') lnum = object.co_firstlineno - 1 pat = re.compile(r'^(\s*def\s)|(.*(?<!\w)lambda(:|\s))|^(\s*@)') while lnum > 0: if pat.match(lines[lnum]): break lnum = lnum - 1 return lines, lnum raise IOError('could not find code object')
b2e81e307dc7e7d8a552619b6defddb06e028613 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b2e81e307dc7e7d8a552619b6defddb06e028613/inspect.py
if pat.match(lines[i]): return lines, i
match = pat.match(lines[i]) if match: if lines[i][0] == 'c': return lines, i candidates.append((match.group(1), i)) if candidates: candidates.sort() return lines, candidates[0][1]
def findsource(object): """Return the entire source file and starting line number for an object. The argument may be a module, class, method, function, traceback, frame, or code object. The source code is returned as a list of all the lines in the file and the line number indexes a line in that list. An IOError is raised if the source code cannot be retrieved.""" file = getsourcefile(object) or getfile(object) module = getmodule(object, file) if module: lines = linecache.getlines(file, module.__dict__) else: lines = linecache.getlines(file) if not lines: raise IOError('could not get source code') if ismodule(object): return lines, 0 if isclass(object): name = object.__name__ pat = re.compile(r'^\s*class\s*' + name + r'\b') for i in range(len(lines)): if pat.match(lines[i]): return lines, i else: raise IOError('could not find class definition') if ismethod(object): object = object.im_func if isfunction(object): object = object.func_code if istraceback(object): object = object.tb_frame if isframe(object): object = object.f_code if iscode(object): if not hasattr(object, 'co_firstlineno'): raise IOError('could not find function definition') lnum = object.co_firstlineno - 1 pat = re.compile(r'^(\s*def\s)|(.*(?<!\w)lambda(:|\s))|^(\s*@)') while lnum > 0: if pat.match(lines[lnum]): break lnum = lnum - 1 return lines, lnum raise IOError('could not find code object')
b2e81e307dc7e7d8a552619b6defddb06e028613 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b2e81e307dc7e7d8a552619b6defddb06e028613/inspect.py
"install-base or install-platbase supplied, but " + \ "installation scheme is incomplete"
("install-base or install-platbase supplied, but " "installation scheme is incomplete")
def finalize_unix (self):
dc8412e54132069f6906fdd1912a85ed0f459d26 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/dc8412e54132069f6906fdd1912a85ed0f459d26/install.py
"'extra_path' option must be a list, tuple, or " + \ "comma-separated string with 1 or 2 elements"
("'extra_path' option must be a list, tuple, or " "comma-separated string with 1 or 2 elements")
def handle_extra_path (self):
dc8412e54132069f6906fdd1912a85ed0f459d26 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/dc8412e54132069f6906fdd1912a85ed0f459d26/install.py
self.warn(("modules installed to '%s', which is not in " + "Python's module search path (sys.path) -- " + "you'll have to change the search path yourself") % self.install_lib)
log.debug(("modules installed to '%s', which is not in " "Python's module search path (sys.path) -- " "you'll have to change the search path yourself"), self.install_lib)
def run (self):
dc8412e54132069f6906fdd1912a85ed0f459d26 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/dc8412e54132069f6906fdd1912a85ed0f459d26/install.py
def_op('RAISE_VARARGS', 130) def_op('CALL_FUNCTION', 131) def_op('MAKE_FUNCTION', 132) def_op('BUILD_SLICE', 133)
def_op('RAISE_VARARGS', 130) def_op('CALL_FUNCTION', 131) def_op('MAKE_FUNCTION', 132) def_op('BUILD_SLICE', 133) def_op('CALL_FUNCTION_VAR', 140) def_op('CALL_FUNCTION_KW', 141) def_op('CALL_FUNCTION_VAR_KW', 142)
def jabs_op(name, op): opname[op] = name hasjabs.append(op)
7690151c7e95f38b91a9c572ce29b4d8a4ca671d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7690151c7e95f38b91a9c572ce29b4d8a4ca671d/dis.py
def __init__(self, screenName=None, baseName=None, className='Tk', useTk=1):
def __init__(self, screenName=None, baseName=None, className='Tk', useTk=1, sync=0, use=None):
def __init__(self, screenName=None, baseName=None, className='Tk', useTk=1): """Return a new Toplevel widget on screen SCREENNAME. A new Tcl interpreter will be created. BASENAME will be used for the identification of the profile file (see readprofile). It is constructed from sys.argv[0] without extensions if None is given. CLASSNAME is the name of the widget class.""" self.master = None self.children = {} self._tkloaded = 0 # to avoid recursions in the getattr code in case of failure, we # ensure that self.tk is always _something_. self.tk = None if baseName is None: import sys, os baseName = os.path.basename(sys.argv[0]) baseName, ext = os.path.splitext(baseName) if ext not in ('.py', '.pyc', '.pyo'): baseName = baseName + ext interactive = 0 self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk) if useTk: self._loadtk() self.readprofile(baseName, className)
9441c078cf929a0129a75032678a9e40d919f235 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9441c078cf929a0129a75032678a9e40d919f235/Tkinter.py
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk)
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
def __init__(self, screenName=None, baseName=None, className='Tk', useTk=1): """Return a new Toplevel widget on screen SCREENNAME. A new Tcl interpreter will be created. BASENAME will be used for the identification of the profile file (see readprofile). It is constructed from sys.argv[0] without extensions if None is given. CLASSNAME is the name of the widget class.""" self.master = None self.children = {} self._tkloaded = 0 # to avoid recursions in the getattr code in case of failure, we # ensure that self.tk is always _something_. self.tk = None if baseName is None: import sys, os baseName = os.path.basename(sys.argv[0]) baseName, ext = os.path.splitext(baseName) if ext not in ('.py', '.pyc', '.pyo'): baseName = baseName + ext interactive = 0 self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk) if useTk: self._loadtk() self.readprofile(baseName, className)
9441c078cf929a0129a75032678a9e40d919f235 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9441c078cf929a0129a75032678a9e40d919f235/Tkinter.py
def do_clear_break(self, arg): if not arg: self.do_clear("") return arg = string.strip(arg) args = string.split(arg) if len(args) < 2: print '*** Specify file and line number.' return try: line = int(args[1]) except: print '*** line number must be an integer.' return result =self.clear_break(args[0], line) if result: print result do_clb = do_clear_break
def do_clear(self, arg): # Three possibilities, tried in this order: # clear -> clear all breaks, ask for confirmation # clear file:lineno -> clear all breaks at file:lineno # clear bpno bpno ... -> clear breakpoints by number if not arg: try: reply = raw_input('Clear all breaks? ') except EOFError: reply = 'no' reply = string.lower(string.strip(reply)) if reply in ('y', 'yes'): self.clear_all_breaks() return if ':' in arg: # Make sure it works for "clear C:\foo\bar.py:12" i = string.rfind(arg, ':') filename = arg[:i] arg = arg[i+1:] try: lineno = int(arg) except: err = "Invalid line number (%s)" % arg else: err = self.clear_break(filename, lineno) if err: print '***', err return numberlist = string.split(arg) for i in numberlist: err = self.clear_bpbynumber(i) if err: print '***', err else: print 'Deleted breakpoint %s ' % (i,)
583cc31c223de8f021db7e427876e6097374bc9e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/583cc31c223de8f021db7e427876e6097374bc9e/pdb.py
if iconv_incs: if iconv_libs:
if platform not in ['darwin'] and iconv_incs is not None: if iconv_libs is not None:
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')
9ce623fce5707c9c2c9c4716d719e4178a08f80b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9ce623fce5707c9c2c9c4716d719e4178a08f80b/setup.py
if len(text) <= 1: text = ' '+text
if not text: text = ' '
def record_sub_info(match_object,sub_info=sub_info): sub_info.append([match_object.group(1)[0],match_object.span()]) return match_object.group(1)
0ca0c64409056047b4e24617f79a8faff93c2875 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0ca0c64409056047b4e24617f79a8faff93c2875/difflib.py
cmdclass = {'build_ext':PyBuildExt, 'install':PyBuildInstall},
cmdclass = {'build_ext':PyBuildExt, 'install':PyBuildInstall, 'install_lib':PyBuildInstallLib},
def main(): # turn off warnings when deprecated modules are imported import warnings warnings.filterwarnings("ignore",category=DeprecationWarning) setup(name = 'Python standard library', version = '%d.%d' % sys.version_info[:2], cmdclass = {'build_ext':PyBuildExt, 'install':PyBuildInstall}, # The struct module is defined here, because build_ext won't be # called unless there's at least one extension module defined. ext_modules=[Extension('struct', ['structmodule.c'])], # Scripts to install scripts = ['Tools/scripts/pydoc'] )
529a505da4c2ffc79b598935a241a9ffe17563e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/529a505da4c2ffc79b598935a241a9ffe17563e5/setup.py
verify(str(s).__class__ is str)
def rev(self): if self._rev is not None: return self._rev L = list(self) L.reverse() self._rev = self.__class__("".join(L)) return self._rev
5a49ade70e19a76aa252cd596accf79930765f31 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5a49ade70e19a76aa252cd596accf79930765f31/test_descr.py
verify(str(msg).find("weakly") >= 0)
verify(str(msg).find("weak reference") >= 0)
def weakrefs(): if verbose: print "Testing weak references..." import weakref class C(object): pass c = C() r = weakref.ref(c) verify(r() is c) del c verify(r() is None) del r class NoWeak(object): __slots__ = ['foo'] no = NoWeak() try: weakref.ref(no) except TypeError, msg: verify(str(msg).find("weakly") >= 0) else: verify(0, "weakref.ref(no) should be illegal") class Weak(object): __slots__ = ['foo', '__weakref__'] yes = Weak() r = weakref.ref(yes) verify(r() is yes) del yes verify(r() is None) del r
4bf018b1383f2fb1cb1f276dbf137ea1e3f77cc4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4bf018b1383f2fb1cb1f276dbf137ea1e3f77cc4/test_descr.py
'.ps': 'application/postscript',
'.pyo': 'application/x-python-code',
def read_mime_types(file): try: f = open(file) except IOError: return None map = {} while 1: line = f.readline() if not line: break words = line.split() for i in range(len(words)): if words[i][0] == '#': del words[i:] break if not words: continue type, suffixes = words[0], words[1:] for suff in suffixes: map['.'+suff] = type f.close() return map
2750bcc2d139f95b08693512af4b4ae50c505998 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/2750bcc2d139f95b08693512af4b4ae50c505998/mimetypes.py
if (self.compiler.find_library_file(lib_dirs, 'ncurses')):
if (self.compiler.find_library_file(lib_dirs, 'ncursesw')): curses_libs = ['ncursesw'] exts.append( Extension('_curses', ['_cursesmodule.c'], libraries = curses_libs) ) elif (self.compiler.find_library_file(lib_dirs, 'ncurses')):
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')
a55e55e9f3034ceacbf90facc1a0548d63250df4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a55e55e9f3034ceacbf90facc1a0548d63250df4/setup.py
def writestr(self, zinfo, bytes):
def writestr(self, zinfo_or_arcname, bytes):
def writestr(self, zinfo, bytes): """Write a file into the archive. The contents is the string 'bytes'.""" self._writecheck(zinfo) zinfo.file_size = len(bytes) # Uncompressed size zinfo.CRC = binascii.crc32(bytes) # CRC-32 checksum if zinfo.compress_type == ZIP_DEFLATED: co = zlib.compressobj(zlib.Z_DEFAULT_COMPRESSION, zlib.DEFLATED, -15) bytes = co.compress(bytes) + co.flush() zinfo.compress_size = len(bytes) # Compressed size else: zinfo.compress_size = zinfo.file_size zinfo.header_offset = self.fp.tell() # Start of header bytes self.fp.write(zinfo.FileHeader()) zinfo.file_offset = self.fp.tell() # Start of file bytes self.fp.write(bytes) if zinfo.flag_bits & 0x08: # Write CRC and file sizes after the file data self.fp.write(struct.pack("<lll", zinfo.CRC, zinfo.compress_size, zinfo.file_size)) self.filelist.append(zinfo) self.NameToInfo[zinfo.filename] = zinfo
b083cb3901fcb7487c04ad996148d1cf0aa32350 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b083cb3901fcb7487c04ad996148d1cf0aa32350/zipfile.py
'bytes'."""
'bytes'. 'zinfo_or_arcname' is either a ZipInfo instance or the name of the file in the archive.""" if not isinstance(zinfo_or_arcname, ZipInfo): zinfo = ZipInfo(filename=zinfo_or_arcname, date_time=time.localtime(time.time())) zinfo.compress_type = self.compression else: zinfo = zinfo_or_arcname
def writestr(self, zinfo, bytes): """Write a file into the archive. The contents is the string 'bytes'.""" self._writecheck(zinfo) zinfo.file_size = len(bytes) # Uncompressed size zinfo.CRC = binascii.crc32(bytes) # CRC-32 checksum if zinfo.compress_type == ZIP_DEFLATED: co = zlib.compressobj(zlib.Z_DEFAULT_COMPRESSION, zlib.DEFLATED, -15) bytes = co.compress(bytes) + co.flush() zinfo.compress_size = len(bytes) # Compressed size else: zinfo.compress_size = zinfo.file_size zinfo.header_offset = self.fp.tell() # Start of header bytes self.fp.write(zinfo.FileHeader()) zinfo.file_offset = self.fp.tell() # Start of file bytes self.fp.write(bytes) if zinfo.flag_bits & 0x08: # Write CRC and file sizes after the file data self.fp.write(struct.pack("<lll", zinfo.CRC, zinfo.compress_size, zinfo.file_size)) self.filelist.append(zinfo) self.NameToInfo[zinfo.filename] = zinfo
b083cb3901fcb7487c04ad996148d1cf0aa32350 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b083cb3901fcb7487c04ad996148d1cf0aa32350/zipfile.py
self.pred=[]
self.pred = []
def __init__(self, versionPredicateStr): """Parse a version predicate string. """ # Fields: # name: package name # pred: list of (comparison string, StrictVersion)
abc1566eab0b21c066df2e19e28fe0ea3beb2e5e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/abc1566eab0b21c066df2e19e28fe0ea3beb2e5e/versionpredicate.py
os.chmod(p, stat.S_IMODE(st.st_mode) | stat.S_IXGRP)
os.chmod(p, stat.S_IMODE(st.st_mode) | stat.S_IWGRP) os.chown(p, -1, gid)
def buildPython(): print "Building a universal python" buildDir = os.path.join(WORKDIR, '_bld', 'python') rootDir = os.path.join(WORKDIR, '_root') if os.path.exists(buildDir): shutil.rmtree(buildDir) if os.path.exists(rootDir): shutil.rmtree(rootDir) os.mkdir(buildDir) os.mkdir(rootDir) os.mkdir(os.path.join(rootDir, 'empty-dir')) curdir = os.getcwd() os.chdir(buildDir) # Not sure if this is still needed, the original build script # claims that parts of the install assume python.exe exists. os.symlink('python', os.path.join(buildDir, 'python.exe')) # Extract the version from the configure file, needed to calculate # several paths. version = getVersion() print "Running configure..." runCommand("%s -C --enable-framework --enable-universalsdk=%s LDFLAGS='-g -L%s/libraries/usr/local/lib' OPT='-g -O3 -I%s/libraries/usr/local/include' 2>&1"%( shellQuote(os.path.join(SRCDIR, 'configure')), shellQuote(SDKPATH), shellQuote(WORKDIR)[1:-1], shellQuote(WORKDIR)[1:-1])) print "Running make" runCommand("make") print "Runing make frameworkinstall" runCommand("make frameworkinstall DESTDIR=%s"%( shellQuote(rootDir))) print "Runing make frameworkinstallextras" runCommand("make frameworkinstallextras DESTDIR=%s"%( shellQuote(rootDir))) print "Copy required shared libraries" if os.path.exists(os.path.join(WORKDIR, 'libraries', 'Library')): runCommand("mv %s/* %s"%( shellQuote(os.path.join( WORKDIR, 'libraries', 'Library', 'Frameworks', 'Python.framework', 'Versions', getVersion(), 'lib')), shellQuote(os.path.join(WORKDIR, '_root', 'Library', 'Frameworks', 'Python.framework', 'Versions', getVersion(), 'lib')))) print "Fix file modes" frmDir = os.path.join(rootDir, 'Library', 'Frameworks', 'Python.framework') for dirpath, dirnames, filenames in os.walk(frmDir): for dn in dirnames: os.chmod(os.path.join(dirpath, dn), 0775) for fn in filenames: if os.path.islink(fn): continue # "chmod g+w $fn" p = os.path.join(dirpath, fn) st = os.stat(p) os.chmod(p, stat.S_IMODE(st.st_mode) | stat.S_IXGRP) # We added some directories to the search path during the configure # phase. Remove those because those directories won't be there on # the end-users system. path =os.path.join(rootDir, 'Library', 'Frameworks', 'Python.framework', 'Versions', version, 'lib', 'python%s'%(version,), 'config', 'Makefile') fp = open(path, 'r') data = fp.read() fp.close() data = data.replace('-L%s/libraries/usr/local/lib'%(WORKDIR,), '') data = data.replace('-I%s/libraries/usr/local/include'%(WORKDIR,), '') fp = open(path, 'w') fp.write(data) fp.close() # Add symlinks in /usr/local/bin, using relative links usr_local_bin = os.path.join(rootDir, 'usr', 'local', 'bin') to_framework = os.path.join('..', '..', '..', 'Library', 'Frameworks', 'Python.framework', 'Versions', version, 'bin') if os.path.exists(usr_local_bin): shutil.rmtree(usr_local_bin) os.makedirs(usr_local_bin) for fn in os.listdir( os.path.join(frmDir, 'Versions', version, 'bin')): os.symlink(os.path.join(to_framework, fn), os.path.join(usr_local_bin, fn)) os.chdir(curdir)
a1cf44de4c085d733944b2fc3c20735f048e321d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a1cf44de4c085d733944b2fc3c20735f048e321d/build-installer.py
test(r"""sre.match("\%03o" % i, chr(i)) != None""", 1) test(r"""sre.match("\%03o0" % i, chr(i)+"0") != None""", 1) test(r"""sre.match("\%03o8" % i, chr(i)+"8") != None""", 1)
test(r"""sre.match(r"\%03o" % i, chr(i)) != None""", 1) test(r"""sre.match(r"\%03o0" % i, chr(i)+"0") != None""", 1) test(r"""sre.match(r"\%03o8" % i, chr(i)+"8") != None""", 1)
def test(expression, result, exception=None): try: r = eval(expression) except: if exception: if not isinstance(sys.exc_value, exception): print expression, "FAILED" # display name, not actual value if exception is sre.error: print "expected", "sre.error" else: print "expected", exception.__name__ print "got", sys.exc_type.__name__, str(sys.exc_value) else: print expression, "FAILED" traceback.print_exc(file=sys.stdout) else: if exception: print expression, "FAILED" if exception is sre.error: print "expected", "sre.error" else: print "expected", exception.__name__ print "got result", repr(r) else: if r != result: print expression, "FAILED" print "expected", repr(result) print "got result", repr(r)
03dd010b4fa7524e90cf1d5469f41618428589c9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/03dd010b4fa7524e90cf1d5469f41618428589c9/test_sre.py
test(r"""sre.search('x*', 'axx').span(0)""", (0, 0)) test(r"""sre.search('x*', 'axx').span()""", (0, 0)) test(r"""sre.search('x+', 'axx').span(0)""", (1, 3)) test(r"""sre.search('x+', 'axx').span()""", (1, 3)) test(r"""sre.search('x', 'aaa')""", None) test(r"""sre.match('a*', 'xxx').span(0)""", (0, 0)) test(r"""sre.match('a*', 'xxx').span()""", (0, 0)) test(r"""sre.match('x*', 'xxxa').span(0)""", (0, 3)) test(r"""sre.match('x*', 'xxxa').span()""", (0, 3)) test(r"""sre.match('a+', 'xxx')""", None)
test(r"""sre.search(r'x*', 'axx').span(0)""", (0, 0)) test(r"""sre.search(r'x*', 'axx').span()""", (0, 0)) test(r"""sre.search(r'x+', 'axx').span(0)""", (1, 3)) test(r"""sre.search(r'x+', 'axx').span()""", (1, 3)) test(r"""sre.search(r'x', 'aaa')""", None) test(r"""sre.match(r'a*', 'xxx').span(0)""", (0, 0)) test(r"""sre.match(r'a*', 'xxx').span()""", (0, 0)) test(r"""sre.match(r'x*', 'xxxa').span(0)""", (0, 3)) test(r"""sre.match(r'x*', 'xxxa').span()""", (0, 3)) test(r"""sre.match(r'a+', 'xxx')""", None)
def test(expression, result, exception=None): try: r = eval(expression) except: if exception: if not isinstance(sys.exc_value, exception): print expression, "FAILED" # display name, not actual value if exception is sre.error: print "expected", "sre.error" else: print "expected", exception.__name__ print "got", sys.exc_type.__name__, str(sys.exc_value) else: print expression, "FAILED" traceback.print_exc(file=sys.stdout) else: if exception: print expression, "FAILED" if exception is sre.error: print "expected", "sre.error" else: print "expected", exception.__name__ print "got result", repr(r) else: if r != result: print expression, "FAILED" print "expected", repr(result) print "got result", repr(r)
03dd010b4fa7524e90cf1d5469f41618428589c9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/03dd010b4fa7524e90cf1d5469f41618428589c9/test_sre.py
test(r"""sre.match('(a)|(b)', 'b').start(1)""", -1) test(r"""sre.match('(a)|(b)', 'b').end(1)""", -1) test(r"""sre.match('(a)|(b)', 'b').span(1)""", (-1, -1))
test(r"""sre.match(r'(a)|(b)', 'b').start(1)""", -1) test(r"""sre.match(r'(a)|(b)', 'b').end(1)""", -1) test(r"""sre.match(r'(a)|(b)', 'b').span(1)""", (-1, -1))
def test(expression, result, exception=None): try: r = eval(expression) except: if exception: if not isinstance(sys.exc_value, exception): print expression, "FAILED" # display name, not actual value if exception is sre.error: print "expected", "sre.error" else: print "expected", exception.__name__ print "got", sys.exc_type.__name__, str(sys.exc_value) else: print expression, "FAILED" traceback.print_exc(file=sys.stdout) else: if exception: print expression, "FAILED" if exception is sre.error: print "expected", "sre.error" else: print "expected", exception.__name__ print "got result", repr(r) else: if r != result: print expression, "FAILED" print "expected", repr(result) print "got result", repr(r)
03dd010b4fa7524e90cf1d5469f41618428589c9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/03dd010b4fa7524e90cf1d5469f41618428589c9/test_sre.py
test(r"""sre.sub("(?i)b+", "x", "bbbb BBBB")""", 'x x')
test(r"""sre.sub(r"(?i)b+", "x", "bbbb BBBB")""", 'x x')
def test(expression, result, exception=None): try: r = eval(expression) except: if exception: if not isinstance(sys.exc_value, exception): print expression, "FAILED" # display name, not actual value if exception is sre.error: print "expected", "sre.error" else: print "expected", exception.__name__ print "got", sys.exc_type.__name__, str(sys.exc_value) else: print expression, "FAILED" traceback.print_exc(file=sys.stdout) else: if exception: print expression, "FAILED" if exception is sre.error: print "expected", "sre.error" else: print "expected", exception.__name__ print "got result", repr(r) else: if r != result: print expression, "FAILED" print "expected", repr(result) print "got result", repr(r)
03dd010b4fa7524e90cf1d5469f41618428589c9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/03dd010b4fa7524e90cf1d5469f41618428589c9/test_sre.py
test(r"""sre.sub('.', lambda m: r"\n", 'x')""", '\\n') test(r"""sre.sub('.', r"\n", 'x')""", '\n')
test(r"""sre.sub(r'.', lambda m: r"\n", 'x')""", '\\n') test(r"""sre.sub(r'.', r"\n", 'x')""", '\n')
def bump_num(matchobj): int_value = int(matchobj.group(0)) return str(int_value + 1)
03dd010b4fa7524e90cf1d5469f41618428589c9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/03dd010b4fa7524e90cf1d5469f41618428589c9/test_sre.py
test(r"""sre.sub('(.)', s, 'x')""", 'xx') test(r"""sre.sub('(.)', sre.escape(s), 'x')""", s) test(r"""sre.sub('(.)', lambda m: s, 'x')""", s) test(r"""sre.sub('(?P<a>x)', '\g<a>\g<a>', 'xx')""", 'xxxx') test(r"""sre.sub('(?P<a>x)', '\g<a>\g<1>', 'xx')""", 'xxxx') test(r"""sre.sub('(?P<unk>x)', '\g<unk>\g<unk>', 'xx')""", 'xxxx') test(r"""sre.sub('(?P<unk>x)', '\g<1>\g<1>', 'xx')""", 'xxxx') test(r"""sre.sub('a', r'\t\n\v\r\f\a\b\B\Z\a\A\w\W\s\S\d\D', 'a')""", '\t\n\v\r\f\a\b\\B\\Z\a\\A\\w\\W\\s\\S\\d\\D') test(r"""sre.sub('a', '\t\n\v\r\f\a', 'a')""", '\t\n\v\r\f\a') test(r"""sre.sub('a', '\t\n\v\r\f\a', 'a')""", (chr(9)+chr(10)+chr(11)+chr(13)+chr(12)+chr(7))) test(r"""sre.sub('^\s*', 'X', 'test')""", 'Xtest')
test(r"""sre.sub(r'(.)', s, 'x')""", 'xx') test(r"""sre.sub(r'(.)', sre.escape(s), 'x')""", s) test(r"""sre.sub(r'(.)', lambda m: s, 'x')""", s) test(r"""sre.sub(r'(?P<a>x)', '\g<a>\g<a>', 'xx')""", 'xxxx') test(r"""sre.sub(r'(?P<a>x)', '\g<a>\g<1>', 'xx')""", 'xxxx') test(r"""sre.sub(r'(?P<unk>x)', '\g<unk>\g<unk>', 'xx')""", 'xxxx') test(r"""sre.sub(r'(?P<unk>x)', '\g<1>\g<1>', 'xx')""", 'xxxx') test(r"""sre.sub(r'a', r'\t\n\v\r\f\a\b\B\Z\a\A\w\W\s\S\d\D', 'a')""", '\t\n\v\r\f\a\b\\B\\Z\a\\A\\w\\W\\s\\S\\d\\D') test(r"""sre.sub(r'a', '\t\n\v\r\f\a', 'a')""", '\t\n\v\r\f\a') test(r"""sre.sub(r'a', '\t\n\v\r\f\a', 'a')""", (chr(9)+chr(10)+chr(11)+chr(13)+chr(12)+chr(7))) test(r"""sre.sub(r'^\s*', 'X', 'test')""", 'Xtest')
def bump_num(matchobj): int_value = int(matchobj.group(0)) return str(int_value + 1)
03dd010b4fa7524e90cf1d5469f41618428589c9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/03dd010b4fa7524e90cf1d5469f41618428589c9/test_sre.py
test(r"""sre.sub('a', 'b', 'aaaaa')""", 'bbbbb') test(r"""sre.sub('a', 'b', 'aaaaa', 1)""", 'baaaa')
test(r"""sre.sub(r'a', 'b', 'aaaaa')""", 'bbbbb') test(r"""sre.sub(r'a', 'b', 'aaaaa', 1)""", 'baaaa')
def bump_num(matchobj): int_value = int(matchobj.group(0)) return str(int_value + 1)
03dd010b4fa7524e90cf1d5469f41618428589c9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/03dd010b4fa7524e90cf1d5469f41618428589c9/test_sre.py
test(r"""sre.sub('(?P<a>x)', '\g<a', 'xx')""", None, sre.error) test(r"""sre.sub('(?P<a>x)', '\g<', 'xx')""", None, sre.error) test(r"""sre.sub('(?P<a>x)', '\g', 'xx')""", None, sre.error) test(r"""sre.sub('(?P<a>x)', '\g<a a>', 'xx')""", None, sre.error) test(r"""sre.sub('(?P<a>x)', '\g<1a1>', 'xx')""", None, sre.error) test(r"""sre.sub('(?P<a>x)', '\g<ab>', 'xx')""", None, IndexError) test(r"""sre.sub('(?P<a>x)|(?P<b>y)', '\g<b>', 'xx')""", None, sre.error) test(r"""sre.sub('(?P<a>x)|(?P<b>y)', '\\2', 'xx')""", None, sre.error)
test(r"""sre.sub(r'(?P<a>x)', '\g<a', 'xx')""", None, sre.error) test(r"""sre.sub(r'(?P<a>x)', '\g<', 'xx')""", None, sre.error) test(r"""sre.sub(r'(?P<a>x)', '\g', 'xx')""", None, sre.error) test(r"""sre.sub(r'(?P<a>x)', '\g<a a>', 'xx')""", None, sre.error) test(r"""sre.sub(r'(?P<a>x)', '\g<1a1>', 'xx')""", None, sre.error) test(r"""sre.sub(r'(?P<a>x)', '\g<ab>', 'xx')""", None, IndexError) test(r"""sre.sub(r'(?P<a>x)|(?P<b>y)', '\g<b>', 'xx')""", None, sre.error) test(r"""sre.sub(r'(?P<a>x)|(?P<b>y)', '\\2', 'xx')""", None, sre.error)
def bump_num(matchobj): int_value = int(matchobj.group(0)) return str(int_value + 1)
03dd010b4fa7524e90cf1d5469f41618428589c9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/03dd010b4fa7524e90cf1d5469f41618428589c9/test_sre.py
test(r"""sre.subn("(?i)b+", "x", "bbbb BBBB")""", ('x x', 2)) test(r"""sre.subn("b+", "x", "bbbb BBBB")""", ('x BBBB', 1)) test(r"""sre.subn("b+", "x", "xyz")""", ('xyz', 0)) test(r"""sre.subn("b*", "x", "xyz")""", ('xxxyxzx', 4)) test(r"""sre.subn("b*", "x", "xyz", 2)""", ('xxxyz', 2))
test(r"""sre.subn(r"(?i)b+", "x", "bbbb BBBB")""", ('x x', 2)) test(r"""sre.subn(r"b+", "x", "bbbb BBBB")""", ('x BBBB', 1)) test(r"""sre.subn(r"b+", "x", "xyz")""", ('xyz', 0)) test(r"""sre.subn(r"b*", "x", "xyz")""", ('xxxyxzx', 4)) test(r"""sre.subn(r"b*", "x", "xyz", 2)""", ('xxxyz', 2))
def bump_num(matchobj): int_value = int(matchobj.group(0)) return str(int_value + 1)
03dd010b4fa7524e90cf1d5469f41618428589c9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/03dd010b4fa7524e90cf1d5469f41618428589c9/test_sre.py
test(r"""sre.split(":", ":a:b::c")""", ['', 'a', 'b', '', 'c']) test(r"""sre.split(":*", ":a:b::c")""", ['', 'a', 'b', 'c']) test(r"""sre.split("(:*)", ":a:b::c")""", ['', ':', 'a', ':', 'b', '::', 'c']) test(r"""sre.split("(?::*)", ":a:b::c")""", ['', 'a', 'b', 'c']) test(r"""sre.split("(:)*", ":a:b::c")""", ['', ':', 'a', ':', 'b', ':', 'c']) test(r"""sre.split("([b:]+)", ":a:b::c")""", ['', ':', 'a', ':b::', 'c']) test(r"""sre.split("(b)|(:+)", ":a:b::c")""",
test(r"""sre.split(r":", ":a:b::c")""", ['', 'a', 'b', '', 'c']) test(r"""sre.split(r":*", ":a:b::c")""", ['', 'a', 'b', 'c']) test(r"""sre.split(r"(:*)", ":a:b::c")""", ['', ':', 'a', ':', 'b', '::', 'c']) test(r"""sre.split(r"(?::*)", ":a:b::c")""", ['', 'a', 'b', 'c']) test(r"""sre.split(r"(:)*", ":a:b::c")""", ['', ':', 'a', ':', 'b', ':', 'c']) test(r"""sre.split(r"([b:]+)", ":a:b::c")""", ['', ':', 'a', ':b::', 'c']) test(r"""sre.split(r"(b)|(:+)", ":a:b::c")""",
def bump_num(matchobj): int_value = int(matchobj.group(0)) return str(int_value + 1)
03dd010b4fa7524e90cf1d5469f41618428589c9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/03dd010b4fa7524e90cf1d5469f41618428589c9/test_sre.py
test(r"""sre.split("(?:b)|(?::+)", ":a:b::c")""", ['', 'a', '', '', 'c']) test(r"""sre.split(":", ":a:b::c", 2)""", ['', 'a', 'b::c']) test(r"""sre.split(':', 'a:b:c:d', 2)""", ['a', 'b', 'c:d']) test(r"""sre.split("(:)", ":a:b::c", 2)""", ['', ':', 'a', ':', 'b::c']) test(r"""sre.split("(:*)", ":a:b::c", 2)""", ['', ':', 'a', ':', 'b::c'])
test(r"""sre.split(r"(?:b)|(?::+)", ":a:b::c")""", ['', 'a', '', '', 'c']) test(r"""sre.split(r":", ":a:b::c", 2)""", ['', 'a', 'b::c']) test(r"""sre.split(r':', 'a:b:c:d', 2)""", ['a', 'b', 'c:d']) test(r"""sre.split(r"(:)", ":a:b::c", 2)""", ['', ':', 'a', ':', 'b::c']) test(r"""sre.split(r"(:*)", ":a:b::c", 2)""", ['', ':', 'a', ':', 'b::c'])
def bump_num(matchobj): int_value = int(matchobj.group(0)) return str(int_value + 1)
03dd010b4fa7524e90cf1d5469f41618428589c9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/03dd010b4fa7524e90cf1d5469f41618428589c9/test_sre.py
test(r"""sre.findall(":+", "abc")""", []) test(r"""sre.findall(":+", "a:b::c:::d")""", [":", "::", ":::"]) test(r"""sre.findall("(:+)", "a:b::c:::d")""", [":", "::", ":::"]) test(r"""sre.findall("(:)(:*)", "a:b::c:::d")""",
test(r"""sre.findall(r":+", "abc")""", []) test(r"""sre.findall(r":+", "a:b::c:::d")""", [":", "::", ":::"]) test(r"""sre.findall(r"(:+)", "a:b::c:::d")""", [":", "::", ":::"]) test(r"""sre.findall(r"(:)(:*)", "a:b::c:::d")""",
def bump_num(matchobj): int_value = int(matchobj.group(0)) return str(int_value + 1)
03dd010b4fa7524e90cf1d5469f41618428589c9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/03dd010b4fa7524e90cf1d5469f41618428589c9/test_sre.py
test(r"""sre.findall("(a)|(b)", "abc")""", [("a", ""), ("", "b")])
test(r"""sre.findall(r"(a)|(b)", "abc")""", [("a", ""), ("", "b")])
def bump_num(matchobj): int_value = int(matchobj.group(0)) return str(int_value + 1)
03dd010b4fa7524e90cf1d5469f41618428589c9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/03dd010b4fa7524e90cf1d5469f41618428589c9/test_sre.py
test(r"""sre.match('a', 'a').groups()""", ()) test(r"""sre.match('(a)', 'a').groups()""", ('a',)) test(r"""sre.match('(a)', 'a').group(0)""", 'a') test(r"""sre.match('(a)', 'a').group(1)""", 'a') test(r"""sre.match('(a)', 'a').group(1, 1)""", ('a', 'a')) pat = sre.compile('((a)|(b))(c)?')
test(r"""sre.match(r'a', 'a').groups()""", ()) test(r"""sre.match(r'(a)', 'a').groups()""", ('a',)) test(r"""sre.match(r'(a)', 'a').group(0)""", 'a') test(r"""sre.match(r'(a)', 'a').group(1)""", 'a') test(r"""sre.match(r'(a)', 'a').group(1, 1)""", ('a', 'a')) pat = sre.compile(r'((a)|(b))(c)?')
def bump_num(matchobj): int_value = int(matchobj.group(0)) return str(int_value + 1)
03dd010b4fa7524e90cf1d5469f41618428589c9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/03dd010b4fa7524e90cf1d5469f41618428589c9/test_sre.py
pat = sre.compile('(?:(?P<a1>a)|(?P<b2>b))(?P<c3>c)?')
pat = sre.compile(r'(?:(?P<a1>a)|(?P<b2>b))(?P<c3>c)?')
def bump_num(matchobj): int_value = int(matchobj.group(0)) return str(int_value + 1)
03dd010b4fa7524e90cf1d5469f41618428589c9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/03dd010b4fa7524e90cf1d5469f41618428589c9/test_sre.py
pat = sre.compile('a(?:b|(c|e){1,2}?|d)+?(.)')
pat = sre.compile(r'a(?:b|(c|e){1,2}?|d)+?(.)')
def bump_num(matchobj): int_value = int(matchobj.group(0)) return str(int_value + 1)
03dd010b4fa7524e90cf1d5469f41618428589c9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/03dd010b4fa7524e90cf1d5469f41618428589c9/test_sre.py
pat = sre.compile('a(?:b|(c|e){1,2}?|d)+?(.)')
pat = sre.compile(r'a(?:b|(c|e){1,2}?|d)+?(.)')
def bump_num(matchobj): int_value = int(matchobj.group(0)) return str(int_value + 1)
03dd010b4fa7524e90cf1d5469f41618428589c9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/03dd010b4fa7524e90cf1d5469f41618428589c9/test_sre.py
test(r"""sre.match('(x)*', 50000*'x').span()""", (0, 50000), RuntimeError) test(r"""sre.match('(x)*y', 50000*'x'+'y').span()""", (0, 50001), RuntimeError) test(r"""sre.match('(x)*?y', 50000*'x'+'y').span()""", (0, 50001), RuntimeError)
test(r"""sre.match(r'(x)*', 50000*'x').span()""", (0, 50000), RuntimeError) test(r"""sre.match(r'(x)*y', 50000*'x'+'y').span()""", (0, 50001), RuntimeError) test(r"""sre.match(r'(x)*?y', 50000*'x'+'y').span()""", (0, 50001), RuntimeError)
def bump_num(matchobj): int_value = int(matchobj.group(0)) return str(int_value + 1)
03dd010b4fa7524e90cf1d5469f41618428589c9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/03dd010b4fa7524e90cf1d5469f41618428589c9/test_sre.py
pass
print '=== Compiled incorrectly', t
def bump_num(matchobj): int_value = int(matchobj.group(0)) return str(int_value + 1)
03dd010b4fa7524e90cf1d5469f41618428589c9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/03dd010b4fa7524e90cf1d5469f41618428589c9/test_sre.py
updated is a tuple naming the attributes off the wrapper that
updated is a tuple naming the attributes of the wrapper that
def update_wrapper(wrapper, wrapped, assigned = WRAPPER_ASSIGNMENTS, updated = WRAPPER_UPDATES): """Update a wrapper function to look like the wrapped function wrapper is the function to be updated wrapped is the original function assigned is a tuple naming the attributes assigned directly from the wrapped function to the wrapper function (defaults to functools.WRAPPER_ASSIGNMENTS) updated is a tuple naming the attributes off the wrapper that are updated with the corresponding attribute from the wrapped function (defaults to functools.WRAPPER_UPDATES) """ for attr in assigned: setattr(wrapper, attr, getattr(wrapped, attr)) for attr in updated: getattr(wrapper, attr).update(getattr(wrapped, attr)) # Return the wrapper so this can be used as a decorator via partial() return wrapper
efb57072feb9da7ff7870e36f0fc9272a103de80 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/efb57072feb9da7ff7870e36f0fc9272a103de80/functools.py
self._cont_handler.startElement(name, attrs)
self._cont_handler.startElementNS(name, qname, attrs)
def startElementNS(self, name, qname, attrs): self._cont_handler.startElement(name, attrs)
0ea558f7b4b6242a7457cf6a20ad33cf2769b7b1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0ea558f7b4b6242a7457cf6a20ad33cf2769b7b1/saxutils.py
def subconvert(line, ofp, table, discards, autoclosing, endchar=None): stack = [] while line: if line[0] == endchar and not stack: return line[1:] m = _comment_rx.match(line) if m: text = m.group(1) if text: ofp.write("(COMMENT\n") ofp.write("- %s \n" % encode(text)) ofp.write(")COMMENT\n") ofp.write("-\\n\n")
637ad47e61c51f605a15337b007493586ad37e7f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/637ad47e61c51f605a15337b007493586ad37e7f/latex2esis.py
subconvert(ifp.read(), ofp, table, discards, autoclosing)
subconvert(data, ofp, table, discards, autoclosing)
def convert(ifp, ofp, table={}, discards=(), autoclosing=()): try: subconvert(ifp.read(), ofp, table, discards, autoclosing) except IOError, (err, msg): if err != errno.EPIPE: raise
637ad47e61c51f605a15337b007493586ad37e7f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/637ad47e61c51f605a15337b007493586ad37e7f/latex2esis.py
expectedchecksum = 'b45b79f3203ee1a896d9b5655484adaff5d4964b'
expectedchecksum = '4e389f97e9f88b8b7ab743121fd643089116f9f2'
def tearDown(self): del self.db
d004fc810af3e1985686e616763e14a1b0aa60c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d004fc810af3e1985686e616763e14a1b0aa60c1/test_unicodedata.py
parts = resp[left+1].split(resp[left + 1:right])
parts = resp[left + 1:right].split(resp[left+1])
def parse229(resp, peer): '''Parse the '229' response for a EPSV request. Raises error_proto if it does not contain '(|||port|)' Return ('host.addr.as.numbers', port#) tuple.''' if resp[:3] <> '229': raise error_reply, resp left = resp.find('(') if left < 0: raise error_proto, resp right = resp.find(')', left + 1) if right < 0: raise error_proto, resp # should contain '(|||port|)' if resp[left + 1] <> resp[right - 1]: raise error_proto, resp parts = resp[left+1].split(resp[left + 1:right]) if len(parts) <> 5: raise error_proto, resp host = peer[0] port = int(parts[3]) return host, port
a401ae4010eeb385a0775c505637bbc332bc184c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a401ae4010eeb385a0775c505637bbc332bc184c/ftplib.py
if len(a) < len(b): a, b = b, a res = a[:] for i in range(len(b)): res[i] = res[i] - b[i] return normalize(res)
neg_b = map(lambda x: -x, b[:]) return plus(a, neg_b)
def minus(a, b): if len(a) < len(b): a, b = b, a # make sure a is the longest res = a[:] # make a copy for i in range(len(b)): res[i] = res[i] - b[i] return normalize(res)
971dc53f0ede0945dda9471596e4c727ea23dc7c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/971dc53f0ede0945dda9471596e4c727ea23dc7c/poly.py
self.create_system = 0
if sys.platform == 'win32': self.create_system = 0 else: self.create_system = 3
def __init__(self, filename="NoName", date_time=(1980,1,1,0,0,0)): self.orig_filename = filename # Original file name in archive
0075690ced8026e68cf96e3bf9310c9002b2d36f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0075690ced8026e68cf96e3bf9310c9002b2d36f/zipfile.py
def _read_eof(self): # We've read to the end of the file, so we have to rewind in order # to reread the 8 bytes containing the CRC and the file size. # We check the that the computed CRC and size of the # uncompressed data matches the stored values. self.fileobj.seek(-8, 1) crc32 = read32(self.fileobj) isize = U32(read32(self.fileobj)) # may exceed 2GB if U32(crc32) != U32(self.crc): raise ValueError, "CRC check failed" elif isize != self.size: raise ValueError, "Incorrect length of data produced"
9288f95cb5d7be807c2ba6dbc195ec6b52ac3bd4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9288f95cb5d7be807c2ba6dbc195ec6b52ac3bd4/gzip.py
elif isize != self.size:
elif isize != LOWU32(self.size):
def _read_eof(self): # We've read to the end of the file, so we have to rewind in order # to reread the 8 bytes containing the CRC and the file size. # We check the that the computed CRC and size of the # uncompressed data matches the stored values. self.fileobj.seek(-8, 1) crc32 = read32(self.fileobj) isize = U32(read32(self.fileobj)) # may exceed 2GB if U32(crc32) != U32(self.crc): raise ValueError, "CRC check failed" elif isize != self.size: raise ValueError, "Incorrect length of data produced"
9288f95cb5d7be807c2ba6dbc195ec6b52ac3bd4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9288f95cb5d7be807c2ba6dbc195ec6b52ac3bd4/gzip.py
write32u(self.fileobj, self.size)
write32u(self.fileobj, LOWU32(self.size))
def close(self): if self.mode == WRITE: self.fileobj.write(self.compress.flush()) write32(self.fileobj, self.crc) # self.size may exceed 2GB write32u(self.fileobj, self.size) self.fileobj = None elif self.mode == READ: self.fileobj = None if self.myfileobj: self.myfileobj.close() self.myfileobj = None
9288f95cb5d7be807c2ba6dbc195ec6b52ac3bd4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9288f95cb5d7be807c2ba6dbc195ec6b52ac3bd4/gzip.py
def detect_modules(self): # Ensure that /usr/local is always used if '/usr/local/lib' not in self.compiler.library_dirs: self.compiler.library_dirs.insert(0, '/usr/local/lib') if '/usr/local/include' not in self.compiler.include_dirs: self.compiler.include_dirs.insert(0, '/usr/local/include' )
57fc21018f570b708a898f858d8fe4706d504812 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/57fc21018f570b708a898f858d8fe4706d504812/setup.py
def check_module_event(self, event):
def check_module_event(self, event=None):
def check_module_event(self, event): filename = self.getfilename() if not filename: return if not self.tabnanny(filename): return self.checksyntax(filename)
2618c7fadc756ebd81213423055626411920f379 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/2618c7fadc756ebd81213423055626411920f379/ScriptBinding.py
filename = self.getfilename() if not filename: return if not self.tabnanny(filename): return code = self.checksyntax(filename)
code = self.check_module_event(event)
def run_module_event(self, event): """Run the module after setting up the environment.
2618c7fadc756ebd81213423055626411920f379 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/2618c7fadc756ebd81213423055626411920f379/ScriptBinding.py
r = (40, 40, 400, 300)
r = windowbounds(400, 400)
def open(self, path, name, data): self.path = path self.name = name r = (40, 40, 400, 300) w = Win.NewWindow(r, name, 1, 0, -1, 1, 0x55555555) self.wid = w r2 = (0, 0, 345, 245) Qd.SetPort(w) Qd.TextFont(4) Qd.TextSize(9) self.ted = TE.TENew(r2, r2) self.ted.TEAutoView(1) self.ted.TESetText(data) w.DrawGrowIcon() self.scrollbars() self.changed = 0 self.do_postopen() self.do_activate(1, None)
8444507faf45eb14bc19be4371a766c05d684aa2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8444507faf45eb14bc19be4371a766c05d684aa2/ped.py
r2 = (0, 0, 345, 245)
vr = 0, 0, r[2]-r[0]-15, r[3]-r[1]-15 dr = (0, 0, vr[2], 0)
def open(self, path, name, data): self.path = path self.name = name r = (40, 40, 400, 300) w = Win.NewWindow(r, name, 1, 0, -1, 1, 0x55555555) self.wid = w r2 = (0, 0, 345, 245) Qd.SetPort(w) Qd.TextFont(4) Qd.TextSize(9) self.ted = TE.TENew(r2, r2) self.ted.TEAutoView(1) self.ted.TESetText(data) w.DrawGrowIcon() self.scrollbars() self.changed = 0 self.do_postopen() self.do_activate(1, None)
8444507faf45eb14bc19be4371a766c05d684aa2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8444507faf45eb14bc19be4371a766c05d684aa2/ped.py
self.ted = TE.TENew(r2, r2)
self.ted = TE.TENew(dr, vr)
def open(self, path, name, data): self.path = path self.name = name r = (40, 40, 400, 300) w = Win.NewWindow(r, name, 1, 0, -1, 1, 0x55555555) self.wid = w r2 = (0, 0, 345, 245) Qd.SetPort(w) Qd.TextFont(4) Qd.TextSize(9) self.ted = TE.TENew(r2, r2) self.ted.TEAutoView(1) self.ted.TESetText(data) w.DrawGrowIcon() self.scrollbars() self.changed = 0 self.do_postopen() self.do_activate(1, None)
8444507faf45eb14bc19be4371a766c05d684aa2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8444507faf45eb14bc19be4371a766c05d684aa2/ped.py
return vx, vy
return None, vy
def getscrollbarvalues(self): dr = self.ted.destRect vr = self.ted.viewRect height = self.ted.nLines * self.ted.lineHeight vx = self.scalebarvalue(dr[0], dr[2]-dr[0], vr[0], vr[2]) vy = self.scalebarvalue(dr[1], dr[1]+height, vr[1], vr[3]) print dr, vr, height, vx, vy return vx, vy
8444507faf45eb14bc19be4371a766c05d684aa2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8444507faf45eb14bc19be4371a766c05d684aa2/ped.py
if what == 'set': return if what == '-': delta = self.ted.viewRect[2]/10 elif what == '--': delta = self.ted.viewRect[2]/2 elif what == '+': delta = +self.ted.viewRect[2]/10 elif what == '++': delta = +self.ted.viewRect[2]/2 self.ted.TEPinScroll(delta, 0)
pass
def scrollbar_callback(self, which, what, value): if which == 'y': if what == 'set': height = self.ted.nLines * self.ted.lineHeight cur = self.getscrollbarvalues()[1] delta = (cur-value)*height/32767 if what == '-': delta = self.ted.lineHeight elif what == '--': delta = (self.ted.viewRect[3]-self.ted.lineHeight) if delta <= 0: delta = self.ted.lineHeight elif what == '+': delta = -self.ted.lineHeight elif what == '++': delta = -(self.ted.viewRect[3]-self.ted.lineHeight) if delta >= 0: delta = -self.ted.lineHeight self.ted.TEPinScroll(0, delta) print 'SCROLL Y', delta else: if what == 'set': return # XXXX if what == '-': delta = self.ted.viewRect[2]/10 elif what == '--': delta = self.ted.viewRect[2]/2 elif what == '+': delta = +self.ted.viewRect[2]/10 elif what == '++': delta = +self.ted.viewRect[2]/2 self.ted.TEPinScroll(delta, 0)
8444507faf45eb14bc19be4371a766c05d684aa2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8444507faf45eb14bc19be4371a766c05d684aa2/ped.py
for l in self._windows.values(): l.do_idle()
if self.active: self.active.do_idle()
def idle(self, *args): for l in self._windows.values(): l.do_idle()
8444507faf45eb14bc19be4371a766c05d684aa2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8444507faf45eb14bc19be4371a766c05d684aa2/ped.py
def handle(self): """Handle a single HTTP request. You normally don't need to override this method; see the class __doc__ string for information on how to handle specific HTTP commands such as GET and POST. """ self.raw_requestline = self.rfile.readline()
def parse_request(self): """Parse a request (internal). The request should be stored in self.raw_request; the results are in self.command, self.path, self.request_version and self.headers. Return value is 1 for success, 0 for failure; on failure, an error is sent back. """
def handle(self): """Handle a single HTTP request.
d65b53923ecefc96f24d9cbc4e3e83dd2194d6b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d65b53923ecefc96f24d9cbc4e3e83dd2194d6b4/BaseHTTPServer.py
return
return 0
def handle(self): """Handle a single HTTP request.
d65b53923ecefc96f24d9cbc4e3e83dd2194d6b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d65b53923ecefc96f24d9cbc4e3e83dd2194d6b4/BaseHTTPServer.py
return
return 0
def handle(self): """Handle a single HTTP request.
d65b53923ecefc96f24d9cbc4e3e83dd2194d6b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d65b53923ecefc96f24d9cbc4e3e83dd2194d6b4/BaseHTTPServer.py
return
return 0
def handle(self): """Handle a single HTTP request.
d65b53923ecefc96f24d9cbc4e3e83dd2194d6b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d65b53923ecefc96f24d9cbc4e3e83dd2194d6b4/BaseHTTPServer.py
mname = 'do_' + command
return 1 def handle(self): """Handle a single HTTP request. You normally don't need to override this method; see the class __doc__ string for information on how to handle specific HTTP commands such as GET and POST. """ self.raw_requestline = self.rfile.readline() if not self.parse_request(): return mname = 'do_' + self.command
def handle(self): """Handle a single HTTP request.
d65b53923ecefc96f24d9cbc4e3e83dd2194d6b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d65b53923ecefc96f24d9cbc4e3e83dd2194d6b4/BaseHTTPServer.py
self.send_error(501, "Unsupported method (%s)" % `command`)
self.send_error(501, "Unsupported method (%s)" % `self.command`)
def handle(self): """Handle a single HTTP request.
d65b53923ecefc96f24d9cbc4e3e83dd2194d6b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d65b53923ecefc96f24d9cbc4e3e83dd2194d6b4/BaseHTTPServer.py
return copy.copy(self)
data = self.data try: self.data = {} c = copy.copy(self) finally: self.data = data c.update(self) return c
def copy(self): if self.__class__ is UserDict: return UserDict(self.data) import copy return copy.copy(self)
3ce5af70e352b3a8fbea8e3f27464b6ca2d66ebd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3ce5af70e352b3a8fbea8e3f27464b6ca2d66ebd/UserDict.py
'tk' + version )
lib_prefix + 'tk' + version)
def detect_tkinter(self, inc_dirs, lib_dirs): # The _tkinter module.
bbe8961698de3a4e3e17512b6e88e9d7fcd52d4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/bbe8961698de3a4e3e17512b6e88e9d7fcd52d4e/setup.py
'tcl' + version )
lib_prefix + 'tcl' + version)
def detect_tkinter(self, inc_dirs, lib_dirs): # The _tkinter module.
bbe8961698de3a4e3e17512b6e88e9d7fcd52d4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/bbe8961698de3a4e3e17512b6e88e9d7fcd52d4e/setup.py
if platform == 'cygwin': x11_inc = find_file('X11/Xlib.h', [], inc_dirs) if x11_inc is None: return
def detect_tkinter(self, inc_dirs, lib_dirs): # The _tkinter module.
bbe8961698de3a4e3e17512b6e88e9d7fcd52d4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/bbe8961698de3a4e3e17512b6e88e9d7fcd52d4e/setup.py
libs.append('tk'+version) libs.append('tcl'+version)
libs.append(lib_prefix + 'tk'+ version) libs.append(lib_prefix + 'tcl'+ version)
def detect_tkinter(self, inc_dirs, lib_dirs): # The _tkinter module.
bbe8961698de3a4e3e17512b6e88e9d7fcd52d4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/bbe8961698de3a4e3e17512b6e88e9d7fcd52d4e/setup.py
return ""
def paren_open_event(self, event): self._remove_calltip_window() arg_text = get_arg_text(self.get_object_at_cursor()) if arg_text: self.calltip_start = self.text.index("insert") self.calltip = self._make_calltip_window() self.calltip.showtip(arg_text) # dont return "break" so the key is inserted.
6290dabdbbf19f2ad93bd7800226f2c6761c61b1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6290dabdbbf19f2ad93bd7800226f2c6761c61b1/CallTips.py
def paren_close_event(self, event): # Now just hides, but later we should check if other # paren'd expressions remain open. # dont return "break" so the key is inserted. self._remove_calltip_window()
6290dabdbbf19f2ad93bd7800226f2c6761c61b1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6290dabdbbf19f2ad93bd7800226f2c6761c61b1/CallTips.py
return "" def calltip_cancel_event(self, event): self._remove_calltip_window() return ""
def check_calltip_cancel_event(self, event): # This doesnt quite work correctly as it is processed # _before_ the key is handled. Thus, when the "Up" key # is pressed, this test happens before the cursor is moved. # This will do for now. if self.calltip: # If we have moved before the start of the calltip, # or off the calltip line, then cancel the tip. # (Later need to be smarter about multi-line, etc) if self.text.compare("insert", "<=", self.calltip_start) or \ self.text.compare("insert", ">", self.calltip_start + " lineend"): self._remove_calltip_window() # dont return "break" so the event is handled normally.
6290dabdbbf19f2ad93bd7800226f2c6761c61b1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6290dabdbbf19f2ad93bd7800226f2c6761c61b1/CallTips.py
index = 0 while 1: index = index + 1 indexspec = "insert-%dc" % index ch = text.get(indexspec) if ch not in wordchars: break if text.compare(indexspec, "<=", "1.0"): break word = text.get("insert-%dc" % (index-1,), "insert") if word:
chars = text.get("insert linestart", "insert") i = len(chars) while i and chars[i-1] in wordchars: i = i-1 word = chars[i:] if word:
def get_object_at_cursor(self, wordchars="._" + string.uppercase + string.lowercase + string.digits): # XXX - This need to be moved to a better place # as the "." attribute lookup code can also use it. text = self.text index = 0 while 1: index = index + 1 indexspec = "insert-%dc" % index ch = text.get(indexspec) if ch not in wordchars: break if text.compare(indexspec, "<=", "1.0"): break # Now attempt to locate the object.
6290dabdbbf19f2ad93bd7800226f2c6761c61b1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6290dabdbbf19f2ad93bd7800226f2c6761c61b1/CallTips.py
def get_object_at_cursor(self, wordchars="._" + string.uppercase + string.lowercase + string.digits): # XXX - This need to be moved to a better place # as the "." attribute lookup code can also use it. text = self.text index = 0 while 1: index = index + 1 indexspec = "insert-%dc" % index ch = text.get(indexspec) if ch not in wordchars: break if text.compare(indexspec, "<=", "1.0"): break # Now attempt to locate the object.
6290dabdbbf19f2ad93bd7800226f2c6761c61b1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6290dabdbbf19f2ad93bd7800226f2c6761c61b1/CallTips.py
if not argText and hasattr(ob, "__doc__") and ob.__doc__:
if hasattr(ob, "__doc__") and ob.__doc__:
def get_arg_text(ob): # Get a string describing the arguments for the given object. argText = "" if ob is not None: argOffset = 0 # bit of a hack for methods - turn it into a function # but we drop the "self" param. if type(ob)==types.MethodType: ob = ob.im_func argOffset = 1 # Try and build one for Python defined functions if type(ob) in [types.FunctionType, types.LambdaType]: try: realArgs = ob.func_code.co_varnames[argOffset:ob.func_code.co_argcount] defaults = ob.func_defaults or [] defaults = list(map(lambda name: "=%s" % name, defaults)) defaults = [""] * (len(realArgs)-len(defaults)) + defaults argText = string.join( map(lambda arg, dflt: arg+dflt, realArgs, defaults), ", ") if len(realArgs)+argOffset < (len(ob.func_code.co_varnames) - len(ob.func_code.co_names) ): if argText: argText = argText + ", " argText = argText + "..." argText = "(%s)" % argText except: pass # Can't build an argument list - see if we can use a docstring. if not argText and hasattr(ob, "__doc__") and ob.__doc__: pos = string.find(ob.__doc__, "\n") if pos<0 or pos>70: pos=70 argText = ob.__doc__[:pos] return argText
6290dabdbbf19f2ad93bd7800226f2c6761c61b1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6290dabdbbf19f2ad93bd7800226f2c6761c61b1/CallTips.py
argText = ob.__doc__[:pos]
if argText: argText = argText + "\n" argText = argText + ob.__doc__[:pos]
def get_arg_text(ob): # Get a string describing the arguments for the given object. argText = "" if ob is not None: argOffset = 0 # bit of a hack for methods - turn it into a function # but we drop the "self" param. if type(ob)==types.MethodType: ob = ob.im_func argOffset = 1 # Try and build one for Python defined functions if type(ob) in [types.FunctionType, types.LambdaType]: try: realArgs = ob.func_code.co_varnames[argOffset:ob.func_code.co_argcount] defaults = ob.func_defaults or [] defaults = list(map(lambda name: "=%s" % name, defaults)) defaults = [""] * (len(realArgs)-len(defaults)) + defaults argText = string.join( map(lambda arg, dflt: arg+dflt, realArgs, defaults), ", ") if len(realArgs)+argOffset < (len(ob.func_code.co_varnames) - len(ob.func_code.co_names) ): if argText: argText = argText + ", " argText = argText + "..." argText = "(%s)" % argText except: pass # Can't build an argument list - see if we can use a docstring. if not argText and hasattr(ob, "__doc__") and ob.__doc__: pos = string.find(ob.__doc__, "\n") if pos<0 or pos>70: pos=70 argText = ob.__doc__[:pos] return argText
6290dabdbbf19f2ad93bd7800226f2c6761c61b1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6290dabdbbf19f2ad93bd7800226f2c6761c61b1/CallTips.py
def t6(self, a, b=None, *args, **kw): "(a, b=None, ...)"
6290dabdbbf19f2ad93bd7800226f2c6761c61b1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6290dabdbbf19f2ad93bd7800226f2c6761c61b1/CallTips.py
if get_arg_text(t) != t.__doc__:
if get_arg_text(t) != t.__doc__ + "\n" + t.__doc__:
def test( tests ): failed=[] for t in tests: if get_arg_text(t) != t.__doc__: failed.append(t) print "%s - expected %s, but got %s" % (t, `t.__doc__`, `get_arg_text(t)`) print "%d of %d tests failed" % (len(failed), len(tests))
6290dabdbbf19f2ad93bd7800226f2c6761c61b1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6290dabdbbf19f2ad93bd7800226f2c6761c61b1/CallTips.py
tc = TC() tests = t1, t2, t3, t4, t5, t6, \ tc.t1, tc.t2, tc.t3, tc.t4, tc.t5, tc.t6
tc = TC() tests = t1, t2, t3, t4, t5, t6, \ tc.t1, tc.t2, tc.t3, tc.t4, tc.t5, tc.t6
def test( tests ): failed=[] for t in tests: if get_arg_text(t) != t.__doc__: failed.append(t) print "%s - expected %s, but got %s" % (t, `t.__doc__`, `get_arg_text(t)`) print "%d of %d tests failed" % (len(failed), len(tests))
6290dabdbbf19f2ad93bd7800226f2c6761c61b1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6290dabdbbf19f2ad93bd7800226f2c6761c61b1/CallTips.py
print 'XXX', (_function, (_object,), _parameters)
def callback_wrapper(self, _request, _reply): _parameters, _attributes = aetools.unpackevent(_request) _class = _attributes['evcl'].type _type = _attributes['evid'].type if self.ae_handlers.has_key((_class, _type)): _function = self.ae_handlers[(_class, _type)] elif self.ae_handlers.has_key((_class, '****')): _function = self.ae_handlers[(_class, '****')] elif self.ae_handlers.has_key(('****', '****')): _function = self.ae_handlers[('****', '****')] else: raise 'Cannot happen: AE callback without handler', (_class, _type) # XXXX Do key-to-name mapping here _parameters['_attributes'] = _attributes _parameters['_class'] = _class _parameters['_type'] = _type if _parameters.has_key('----'): _object = _parameters['----'] del _parameters['----'] print 'XXX', (_function, (_object,), _parameters) try: rv = apply(_function, (_object,), _parameters) except TypeError, name: raise TypeError, ('AppleEvent handler misses formal keyword argument', _function, name) else: try: rv = apply(_function, (), _parameters) except TypeError, name: raise TypeError, ('AppleEvent handler misses formal keyword argument', _function, name) if rv == None: aetools.packevent(_reply, {}) else: aetools.packevent(_reply, {'----':rv})
260400f3f5e13aa005f5cf16efcd063a59f282d6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/260400f3f5e13aa005f5cf16efcd063a59f282d6/MiniAEFrame.py
def _strxor(s1, s2): """Utility method. XOR the two strings s1 and s2 (must have same length). """ return "".join(map(lambda x, y: chr(ord(x) ^ ord(y)), s1, s2))
trans_5C = "".join ([chr (x ^ 0x5C) for x in xrange(256)]) trans_36 = "".join ([chr (x ^ 0x36) for x in xrange(256)])
def _strxor(s1, s2): """Utility method. XOR the two strings s1 and s2 (must have same length). """ return "".join(map(lambda x, y: chr(ord(x) ^ ord(y)), s1, s2))
8fe2d2015dc57e4e048f733c7fbb5c0712b05d15 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8fe2d2015dc57e4e048f733c7fbb5c0712b05d15/hmac.py
ipad = "\x36" * blocksize opad = "\x5C" * blocksize
def __init__(self, key, msg = None, digestmod = None): """Create a new HMAC object.
8fe2d2015dc57e4e048f733c7fbb5c0712b05d15 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8fe2d2015dc57e4e048f733c7fbb5c0712b05d15/hmac.py
self.outer.update(_strxor(key, opad)) self.inner.update(_strxor(key, ipad))
self.outer.update(key.translate(trans_5C)) self.inner.update(key.translate(trans_36))
def __init__(self, key, msg = None, digestmod = None): """Create a new HMAC object.
8fe2d2015dc57e4e048f733c7fbb5c0712b05d15 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8fe2d2015dc57e4e048f733c7fbb5c0712b05d15/hmac.py