rem
stringlengths 1
322k
| add
stringlengths 0
2.05M
| context
stringlengths 4
228k
| meta
stringlengths 156
215
|
---|---|---|---|
return map(None, seq, [green] * numchips, seq) | return map(None, [red] * numchips, seq, [blue] * numchips) | def constant_green_generator(numchips, rgbtuple): green = rgbtuple[1] seq = constant(numchips) return map(None, seq, [green] * numchips, seq) | e10878d5f8603091dc00ff8dc60580c3215dc39a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e10878d5f8603091dc00ff8dc60580c3215dc39a/PyncheWidget.py |
def constant_blue_generator(numchips, rgbtuple): blue = rgbtuple[2] | def constant_yellow_generator(numchips, rgbtuple): red, green, blue = rgbtuple | def constant_blue_generator(numchips, rgbtuple): blue = rgbtuple[2] seq = constant(numchips) return map(None, seq, seq, [blue] * numchips) | e10878d5f8603091dc00ff8dc60580c3215dc39a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e10878d5f8603091dc00ff8dc60580c3215dc39a/PyncheWidget.py |
return map(None, seq, seq, [blue] * numchips) | return map(None, [red] * numchips, [green] * numchips, seq) | def constant_blue_generator(numchips, rgbtuple): blue = rgbtuple[2] seq = constant(numchips) return map(None, seq, seq, [blue] * numchips) | e10878d5f8603091dc00ff8dc60580c3215dc39a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e10878d5f8603091dc00ff8dc60580c3215dc39a/PyncheWidget.py |
generator=constant_red_generator) | generator=constant_cyan_generator, axis=0) | def __init__(self, colordb, parent=None, **kw): | e10878d5f8603091dc00ff8dc60580c3215dc39a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e10878d5f8603091dc00ff8dc60580c3215dc39a/PyncheWidget.py |
generator=constant_blue_generator) | generator=constant_magenta_generator, axis=1) | def __init__(self, colordb, parent=None, **kw): | e10878d5f8603091dc00ff8dc60580c3215dc39a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e10878d5f8603091dc00ff8dc60580c3215dc39a/PyncheWidget.py |
generator=constant_green_generator) | generator=constant_yellow_generator, axis=2) | def __init__(self, colordb, parent=None, **kw): | e10878d5f8603091dc00ff8dc60580c3215dc39a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e10878d5f8603091dc00ff8dc60580c3215dc39a/PyncheWidget.py |
pat = re.compile(r'^\s*def\s') | pat = re.compile(r'^(\s*def\s)|(.*\slambda(:|\s))') | 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) 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') while lnum > 0: if pat.match(lines[lnum]): break lnum = lnum - 1 return lines, lnum raise IOError, 'could not find code object' | c9d68a76c2d61dbb01f052d025b1dfd7bd95ad0d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c9d68a76c2d61dbb01f052d025b1dfd7bd95ad0d/inspect.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) | d48918b80770eace9318a1b25c79121719ca1b9f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d48918b80770eace9318a1b25c79121719ca1b9f/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) | d48918b80770eace9318a1b25c79121719ca1b9f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d48918b80770eace9318a1b25c79121719ca1b9f/Tkinter.py |
def opendbm(filename, mode, perm): return Dbm().init(filename, mode, perm) | def opendbm(filename, mode, perm): return Dbm().init(filename, mode, perm) | 21527a87d1d78b837789d38e35beceaedf5c71ea /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/21527a87d1d78b837789d38e35beceaedf5c71ea/Dbm.py |
|
def init(self, filename, mode, perm): | def __init__(self, filename, mode, perm): | def init(self, filename, mode, perm): import dbm self.db = dbm.open(filename, mode, perm) return self | 21527a87d1d78b837789d38e35beceaedf5c71ea /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/21527a87d1d78b837789d38e35beceaedf5c71ea/Dbm.py |
return self | def init(self, filename, mode, perm): import dbm self.db = dbm.open(filename, mode, perm) return self | 21527a87d1d78b837789d38e35beceaedf5c71ea /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/21527a87d1d78b837789d38e35beceaedf5c71ea/Dbm.py |
|
if s: t = t + ', ' | if s: t = ', ' + t | def __repr__(self): s = '' for key in self.keys(): t = `key` + ': ' + `self[key]` if s: t = t + ', ' s = s + t return '{' + s + '}' | 21527a87d1d78b837789d38e35beceaedf5c71ea /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/21527a87d1d78b837789d38e35beceaedf5c71ea/Dbm.py |
{'fill': 'red', 'tags': 'box'}) | {'fill': 'blue', 'tags': 'box'}) | def __init__(self, master=None, cnf={}): Canvas.__init__(self, master, {'width': 100, 'height': 100}) Canvas.config(self, cnf) self.create_rectangle(30, 30, 70, 70, {'fill': 'red', 'tags': 'box'}) Canvas.bind(self, 'box', '<Enter>', self.enter) Canvas.bind(self, 'box', '<Leave>', self.leave) | c47726f7c1cb72784731f36a735ee974e13ef560 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c47726f7c1cb72784731f36a735ee974e13ef560/tst.py |
_urandomfd = None | def _pickle_statvfs_result(sr): (type, args) = sr.__reduce__() return (_make_statvfs_result, args) | 433311e3d9002ddfbaf85544e58babc73e805510 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/433311e3d9002ddfbaf85544e58babc73e805510/os.py |
|
global _urandomfd if _urandomfd is None: try: _urandomfd = open("/dev/urandom", O_RDONLY) except: _urandomfd = NotImplementedError if _urandomfd is NotImplementedError: | try: _urandomfd = open("/dev/urandom", O_RDONLY) except: | def urandom(n): """urandom(n) -> str | 433311e3d9002ddfbaf85544e58babc73e805510 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/433311e3d9002ddfbaf85544e58babc73e805510/os.py |
dist = self.distribution | metadata = self.distribution.metadata | def check_metadata (self): | ec9b50d5b1070cef40eec6dcd6263817bfabb14a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ec9b50d5b1070cef40eec6dcd6263817bfabb14a/sdist.py |
if not (hasattr (dist, attr) and getattr (dist, attr)): | if not (hasattr (metadata, attr) and getattr (metadata, attr)): | def check_metadata (self): | ec9b50d5b1070cef40eec6dcd6263817bfabb14a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ec9b50d5b1070cef40eec6dcd6263817bfabb14a/sdist.py |
if dist.author: if not dist.author_email: | if metadata.author: if not metadata.author_email: | def check_metadata (self): | ec9b50d5b1070cef40eec6dcd6263817bfabb14a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ec9b50d5b1070cef40eec6dcd6263817bfabb14a/sdist.py |
elif dist.maintainer: if not dist.maintainer_email: | elif metadata.maintainer: if not metadata.maintainer_email: | def check_metadata (self): | ec9b50d5b1070cef40eec6dcd6263817bfabb14a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ec9b50d5b1070cef40eec6dcd6263817bfabb14a/sdist.py |
ic.launcurl(url) | ic.launchurl(url) | def open(self, url, new=0): ic.launcurl(url) | c0673590de24990b8d0bed0d4e20724780768eac /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c0673590de24990b8d0bed0d4e20724780768eac/webbrowser.py |
except RuntimeError: | except (RuntimeError, MacOS.Error): | def _mac_ver_lookup(selectors,default=None): from gestalt import gestalt l = [] append = l.append for selector in selectors: try: append(gestalt(selector)) except RuntimeError: append(default) return l | 09d60c3702c7dda56f51eaa1bf12bf2d8b2bd88a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/09d60c3702c7dda56f51eaa1bf12bf2d8b2bd88a/platform.py |
unquote(password))) | unquote(password))).strip() | def proxy_open(self, req, proxy, type): orig_type = req.get_type() type, r_type = splittype(proxy) host, XXX = splithost(r_type) if '@' in host: user_pass, host = host.split('@', 1) if ':' in user_pass: user, password = user_pass.split(':', 1) user_pass = base64.encodestring('%s:%s' % (unquote(user), unquote(password))) req.add_header('Proxy-authorization', 'Basic ' + user_pass) host = unquote(host) req.set_proxy(host, type) if orig_type == type: # let other handlers take care of it # XXX this only makes sense if the proxy is before the # other handlers return None else: # need to start over, because the other handlers don't # grok the proxy's URL type return self.parent.open(req) | da8217604a2351d0d092f65f08632246bb04fc1c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/da8217604a2351d0d092f65f08632246bb04fc1c/urllib2.py |
return '<Coerce %s>' % self.arg | return '<CoerceNumber %s>' % repr(self.arg) | def __repr__(self): return '<Coerce %s>' % self.arg | 6a95b5e630e4f5194e78dc56de0639e29b8e1b5b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/6a95b5e630e4f5194e78dc56de0639e29b8e1b5b/test_coercion.py |
if isinstance(other, Coerce): | if isinstance(other, CoerceNumber): | def __coerce__(self, other): if isinstance(other, Coerce): return self.arg, other.arg else: return (self.arg, other) | 6a95b5e630e4f5194e78dc56de0639e29b8e1b5b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/6a95b5e630e4f5194e78dc56de0639e29b8e1b5b/test_coercion.py |
class Cmp: | class MethodNumber: | def __coerce__(self, other): if isinstance(other, Coerce): return self.arg, other.arg else: return (self.arg, other) | 6a95b5e630e4f5194e78dc56de0639e29b8e1b5b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/6a95b5e630e4f5194e78dc56de0639e29b8e1b5b/test_coercion.py |
return '<Cmp %s>' % self.arg | return '<MethodNumber %s>' % repr(self.arg) def __add__(self,other): return self.arg + other def __radd__(self,other): return other + self.arg def __sub__(self,other): return self.arg - other def __rsub__(self,other): return other - self.arg def __mul__(self,other): return self.arg * other def __rmul__(self,other): return other * self.arg def __div__(self,other): return self.arg / other def __rdiv__(self,other): return other / self.arg def __pow__(self,other): return self.arg ** other def __rpow__(self,other): return other ** self.arg def __mod__(self,other): return self.arg % other def __rmod__(self,other): return other % self.arg | def __repr__(self): return '<Cmp %s>' % self.arg | 6a95b5e630e4f5194e78dc56de0639e29b8e1b5b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/6a95b5e630e4f5194e78dc56de0639e29b8e1b5b/test_coercion.py |
class RCmp: def __init__(self,arg): self.arg = arg | def __cmp__(self, other): return cmp(self.arg, other) | 6a95b5e630e4f5194e78dc56de0639e29b8e1b5b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/6a95b5e630e4f5194e78dc56de0639e29b8e1b5b/test_coercion.py |
|
def __repr__(self): return '<RCmp %s>' % self.arg | candidates = [ 2, 2.2, 2L, 2+4j, [1], (2,), None, MethodNumber(1), CoerceNumber(8)] | def __repr__(self): return '<RCmp %s>' % self.arg | 6a95b5e630e4f5194e78dc56de0639e29b8e1b5b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/6a95b5e630e4f5194e78dc56de0639e29b8e1b5b/test_coercion.py |
def __rcmp__(self, other): return cmp(other, self.arg) | infix_binops = [ '+', '-', '*', '/', '**', '%' ] prefix_binops = [ 'divmod' ] | def __rcmp__(self, other): return cmp(other, self.arg) | 6a95b5e630e4f5194e78dc56de0639e29b8e1b5b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/6a95b5e630e4f5194e78dc56de0639e29b8e1b5b/test_coercion.py |
candidates = [2, 2.2, 2L, 2+4j, [1], (2,), None, Empty(), Coerce(3), Cmp(4), RCmp(5)] def test(): | def do_infix_binops(): | def __rcmp__(self, other): return cmp(other, self.arg) | 6a95b5e630e4f5194e78dc56de0639e29b8e1b5b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/6a95b5e630e4f5194e78dc56de0639e29b8e1b5b/test_coercion.py |
self._file_.close() | if hasattr(self, "_file_"): self._file_.close() | def __del__(self): self._file_.close() | d80f510db41256167be4a1f1f4932ca622e64ad8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d80f510db41256167be4a1f1f4932ca622e64ad8/posixfile.py |
print "Will rollover at %d, %d seconds from now" % (self.rolloverAt, self.rolloverAt - currentTime) | def __init__(self, filename, when='h', interval=1, backupCount=0): BaseRotatingHandler.__init__(self, filename, 'a') 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) | dde4dc25f59403a6279aff216bdf3df43f106fb7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/dde4dc25f59403a6279aff216bdf3df43f106fb7/handlers.py |
|
print "No need to rollover: %d, %d" % (t, self.rolloverAt) | def shouldRollover(self, record): """ Determine if rollover should occur | dde4dc25f59403a6279aff216bdf3df43f106fb7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/dde4dc25f59403a6279aff216bdf3df43f106fb7/handlers.py |
|
print "%s -> %s" % (self.baseFilename, dfn) | def doRollover(self): """ do a rollover; in this case, a date/time stamp is appended to the filename when the rollover happens. However, you want the file to be named for the start of the interval, not the current time. If there is a backup count, then we have to get a list of matching filenames, sort them and remove the one with the oldest suffix. """ self.stream.close() # get the time that this sequence started at and make it a TimeTuple t = self.rolloverAt - self.interval timeTuple = time.localtime(t) dfn = self.baseFilename + "." + time.strftime(self.suffix, timeTuple) if os.path.exists(dfn): os.remove(dfn) os.rename(self.baseFilename, dfn) if self.backupCount > 0: # find the oldest log file and delete it s = glob.glob(self.baseFilename + ".20*") if len(s) > self.backupCount: os.remove(s[0]) print "%s -> %s" % (self.baseFilename, dfn) self.stream = open(self.baseFilename, "w") self.rolloverAt = int(time.time()) + self.interval | dde4dc25f59403a6279aff216bdf3df43f106fb7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/dde4dc25f59403a6279aff216bdf3df43f106fb7/handlers.py |
|
if self._file: self.close() | self.close() | def __del__(self): if self._file: self.close() | a8f391c2c220946b48f7513e29bd3028f18fed24 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a8f391c2c220946b48f7513e29bd3028f18fed24/wave.py |
self._ensure_header_written(0) if self._datalength != self._datawritten: self._patchheader() self._file.flush() self._file = None | if self._file: self._ensure_header_written(0) if self._datalength != self._datawritten: self._patchheader() self._file.flush() self._file = None if self._i_opened_the_file: self._i_opened_the_file.close() self._i_opened_the_file = None | def close(self): self._ensure_header_written(0) if self._datalength != self._datawritten: self._patchheader() self._file.flush() self._file = None | a8f391c2c220946b48f7513e29bd3028f18fed24 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a8f391c2c220946b48f7513e29bd3028f18fed24/wave.py |
for i in range(100): | for i in range(60): | def test_nonrecursive_deep(self): a = [] for i in range(100): a = [a] b = self.loads(self.dumps(a)) self.assertEqual(a, b) | d7103cca02a3aec9677d344632358b2c4b01473c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d7103cca02a3aec9677d344632358b2c4b01473c/test_cpickle.py |
self.assertEqual(pwd.getpwuid(e.pw_uid), e) | entriesbyuid.setdefault(e.pw_uid, []).append(e) for e in entries: self.assert_(pwd.getpwuid(e.pw_uid) in entriesbyuid[e.pw_uid]) | def test_values(self): entries = pwd.getpwall() | 5afc317d1b6be5aa697e4a4f3d60c5670ebb8094 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5afc317d1b6be5aa697e4a4f3d60c5670ebb8094/test_pwd.py |
ainv = _sqrt(2.0 * alpha - 1.0) return beta * self.stdgamma(alpha, ainv, alpha - LOG4, alpha + ainv) def stdgamma(self, alpha, ainv, bbb, ccc): | return beta * self.stdgamma(alpha) def stdgamma(self, alpha, *args): | def gammavariate(self, alpha, beta): # beta times standard gamma ainv = _sqrt(2.0 * alpha - 1.0) return beta * self.stdgamma(alpha, ainv, alpha - LOG4, alpha + ainv) | 9c8c9dd6238fd41860faf2ce82a1b1a03d1eed87 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9c8c9dd6238fd41860faf2ce82a1b1a03d1eed87/random.py |
return 1 | return self.robots[root].can_fetch(AGENTNAME, url) | def inroots(self, url): | c0b2bc5762372c26f59bac6bcac026293de24a36 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c0b2bc5762372c26f59bac6bcac026293de24a36/webchecker.py |
print "Redirected to", nurl | print " Redirected to", nurl | def getpage(self, url): | c0b2bc5762372c26f59bac6bcac026293de24a36 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c0b2bc5762372c26f59bac6bcac026293de24a36/webchecker.py |
outf.write(" (os.path.normpath(sys.executable), post_interp)) | if not sysconfig.python_build: outf.write(" (os.path.normpath(sys.executable), post_interp)) else: outf.write(" (os.path.join( sysconfig.get_config_var("BINDIR"), "python" + sysconfig.get_config_var("EXE")), post_interp)) | def copy_scripts (self): """Copy each script listed in 'self.scripts'; if it's marked as a Python script in the Unix way (first line matches 'first_line_re', ie. starts with "\#!" and contains "python"), then adjust the first line to refer to the current Python interpreter as we copy. """ self.mkpath(self.build_dir) for script in self.scripts: adjust = 0 script = convert_path(script) outfile = os.path.join(self.build_dir, os.path.basename(script)) | f35ed392816d14efa2414767c4da317d8d3dcd38 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f35ed392816d14efa2414767c4da317d8d3dcd38/build_scripts.py |
ssl_incs = find_file('openssl/ssl.h', inc_dirs, | ssl_incs = find_file('openssl/ssl.h', self.compiler.include_dirs, | 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') | b69e38840fee152b7714555a1afe767558e2bfc8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b69e38840fee152b7714555a1afe767558e2bfc8/setup.py |
f = file(fullname, "rU") | f = open(fullname, "rU") | def addpackage(sitedir, name, known_paths): """Add a new path to known_paths by combining sitedir and 'name' or execute sitedir if it starts with 'import'""" if known_paths is None: _init_pathinfo() reset = 1 else: reset = 0 fullname = os.path.join(sitedir, name) try: f = file(fullname, "rU") except IOError: return try: for line in f: if line.startswith("#"): continue if line.startswith("import"): exec line continue line = line.rstrip() dir, dircase = makepath(sitedir, line) if not dircase in known_paths and os.path.exists(dir): sys.path.append(dir) known_paths.add(dircase) finally: f.close() if reset: known_paths = None return known_paths | 1db802727007dd26fad7a6958c0219b636b20028 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1db802727007dd26fad7a6958c0219b636b20028/site.py |
d = _init_pathinfo() | known_paths = _init_pathinfo() | def addsitedir(sitedir, known_paths=None): """Add 'sitedir' argument to sys.path if missing and handle .pth files in 'sitedir'""" if known_paths is None: d = _init_pathinfo() reset = 1 else: reset = 0 sitedir, sitedircase = makepath(sitedir) if not sitedircase in known_paths: sys.path.append(sitedir) # Add path component try: names = os.listdir(sitedir) except os.error: return names.sort() for name in names: if name[-4:] == os.extsep + "pth": addpackage(sitedir, name, known_paths) if reset: known_paths = None return known_paths | 1db802727007dd26fad7a6958c0219b636b20028 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1db802727007dd26fad7a6958c0219b636b20028/site.py |
if name[-4:] == os.extsep + "pth": | if name.endswith(os.extsep + "pth"): | def addsitedir(sitedir, known_paths=None): """Add 'sitedir' argument to sys.path if missing and handle .pth files in 'sitedir'""" if known_paths is None: d = _init_pathinfo() reset = 1 else: reset = 0 sitedir, sitedircase = makepath(sitedir) if not sitedircase in known_paths: sys.path.append(sitedir) # Add path component try: names = os.listdir(sitedir) except os.error: return names.sort() for name in names: if name[-4:] == os.extsep + "pth": addpackage(sitedir, name, known_paths) if reset: known_paths = None return known_paths | 1db802727007dd26fad7a6958c0219b636b20028 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1db802727007dd26fad7a6958c0219b636b20028/site.py |
objects = self.object_filenames(sources, 0, outdir) | objects = self.object_filenames(sources, strip_dir=python_build, output_dir=outdir) | def _setup_compile(self, outdir, macros, incdirs, sources, depends, extra): """Process arguments and decide which source files to compile. | c1db69e2f0e898fd38d4417117e8c11a8331b622 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c1db69e2f0e898fd38d4417117e8c11a8331b622/ccompiler.py |
objects = self.object_filenames(sources, strip_dir=0, | objects = self.object_filenames(sources, strip_dir=python_build, | def _prep_compile(self, sources, output_dir, depends=None): """Decide which souce files must be recompiled. | c1db69e2f0e898fd38d4417117e8c11a8331b622 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c1db69e2f0e898fd38d4417117e8c11a8331b622/ccompiler.py |
if len (line) > 0 and line[0] != ' self.onecmd (line) | if len(line) > 0 and line[0] != ' self.onecmd(line) | def execRcLines(self): if self.rcLines: # Make local copy because of recursion rcLines = self.rcLines # executed only once self.rcLines = [] for line in rcLines: line = line[:-1] if len (line) > 0 and line[0] != '#': self.onecmd (line) | d9a24295df71ae63932b3bee3df16f93d169f7fd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9a24295df71ae63932b3bee3df16f93d169f7fd/pdb.py |
if not line: | if not line.strip(): | def precmd(self, line): """Handle alias expansion and ';;' separator.""" if not line: return line args = line.split() while args[0] in self.aliases: line = self.aliases[args[0]] ii = 1 for tmpArg in args[1:]: line = line.replace("%" + str(ii), tmpArg) ii = ii + 1 line = line.replace("%*", ' '.join(args[1:])) args = line.split() # split into ';;' separated commands # unless it's an alias command if args[0] != 'alias': marker = line.find(';;') if marker >= 0: # queue up everything after marker next = line[marker+2:].lstrip() self.cmdqueue.append(next) line = line[:marker].rstrip() return line | d9a24295df71ae63932b3bee3df16f93d169f7fd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9a24295df71ae63932b3bee3df16f93d169f7fd/pdb.py |
if ( not line or (line[0] == ' (line[:3] == '"""') or line[:3] == "'''" ): | if (not line or (line[0] == ' (line[:3] == '"""') or line[:3] == "'''"): | def checkline(self, filename, lineno): """Return line number of first line at or after input argument such that if the input points to a 'def', the returned line number is the first non-blank/non-comment line to follow. If the input points to a blank or comment line, return 0. At end of file, also return 0.""" | d9a24295df71ae63932b3bee3df16f93d169f7fd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9a24295df71ae63932b3bee3df16f93d169f7fd/pdb.py |
if (count > 0): | if count > 0: | def do_ignore(self,arg): """arg is bp number followed by ignore count.""" args = arg.split() bpnum = int(args[0].strip()) try: count = int(args[1].strip()) except: count = 0 bp = bdb.Breakpoint.bpbynumber[bpnum] if bp: bp.ignore = count if (count > 0): reply = 'Will ignore next ' if (count > 1): reply = reply + '%d crossings' % count else: reply = reply + '1 crossing' print reply + ' of breakpoint %d.' % bpnum else: print 'Will stop next time breakpoint', print bpnum, 'is reached.' | d9a24295df71ae63932b3bee3df16f93d169f7fd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9a24295df71ae63932b3bee3df16f93d169f7fd/pdb.py |
if (count > 1): | if count > 1: | def do_ignore(self,arg): """arg is bp number followed by ignore count.""" args = arg.split() bpnum = int(args[0].strip()) try: count = int(args[1].strip()) except: count = 0 bp = bdb.Breakpoint.bpbynumber[bpnum] if bp: bp.ignore = count if (count > 0): reply = 'Will ignore next ' if (count > 1): reply = reply + '%d crossings' % count else: reply = reply + '1 crossing' print reply + ' of breakpoint %d.' % bpnum else: print 'Will stop next time breakpoint', print bpnum, 'is reached.' | d9a24295df71ae63932b3bee3df16f93d169f7fd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9a24295df71ae63932b3bee3df16f93d169f7fd/pdb.py |
if args[0] in self.aliases and len (args) == 1: | if args[0] in self.aliases and len(args) == 1: | def do_alias(self, arg): args = arg.split() if len(args) == 0: keys = self.aliases.keys() keys.sort() for alias in keys: print "%s = %s" % (alias, self.aliases[alias]) return if args[0] in self.aliases and len (args) == 1: print "%s = %s" % (args[0], self.aliases[args[0]]) else: self.aliases[args[0]] = ' '.join(args[1:]) | d9a24295df71ae63932b3bee3df16f93d169f7fd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d9a24295df71ae63932b3bee3df16f93d169f7fd/pdb.py |
if auth: h.putheader('Authorization: Basic %s' % auth) | if auth: h.putheader('Authorization', 'Basic %s' % auth) | def open_http(self, url): 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) == 'http': realhost, rest = splithost(rest) user_passwd, realhost = splituser(realhost) if user_passwd: selector = "%s://%s%s" % (urltype, realhost, rest) print "proxy via http:", host, selector if not host: raise IOError, ('http error', 'no host given') if user_passwd: import base64 auth = string.strip(base64.encodestring(user_passwd)) else: auth = None h = httplib.HTTP(host) 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, self.openedurl) else: return self.http_error(url, fp, errcode, errmsg, headers) | 64028c5ebbac1b4b4f3abac387412acc83a26382 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/64028c5ebbac1b4b4f3abac387412acc83a26382/urllib.py |
try: f = eval('self.repr_' + typename) except AttributeError: | if hasattr(self, 'repr_' + typename): return getattr(self, 'repr_' + typename)(x, level) else: | def repr1(self, x, level): typename = `type(x)`[7:-2] # "<type '......'>" if ' ' in typename: parts = string.split(typename) typename = string.joinfields(parts, '_') try: f = eval('self.repr_' + typename) except AttributeError: s = `x` if len(s) > self.maxother: i = max(0, (self.maxother-3)/2) j = max(0, self.maxother-3-i) s = s[:i] + '...' + s[len(s)-j:] return s return f(x, level) | f3775a38cfbba67355ad0aeb745eb66f773ff768 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f3775a38cfbba67355ad0aeb745eb66f773ff768/repr.py |
return f(x, level) | def repr1(self, x, level): typename = `type(x)`[7:-2] # "<type '......'>" if ' ' in typename: parts = string.split(typename) typename = string.joinfields(parts, '_') try: f = eval('self.repr_' + typename) except AttributeError: s = `x` if len(s) > self.maxother: i = max(0, (self.maxother-3)/2) j = max(0, self.maxother-3-i) s = s[:i] + '...' + s[len(s)-j:] return s return f(x, level) | f3775a38cfbba67355ad0aeb745eb66f773ff768 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f3775a38cfbba67355ad0aeb745eb66f773ff768/repr.py |
|
if type(to_addrs) == types.StringType: | if isinstance(to_addrs, types.StringTypes): | def sendmail(self, from_addr, to_addrs, msg, mail_options=[], rcpt_options=[]): """This command performs an entire mail transaction. | cc3c42daea05d8618e7274c76411c4d55b1070ac /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/cc3c42daea05d8618e7274c76411c4d55b1070ac/smtplib.py |
TypeError: iteration over non-sequence | TypeError: 'int' object is not iterable | >>> def f(n): | 90395f96050468f54122da0d197492ebf749d331 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/90395f96050468f54122da0d197492ebf749d331/test_genexps.py |
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') | 2e22caa4a40440485b69f16bb96ffd5bfce643bd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2e22caa4a40440485b69f16bb96ffd5bfce643bd/setup.py |
||
version_req = '"1.1.4"' | version_req = '"1.1.3"' | 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') | 2e22caa4a40440485b69f16bb96ffd5bfce643bd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2e22caa4a40440485b69f16bb96ffd5bfce643bd/setup.py |
self.s_apply(self.r_exec, args) | return self.s_apply(self.r_exec, args) | def s_exec(self, *args): self.s_apply(self.r_exec, args) | 8574263ecccd09e229fa5e5f439665399eb7532d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8574263ecccd09e229fa5e5f439665399eb7532d/rexec.py |
self.s_apply(self.r_eval, args) | return self.s_apply(self.r_eval, args) | def s_eval(self, *args): self.s_apply(self.r_eval, args) | 8574263ecccd09e229fa5e5f439665399eb7532d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8574263ecccd09e229fa5e5f439665399eb7532d/rexec.py |
self.s_apply(self.r_execfile, args) | return self.s_apply(self.r_execfile, args) | def s_execfile(self, *args): self.s_apply(self.r_execfile, args) | 8574263ecccd09e229fa5e5f439665399eb7532d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8574263ecccd09e229fa5e5f439665399eb7532d/rexec.py |
self.s_apply(self.r_import, args) | return self.s_apply(self.r_import, args) | def s_import(self, *args): self.s_apply(self.r_import, args) | 8574263ecccd09e229fa5e5f439665399eb7532d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8574263ecccd09e229fa5e5f439665399eb7532d/rexec.py |
self.s_apply(self.r_reload, args) | return self.s_apply(self.r_reload, args) | def s_reload(self, *args): self.s_apply(self.r_reload, args) | 8574263ecccd09e229fa5e5f439665399eb7532d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8574263ecccd09e229fa5e5f439665399eb7532d/rexec.py |
self.s_apply(self.r_unload, args) | return self.s_apply(self.r_unload, args) | def s_unload(self, *args): self.s_apply(self.r_unload, args) | 8574263ecccd09e229fa5e5f439665399eb7532d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8574263ecccd09e229fa5e5f439665399eb7532d/rexec.py |
def __init__(self, encoding=None): | def __init__(self, encoding=None, allow_none=0): | def __init__(self, encoding=None): self.memo = {} self.data = None self.encoding = encoding | 5b191b9c2676388541d4f3e3bb98b8e516867562 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5b191b9c2676388541d4f3e3bb98b8e516867562/xmlrpclib.py |
self.allow_none = allow_none | def __init__(self, encoding=None): self.memo = {} self.data = None self.encoding = encoding | 5b191b9c2676388541d4f3e3bb98b8e516867562 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5b191b9c2676388541d4f3e3bb98b8e516867562/xmlrpclib.py |
|
def dumps(params, methodname=None, methodresponse=None, encoding=None): | def dumps(params, methodname=None, methodresponse=None, encoding=None, allow_none=0): | def dumps(params, methodname=None, methodresponse=None, encoding=None): """data [,options] -> marshalled data Convert an argument tuple or a Fault instance to an XML-RPC request (or response, if the methodresponse option is used). In addition to the data object, the following options can be given as keyword arguments: methodname: the method name for a methodCall packet methodresponse: true to create a methodResponse packet. If this option is used with a tuple, the tuple must be a singleton (i.e. it can contain only one element). encoding: the packet encoding (default is UTF-8) All 8-bit strings in the data structure are assumed to use the packet encoding. Unicode strings are automatically converted, where necessary. """ assert isinstance(params, TupleType) or isinstance(params, Fault),\ "argument must be tuple or Fault instance" if isinstance(params, Fault): methodresponse = 1 elif methodresponse and isinstance(params, TupleType): assert len(params) == 1, "response tuple must be a singleton" if not encoding: encoding = "utf-8" if FastMarshaller: m = FastMarshaller(encoding) else: m = Marshaller(encoding) data = m.dumps(params) if encoding != "utf-8": xmlheader = "<?xml version='1.0' encoding='%s'?>\n" % str(encoding) else: xmlheader = "<?xml version='1.0'?>\n" # utf-8 is default # standard XML-RPC wrappings if methodname: # a method call if not isinstance(methodname, StringType): methodname = methodname.encode(encoding) data = ( xmlheader, "<methodCall>\n" "<methodName>", methodname, "</methodName>\n", data, "</methodCall>\n" ) elif methodresponse: # a method response, or a fault structure data = ( xmlheader, "<methodResponse>\n", data, "</methodResponse>\n" ) else: return data # return as is return string.join(data, "") | 5b191b9c2676388541d4f3e3bb98b8e516867562 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5b191b9c2676388541d4f3e3bb98b8e516867562/xmlrpclib.py |
m = Marshaller(encoding) | m = Marshaller(encoding, allow_none) | def dumps(params, methodname=None, methodresponse=None, encoding=None): """data [,options] -> marshalled data Convert an argument tuple or a Fault instance to an XML-RPC request (or response, if the methodresponse option is used). In addition to the data object, the following options can be given as keyword arguments: methodname: the method name for a methodCall packet methodresponse: true to create a methodResponse packet. If this option is used with a tuple, the tuple must be a singleton (i.e. it can contain only one element). encoding: the packet encoding (default is UTF-8) All 8-bit strings in the data structure are assumed to use the packet encoding. Unicode strings are automatically converted, where necessary. """ assert isinstance(params, TupleType) or isinstance(params, Fault),\ "argument must be tuple or Fault instance" if isinstance(params, Fault): methodresponse = 1 elif methodresponse and isinstance(params, TupleType): assert len(params) == 1, "response tuple must be a singleton" if not encoding: encoding = "utf-8" if FastMarshaller: m = FastMarshaller(encoding) else: m = Marshaller(encoding) data = m.dumps(params) if encoding != "utf-8": xmlheader = "<?xml version='1.0' encoding='%s'?>\n" % str(encoding) else: xmlheader = "<?xml version='1.0'?>\n" # utf-8 is default # standard XML-RPC wrappings if methodname: # a method call if not isinstance(methodname, StringType): methodname = methodname.encode(encoding) data = ( xmlheader, "<methodCall>\n" "<methodName>", methodname, "</methodName>\n", data, "</methodCall>\n" ) elif methodresponse: # a method response, or a fault structure data = ( xmlheader, "<methodResponse>\n", data, "</methodResponse>\n" ) else: return data # return as is return string.join(data, "") | 5b191b9c2676388541d4f3e3bb98b8e516867562 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5b191b9c2676388541d4f3e3bb98b8e516867562/xmlrpclib.py |
def __init__(self, uri, transport=None, encoding=None, verbose=0): | def __init__(self, uri, transport=None, encoding=None, verbose=0, allow_none=0): | def __init__(self, uri, transport=None, encoding=None, verbose=0): # establish a "logical" server connection | 5b191b9c2676388541d4f3e3bb98b8e516867562 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5b191b9c2676388541d4f3e3bb98b8e516867562/xmlrpclib.py |
self.__allow_none = allow_none | def __init__(self, uri, transport=None, encoding=None, verbose=0): # establish a "logical" server connection | 5b191b9c2676388541d4f3e3bb98b8e516867562 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5b191b9c2676388541d4f3e3bb98b8e516867562/xmlrpclib.py |
|
request = dumps(params, methodname, encoding=self.__encoding) | request = dumps(params, methodname, encoding=self.__encoding, allow_none=self.__allow_none) | def __request(self, methodname, params): # call a method on the remote server | 5b191b9c2676388541d4f3e3bb98b8e516867562 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5b191b9c2676388541d4f3e3bb98b8e516867562/xmlrpclib.py |
server = ServerProxy("http://betty.userland.com") | server = ServerProxy("http://betty.userland.com") | def __getattr__(self, name): # magic method dispatcher return _Method(self.__request, name) | 5b191b9c2676388541d4f3e3bb98b8e516867562 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5b191b9c2676388541d4f3e3bb98b8e516867562/xmlrpclib.py |
log.info("changing mode of %s to %o", file, mode) | log.info("changing mode of %s", file) | def run (self): if not self.skip_build: self.run_command('build_scripts') self.outfiles = self.copy_tree(self.build_dir, self.install_dir) if os.name == 'posix': # Set the executable bits (owner, group, and world) on # all the scripts we just installed. for file in self.get_outputs(): if self.dry_run: log.info("changing mode of %s to %o", file, mode) else: mode = ((os.stat(file)[ST_MODE]) | 0111) & 07777 log.info("changing mode of %s to %o", file, mode) os.chmod(file, mode) | 21f6d0ed67c2caca843a2b09e2b30e30d7b5771a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/21f6d0ed67c2caca843a2b09e2b30e30d7b5771a/install_scripts.py |
h.update(u''.join(data).encode('unicode-internal')) | h.update(u''.join(data).encode(encoding)) | def test_methods(): h = sha.sha() for i in range(65536): char = unichr(i) data = [ # Predicates (single char) char.isalnum() and u'1' or u'0', char.isalpha() and u'1' or u'0', char.isdecimal() and u'1' or u'0', char.isdigit() and u'1' or u'0', char.islower() and u'1' or u'0', char.isnumeric() and u'1' or u'0', char.isspace() and u'1' or u'0', char.istitle() and u'1' or u'0', char.isupper() and u'1' or u'0', # Predicates (multiple chars) (char + u'abc').isalnum() and u'1' or u'0', (char + u'abc').isalpha() and u'1' or u'0', (char + u'123').isdecimal() and u'1' or u'0', (char + u'123').isdigit() and u'1' or u'0', (char + u'abc').islower() and u'1' or u'0', (char + u'123').isnumeric() and u'1' or u'0', (char + u' \t').isspace() and u'1' or u'0', (char + u'abc').istitle() and u'1' or u'0', (char + u'ABC').isupper() and u'1' or u'0', # Mappings (single char) char.lower(), char.upper(), char.title(), # Mappings (multiple chars) (char + u'abc').lower(), (char + u'ABC').upper(), (char + u'abc').title(), (char + u'ABC').title(), ] h.update(u''.join(data).encode('unicode-internal')) return h.hexdigest() | 5569027cdf6cacc6619cf9c55afe5b52393cecdb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5569027cdf6cacc6619cf9c55afe5b52393cecdb/test_unicodedata.py |
def __init__(self, master=None, cnf={}, **kw): | def __init__(self, master=None, cnf=None, **kw): if cnf is None: cnf = {} | def __init__(self, master=None, cnf={}, **kw): if kw: cnf = _cnfmerge((cnf, kw)) fcnf = {} for k in cnf.keys(): if type(k) == ClassType or k == 'name': fcnf[k] = cnf[k] del cnf[k] self.frame = apply(Frame, (master,), fcnf) self.vbar = Scrollbar(self.frame, name='vbar') self.vbar.pack(side=RIGHT, fill=Y) cnf['name'] = 'text' apply(Text.__init__, (self, self.frame), cnf) self.pack(side=LEFT, fill=BOTH, expand=1) self['yscrollcommand'] = self.vbar.set self.vbar['command'] = self.yview | 3dce5b3cd8892150259cf8c9fcfb6b35035b6e91 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/3dce5b3cd8892150259cf8c9fcfb6b35035b6e91/ScrolledText.py |
tempcache = None | __tempfiles = [] | def urlcleanup(): if _urlopener: _urlopener.cleanup() | 67b01d98cf14689ce7782ebd05e24aa7e8d4825d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/67b01d98cf14689ce7782ebd05e24aa7e8d4825d/urllib.py |
if self.tempcache: | if self.__tempfiles: | def cleanup(self): if self.tempcache: import os for url in self.tempcache.keys(): try: os.unlink(self.tempcache[url][0]) except os.error: pass del self.tempcache[url] | 67b01d98cf14689ce7782ebd05e24aa7e8d4825d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/67b01d98cf14689ce7782ebd05e24aa7e8d4825d/urllib.py |
for url in self.tempcache.keys(): | for file in self.__tempfiles: | def cleanup(self): if self.tempcache: import os for url in self.tempcache.keys(): try: os.unlink(self.tempcache[url][0]) except os.error: pass del self.tempcache[url] | 67b01d98cf14689ce7782ebd05e24aa7e8d4825d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/67b01d98cf14689ce7782ebd05e24aa7e8d4825d/urllib.py |
os.unlink(self.tempcache[url][0]) | os.unlink(file) | def cleanup(self): if self.tempcache: import os for url in self.tempcache.keys(): try: os.unlink(self.tempcache[url][0]) except os.error: pass del self.tempcache[url] | 67b01d98cf14689ce7782ebd05e24aa7e8d4825d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/67b01d98cf14689ce7782ebd05e24aa7e8d4825d/urllib.py |
del self.tempcache[url] | URLopener.__tempfiles = [] self.tempcache = None | def cleanup(self): if self.tempcache: import os for url in self.tempcache.keys(): try: os.unlink(self.tempcache[url][0]) except os.error: pass del self.tempcache[url] | 67b01d98cf14689ce7782ebd05e24aa7e8d4825d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/67b01d98cf14689ce7782ebd05e24aa7e8d4825d/urllib.py |
i = string.rfind(basepath, '/') | i = string.rfind(basepath[:-1], '/') | def basejoin(base, url): type, path = splittype(url) if type: # if url is complete (i.e., it contains a type), return it return url host, path = splithost(path) type, basepath = splittype(base) # inherit type from base if host: # if url contains host, just inherit type if type: return type + '://' + host + path else: # no type inherited, so url must have started with // # just return it return url host, basepath = splithost(basepath) # inherit host basepath, basetag = splittag(basepath) # remove extraneuous cruft basepath, basequery = splitquery(basepath) # idem if path[:1] != '/': # non-absolute path name if path[:1] in ('#', '?'): # path is just a tag or query, attach to basepath i = len(basepath) else: # else replace last component i = string.rfind(basepath, '/') if i < 0: # basepath not absolute if host: # host present, make absolute basepath = '/' else: # else keep non-absolute basepath = '' else: # remove last file component basepath = basepath[:i+1] # Interpret ../ (important because of symlinks) while basepath and path[:3] == '../': path = path[3:] i = string.rfind(basepath, '/') if i > 0: basepath = basepath[:i-1] path = basepath + path if type and host: return type + '://' + host + path elif type: return type + ':' + path elif host: return '//' + host + path # don't know what this means else: return path | 67b01d98cf14689ce7782ebd05e24aa7e8d4825d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/67b01d98cf14689ce7782ebd05e24aa7e8d4825d/urllib.py |
basepath = basepath[:i-1] | basepath = basepath[:i+1] elif i == 0: basepath = '/' break else: basepath = '' | def basejoin(base, url): type, path = splittype(url) if type: # if url is complete (i.e., it contains a type), return it return url host, path = splithost(path) type, basepath = splittype(base) # inherit type from base if host: # if url contains host, just inherit type if type: return type + '://' + host + path else: # no type inherited, so url must have started with // # just return it return url host, basepath = splithost(basepath) # inherit host basepath, basetag = splittag(basepath) # remove extraneuous cruft basepath, basequery = splitquery(basepath) # idem if path[:1] != '/': # non-absolute path name if path[:1] in ('#', '?'): # path is just a tag or query, attach to basepath i = len(basepath) else: # else replace last component i = string.rfind(basepath, '/') if i < 0: # basepath not absolute if host: # host present, make absolute basepath = '/' else: # else keep non-absolute basepath = '' else: # remove last file component basepath = basepath[:i+1] # Interpret ../ (important because of symlinks) while basepath and path[:3] == '../': path = path[3:] i = string.rfind(basepath, '/') if i > 0: basepath = basepath[:i-1] path = basepath + path if type and host: return type + '://' + host + path elif type: return type + ':' + path elif host: return '//' + host + path # don't know what this means else: return path | 67b01d98cf14689ce7782ebd05e24aa7e8d4825d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/67b01d98cf14689ce7782ebd05e24aa7e8d4825d/urllib.py |
addr = socket.gethostbyname(socket.gethostname()) | addr = '127.0.0.1' try: addr = socket.gethostbyname(socket.gethostname()) except socket.gaierror: pass | def __init__(self, host = '', port = 0, local_hostname = None): """Initialize a new instance. | bfb60029f7092334f3db84d3bdd024529a78a5fa /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/bfb60029f7092334f3db84d3bdd024529a78a5fa/smtplib.py |
if code in self.BUGGY_RANGE_CHECK: | if not PY_STRUCT_RANGE_CHECKING and code in self.BUGGY_RANGE_CHECK: | def test_one(self, x, pack=struct.pack, unpack=struct.unpack, unhexlify=binascii.unhexlify): if verbose: print "trying std", self.formatpair, "on", x, "==", hex(x) | e93b40650089282d5fa0fdd7310471a346fb037a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e93b40650089282d5fa0fdd7310471a346fb037a/test_struct.py |
if 0: | if PY_STRUCT_RANGE_CHECKING: | def test_1229380(): for endian in ('', '>', '<'): for cls in (int, long): for fmt in ('B', 'H', 'I', 'L'): any_err(struct.pack, endian + fmt, cls(-1)) any_err(struct.pack, endian + 'B', cls(300)) any_err(struct.pack, endian + 'H', cls(70000)) any_err(struct.pack, endian + 'I', sys.maxint * 4L) any_err(struct.pack, endian + 'L', sys.maxint * 4L) | e93b40650089282d5fa0fdd7310471a346fb037a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e93b40650089282d5fa0fdd7310471a346fb037a/test_struct.py |
locale.getlocale(locale.LC_TIME), | locale.getlocale(locale.LC_TIME)[0], | def test_lang(self): # Make sure lang is set self.failUnless(self.LT_ins.lang in (locale.getdefaultlocale()[0], locale.getlocale(locale.LC_TIME), ''), "Setting of lang failed") | ba9019a27cf383239ffe71a9f50ca64d9771250f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ba9019a27cf383239ffe71a9f50ca64d9771250f/test_strptime.py |
if mname in self.modules: return self.modules[mname] self.modules[mname] = m = self.hooks.new_module(mname) | m = self.modules.get(mname) if m is None: self.modules[mname] = m = self.hooks.new_module(mname) | def add_module(self, mname): if mname in self.modules: return self.modules[mname] self.modules[mname] = m = self.hooks.new_module(mname) m.__builtins__ = self.modules['__builtin__'] return m | cad0f0d9500eab66dedd1c7692bc847d16c0e6b5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/cad0f0d9500eab66dedd1c7692bc847d16c0e6b5/rexec.py |
code.interact( "*** RESTRICTED *** Python %s on %s\n" 'Type "help", "copyright", "credits" or "license" ' "for more information." % (sys.version, sys.platform), local=r.modules['__main__'].__dict__) | RestrictedConsole(r.modules['__main__'].__dict__).interact() | def test(): import getopt, traceback opts, args = getopt.getopt(sys.argv[1:], 'vt:') verbose = 0 trusted = [] for o, a in opts: if o == '-v': verbose = verbose+1 if o == '-t': trusted.append(a) r = RExec(verbose=verbose) if trusted: r.ok_builtin_modules = r.ok_builtin_modules + tuple(trusted) if args: r.modules['sys'].argv = args r.modules['sys'].path.insert(0, os.path.dirname(args[0])) else: r.modules['sys'].path.insert(0, "") fp = sys.stdin if args and args[0] != '-': try: fp = open(args[0]) except IOError, msg: print "%s: can't open file %s" % (sys.argv[0], `args[0]`) return 1 if fp.isatty(): import code try: code.interact( "*** RESTRICTED *** Python %s on %s\n" 'Type "help", "copyright", "credits" or "license" ' "for more information." % (sys.version, sys.platform), local=r.modules['__main__'].__dict__) except SystemExit, n: return n else: text = fp.read() fp.close() c = compile(text, fp.name, 'exec') try: r.s_exec(c) except SystemExit, n: return n except: traceback.print_exc() return 1 | cad0f0d9500eab66dedd1c7692bc847d16c0e6b5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/cad0f0d9500eab66dedd1c7692bc847d16c0e6b5/rexec.py |
mod = __import__(modname, globals(), locals(), _import_tail) | mod = __import__('encodings.' + modname, globals(), locals(), _import_tail) | def search_function(encoding): # Cache lookup entry = _cache.get(encoding, _unknown) if entry is not _unknown: return entry # Import the module: # # First look in the encodings package, then try to lookup the # encoding in the aliases mapping and retry the import using the # default import module lookup scheme with the alias name. # modname = encoding.replace('-', '_') try: mod = __import__('encodings.' + modname, globals(), locals(), _import_tail) except ImportError,why: import aliases modname = aliases.aliases.get(modname, modname) try: mod = __import__(modname, globals(), locals(), _import_tail) except ImportError,why: mod = None if mod is None: # Cache misses _cache[encoding] = None return None # Now ask the module for the registry entry try: entry = tuple(mod.getregentry()) except AttributeError: entry = () if len(entry) != 4: raise CodecRegistryError,\ 'module "%s" (%s) failed to register' % \ (mod.__name__, mod.__file__) for obj in entry: if not callable(obj): raise CodecRegistryError,\ 'incompatible codecs in module "%s" (%s)' % \ (mod.__name__, mod.__file__) # Cache the codec registry entry _cache[encoding] = entry # Register its aliases (without overwriting previously registered # aliases) try: codecaliases = mod.getaliases() except AttributeError: pass else: import aliases for alias in codecaliases: if not aliases.aliases.has_key(alias): aliases.aliases[alias] = modname # Return the registry entry return entry | 2f8296be178f98613bdda5a5a07c895e32507562 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2f8296be178f98613bdda5a5a07c895e32507562/__init__.py |
if type(commandlist) == type(()) and len(commandlist[0]) > 1: | if type(commandlist[0]) == type(()) and len(commandlist[0]) > 1: | def GetArgv(optionlist=None, commandlist=None, addoldfile=1, addnewfile=1, addfolder=1, id=ARGV_ID): d = GetNewDialog(id, -1) if not d: print "Can't get DLOG resource with id =", id return | ec74fe507189890aa2bc2ebc266f8811932d72f5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ec74fe507189890aa2bc2ebc266f8811932d72f5/EasyDialogs.py |
if type(optionlist) == type(()): option = optionlist[idx][0] else: option = optionlist[idx] | option = optionlist[idx] if type(option) == type(()): option = option[0] | def GetArgv(optionlist=None, commandlist=None, addoldfile=1, addnewfile=1, addfolder=1, id=ARGV_ID): d = GetNewDialog(id, -1) if not d: print "Can't get DLOG resource with id =", id return | ec74fe507189890aa2bc2ebc266f8811932d72f5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ec74fe507189890aa2bc2ebc266f8811932d72f5/EasyDialogs.py |
if 0 <= idx < len(commandlist) and type(commandlist) == type(()) and \ | if 0 <= idx < len(commandlist) and type(commandlist[idx]) == type(()) and \ | def GetArgv(optionlist=None, commandlist=None, addoldfile=1, addnewfile=1, addfolder=1, id=ARGV_ID): d = GetNewDialog(id, -1) if not d: print "Can't get DLOG resource with id =", id return | ec74fe507189890aa2bc2ebc266f8811932d72f5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ec74fe507189890aa2bc2ebc266f8811932d72f5/EasyDialogs.py |
if type(commandlist) == type(()): stringstoadd = [commandlist[idx][0]] else: stringstoadd = [commandlist[idx]] | command = commandlist[idx] if type(command) == type(()): command = command[0] stringstoadd = [command] | def GetArgv(optionlist=None, commandlist=None, addoldfile=1, addnewfile=1, addfolder=1, id=ARGV_ID): d = GetNewDialog(id, -1) if not d: print "Can't get DLOG resource with id =", id return | ec74fe507189890aa2bc2ebc266f8811932d72f5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ec74fe507189890aa2bc2ebc266f8811932d72f5/EasyDialogs.py |
genpluginproject("ppc", "_AE", libraries=["ObjectSupportLib"], outputdir="::Lib:Carbon") | genpluginproject("ppc", "_AE", libraries=["ObjectSupportLib"], stdlibraryflags="Debug, WeakImport", outputdir="::Lib:Carbon") | def genpluginproject(architecture, module, project=None, projectdir=None, sources=[], sourcedirs=[], libraries=[], extradirs=[], extraexportsymbols=[], outputdir=":::Lib:lib-dynload", libraryflags=None, stdlibraryflags=None, prefixname=None): if architecture == "all": # For the time being we generate two project files. Not as nice as # a single multitarget project, but easier to implement for now. genpluginproject("ppc", module, project, projectdir, sources, sourcedirs, libraries, extradirs, extraexportsymbols, outputdir, libraryflags, stdlibraryflags, prefixname) genpluginproject("carbon", module, project, projectdir, sources, sourcedirs, libraries, extradirs, extraexportsymbols, outputdir, libraryflags, stdlibraryflags, prefixname) return templatename = "template-%s" % architecture targetname = "%s.%s" % (module, architecture) dllname = "%s.%s.slb" % (module, architecture) if not project: if architecture != "ppc": project = "%s.%s.mcp"%(module, architecture) else: project = "%s.mcp"%module if not projectdir: projectdir = PROJECTDIR if not sources: sources = [module + 'module.c'] if not sourcedirs: for moduledir in MODULEDIRS: if '%' in moduledir: # For historical reasons an initial _ in the modulename # is not reflected in the folder name if module[0] == '_': modulewithout_ = module[1:] else: modulewithout_ = module moduledir = moduledir % modulewithout_ fn = os.path.join(projectdir, os.path.join(moduledir, sources[0])) if os.path.exists(fn): moduledir, sourcefile = os.path.split(fn) sourcedirs = [relpath(projectdir, moduledir)] sources[0] = sourcefile break else: print "Warning: %s: sourcefile not found: %s"%(module, sources[0]) sourcedirs = [] if prefixname: pass elif architecture == "carbon": prefixname = "mwerks_carbonplugin_config.h" else: prefixname = "mwerks_plugin_config.h" dict = { "sysprefix" : relpath(projectdir, sys.prefix), "sources" : sources, "extrasearchdirs" : sourcedirs + extradirs, "libraries": libraries, "mac_outputdir" : outputdir, "extraexportsymbols" : extraexportsymbols, "mac_targetname" : targetname, "mac_dllname" : dllname, "prefixname" : prefixname, } if libraryflags: dict['libraryflags'] = libraryflags if stdlibraryflags: dict['stdlibraryflags'] = stdlibraryflags mkcwproject.mkproject(os.path.join(projectdir, project), module, dict, force=FORCEREBUILD, templatename=templatename) | 150f9fc415d529faf327290ae61f0a86035b25ed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/150f9fc415d529faf327290ae61f0a86035b25ed/genpluginprojects.py |
genpluginproject("ppc", "_Cm", libraries=["QuickTimeLib"], outputdir="::Lib:Carbon") | genpluginproject("ppc", "_Cm", libraries=["QuickTimeLib"], stdlibraryflags="Debug, WeakImport", outputdir="::Lib:Carbon") | def genpluginproject(architecture, module, project=None, projectdir=None, sources=[], sourcedirs=[], libraries=[], extradirs=[], extraexportsymbols=[], outputdir=":::Lib:lib-dynload", libraryflags=None, stdlibraryflags=None, prefixname=None): if architecture == "all": # For the time being we generate two project files. Not as nice as # a single multitarget project, but easier to implement for now. genpluginproject("ppc", module, project, projectdir, sources, sourcedirs, libraries, extradirs, extraexportsymbols, outputdir, libraryflags, stdlibraryflags, prefixname) genpluginproject("carbon", module, project, projectdir, sources, sourcedirs, libraries, extradirs, extraexportsymbols, outputdir, libraryflags, stdlibraryflags, prefixname) return templatename = "template-%s" % architecture targetname = "%s.%s" % (module, architecture) dllname = "%s.%s.slb" % (module, architecture) if not project: if architecture != "ppc": project = "%s.%s.mcp"%(module, architecture) else: project = "%s.mcp"%module if not projectdir: projectdir = PROJECTDIR if not sources: sources = [module + 'module.c'] if not sourcedirs: for moduledir in MODULEDIRS: if '%' in moduledir: # For historical reasons an initial _ in the modulename # is not reflected in the folder name if module[0] == '_': modulewithout_ = module[1:] else: modulewithout_ = module moduledir = moduledir % modulewithout_ fn = os.path.join(projectdir, os.path.join(moduledir, sources[0])) if os.path.exists(fn): moduledir, sourcefile = os.path.split(fn) sourcedirs = [relpath(projectdir, moduledir)] sources[0] = sourcefile break else: print "Warning: %s: sourcefile not found: %s"%(module, sources[0]) sourcedirs = [] if prefixname: pass elif architecture == "carbon": prefixname = "mwerks_carbonplugin_config.h" else: prefixname = "mwerks_plugin_config.h" dict = { "sysprefix" : relpath(projectdir, sys.prefix), "sources" : sources, "extrasearchdirs" : sourcedirs + extradirs, "libraries": libraries, "mac_outputdir" : outputdir, "extraexportsymbols" : extraexportsymbols, "mac_targetname" : targetname, "mac_dllname" : dllname, "prefixname" : prefixname, } if libraryflags: dict['libraryflags'] = libraryflags if stdlibraryflags: dict['stdlibraryflags'] = stdlibraryflags mkcwproject.mkproject(os.path.join(projectdir, project), module, dict, force=FORCEREBUILD, templatename=templatename) | 150f9fc415d529faf327290ae61f0a86035b25ed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/150f9fc415d529faf327290ae61f0a86035b25ed/genpluginprojects.py |
genpluginproject("ppc", "_Drag", libraries=["DragLib"], outputdir="::Lib:Carbon") genpluginproject("all", "_Evt", outputdir="::Lib:Carbon") genpluginproject("all", "_Fm", outputdir="::Lib:Carbon") | genpluginproject("ppc", "_Drag", libraries=["DragLib"], libraryflags="Debug, WeakImport", outputdir="::Lib:Carbon") genpluginproject("all", "_Evt", stdlibraryflags="Debug, WeakImport", outputdir="::Lib:Carbon") genpluginproject("all", "_Fm", stdlibraryflags="Debug, WeakImport", outputdir="::Lib:Carbon") | def genpluginproject(architecture, module, project=None, projectdir=None, sources=[], sourcedirs=[], libraries=[], extradirs=[], extraexportsymbols=[], outputdir=":::Lib:lib-dynload", libraryflags=None, stdlibraryflags=None, prefixname=None): if architecture == "all": # For the time being we generate two project files. Not as nice as # a single multitarget project, but easier to implement for now. genpluginproject("ppc", module, project, projectdir, sources, sourcedirs, libraries, extradirs, extraexportsymbols, outputdir, libraryflags, stdlibraryflags, prefixname) genpluginproject("carbon", module, project, projectdir, sources, sourcedirs, libraries, extradirs, extraexportsymbols, outputdir, libraryflags, stdlibraryflags, prefixname) return templatename = "template-%s" % architecture targetname = "%s.%s" % (module, architecture) dllname = "%s.%s.slb" % (module, architecture) if not project: if architecture != "ppc": project = "%s.%s.mcp"%(module, architecture) else: project = "%s.mcp"%module if not projectdir: projectdir = PROJECTDIR if not sources: sources = [module + 'module.c'] if not sourcedirs: for moduledir in MODULEDIRS: if '%' in moduledir: # For historical reasons an initial _ in the modulename # is not reflected in the folder name if module[0] == '_': modulewithout_ = module[1:] else: modulewithout_ = module moduledir = moduledir % modulewithout_ fn = os.path.join(projectdir, os.path.join(moduledir, sources[0])) if os.path.exists(fn): moduledir, sourcefile = os.path.split(fn) sourcedirs = [relpath(projectdir, moduledir)] sources[0] = sourcefile break else: print "Warning: %s: sourcefile not found: %s"%(module, sources[0]) sourcedirs = [] if prefixname: pass elif architecture == "carbon": prefixname = "mwerks_carbonplugin_config.h" else: prefixname = "mwerks_plugin_config.h" dict = { "sysprefix" : relpath(projectdir, sys.prefix), "sources" : sources, "extrasearchdirs" : sourcedirs + extradirs, "libraries": libraries, "mac_outputdir" : outputdir, "extraexportsymbols" : extraexportsymbols, "mac_targetname" : targetname, "mac_dllname" : dllname, "prefixname" : prefixname, } if libraryflags: dict['libraryflags'] = libraryflags if stdlibraryflags: dict['stdlibraryflags'] = stdlibraryflags mkcwproject.mkproject(os.path.join(projectdir, project), module, dict, force=FORCEREBUILD, templatename=templatename) | 150f9fc415d529faf327290ae61f0a86035b25ed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/150f9fc415d529faf327290ae61f0a86035b25ed/genpluginprojects.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.