rem
stringlengths 1
322k
| add
stringlengths 0
2.05M
| context
stringlengths 4
228k
| meta
stringlengths 156
215
|
---|---|---|---|
while 1: | while True: | def recolorize_main(self): next = "1.0" while 1: item = self.tag_nextrange("TODO", next) if not item: break head, tail = item self.tag_remove("SYNC", head, tail) item = self.tag_prevrange("SYNC", head) if item: head = item[1] else: head = "1.0" | 23c51b7e2ad0cd0ebfb1f2688c21f331403da4b8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/23c51b7e2ad0cd0ebfb1f2688c21f331403da4b8/ColorDelegator.py |
ok = 0 | ok = False | def recolorize_main(self): next = "1.0" while 1: item = self.tag_nextrange("TODO", next) if not item: break head, tail = item self.tag_remove("SYNC", head, tail) item = self.tag_prevrange("SYNC", head) if item: head = item[1] else: head = "1.0" | 23c51b7e2ad0cd0ebfb1f2688c21f331403da4b8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/23c51b7e2ad0cd0ebfb1f2688c21f331403da4b8/ColorDelegator.py |
def readfp(self): | def readfp(self, fp): | def readfp(self): """Read a single mime.types-format file.""" map = self.types_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 | 14e6604ab23f47e3f1203ea37922684331e8f1dc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/14e6604ab23f47e3f1203ea37922684331e8f1dc/mimetypes.py |
line = f.readline() | line = fp.readline() | def readfp(self): """Read a single mime.types-format file.""" map = self.types_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 | 14e6604ab23f47e3f1203ea37922684331e8f1dc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/14e6604ab23f47e3f1203ea37922684331e8f1dc/mimetypes.py |
print >>sys.stderr, "l1=%r, l2=%r, ignore=%r" % (l1, l2, ignore) | print >>sys.stderr, "l1=%r\nl2=%r\nignore=%r" % (l1, l2, ignore) | def assertListEq(self, l1, l2, ignore): ''' succeed iff {l1} - {ignore} == {l2} - {ignore} ''' try: for p1, p2 in (l1, l2), (l2, l1): for item in p1: ok = (item in p2) or (item in ignore) if not ok: self.fail("%r missing" % item) except: print >>sys.stderr, "l1=%r, l2=%r, ignore=%r" % (l1, l2, ignore) raise | 97a954f27e265b063a070d59d67f3b50b4d404bb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/97a954f27e265b063a070d59d67f3b50b4d404bb/test_pyclbr.py |
if type(getattr(py_item, m)) == MethodType: | if ismethod(getattr(py_item, m), m): | def checkModule(self, moduleName, module=None, ignore=()): ''' succeed iff pyclbr.readmodule_ex(modulename) corresponds to the actual module object, module. Any identifiers in ignore are ignored. If no module is provided, the appropriate module is loaded with __import__.''' | 97a954f27e265b063a070d59d67f3b50b4d404bb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/97a954f27e265b063a070d59d67f3b50b4d404bb/test_pyclbr.py |
self.assertListEq(foundMethods, actualMethods, ignore) self.assertEquals(py_item.__module__, value.module) | try: self.assertListEq(foundMethods, actualMethods, ignore) self.assertEquals(py_item.__module__, value.module) | def checkModule(self, moduleName, module=None, ignore=()): ''' succeed iff pyclbr.readmodule_ex(modulename) corresponds to the actual module object, module. Any identifiers in ignore are ignored. If no module is provided, the appropriate module is loaded with __import__.''' | 97a954f27e265b063a070d59d67f3b50b4d404bb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/97a954f27e265b063a070d59d67f3b50b4d404bb/test_pyclbr.py |
self.assertEquals(py_item.__name__, value.name, ignore) | self.assertEquals(py_item.__name__, value.name, ignore) except: print >>sys.stderr, "class=%s" % py_item raise | def checkModule(self, moduleName, module=None, ignore=()): ''' succeed iff pyclbr.readmodule_ex(modulename) corresponds to the actual module object, module. Any identifiers in ignore are ignored. If no module is provided, the appropriate module is loaded with __import__.''' | 97a954f27e265b063a070d59d67f3b50b4d404bb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/97a954f27e265b063a070d59d67f3b50b4d404bb/test_pyclbr.py |
self.checkModule('doctest', ignore=['_isclass', '_isfunction', '_ismodule', '_classify_class_attrs']) self.checkModule('rfc822', ignore=["get"]) | self.checkModule('doctest') self.checkModule('rfc822') | def test_easy(self): self.checkModule('pyclbr') self.checkModule('doctest', ignore=['_isclass', '_isfunction', '_ismodule', '_classify_class_attrs']) self.checkModule('rfc822', ignore=["get"]) self.checkModule('difflib') | 97a954f27e265b063a070d59d67f3b50b4d404bb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/97a954f27e265b063a070d59d67f3b50b4d404bb/test_pyclbr.py |
def test_others(self): cm = self.checkModule | 97a954f27e265b063a070d59d67f3b50b4d404bb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/97a954f27e265b063a070d59d67f3b50b4d404bb/test_pyclbr.py |
||
cm('cgi', ignore=('f', 'g', 'log')) cm('mhlib', ignore=('do', 'bisect')) cm('urllib', ignore=('getproxies_environment', 'getproxies_registry', 'open_https')) cm('pickle', ignore=('g',)) cm('aifc', ignore=('openfp',)) cm('Cookie', ignore=('__str__', 'Cookie')) cm('sre_parse', ignore=('literal', 'makedict', 'dump' )) | cm('cgi', ignore=('log',)) cm('mhlib') cm('urllib', ignore=('getproxies_registry', 'open_https')) cm('pickle', ignore=('g',)) cm('aifc', ignore=('openfp',)) cm('Cookie') cm('sre_parse', ignore=('dump',)) cm('pdb') cm('pydoc') | def test_others(self): cm = self.checkModule | 97a954f27e265b063a070d59d67f3b50b4d404bb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/97a954f27e265b063a070d59d67f3b50b4d404bb/test_pyclbr.py |
cm('test.test_pyclbr', ignore=('defined_in',)) | cm('test.test_pyclbr') | def test_others(self): cm = self.checkModule | 97a954f27e265b063a070d59d67f3b50b4d404bb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/97a954f27e265b063a070d59d67f3b50b4d404bb/test_pyclbr.py |
return st[stat.ST_MTIME] | return st[stat.ST_ATIME] | def getatime(filename): """Return the last access time of a file, reported by os.stat().""" st = os.stat(filename) return st[stat.ST_MTIME] | 5a3d2b8bab038301f414d510c1a8aacf56670603 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5a3d2b8bab038301f414d510c1a8aacf56670603/posixpath.py |
if verbose: print "starting pause() loop..." | print "starting pause() loop..." | def force_test_exit(): # Sigh, both imports seem necessary to avoid errors. import os fork_pid = os.fork() if fork_pid: # In parent. return fork_pid # In child. import os, time try: # Wait 5 seconds longer than the expected alarm to give enough # time for the normal sequence of events to occur. This is # just a stop-gap to try to prevent the test from hanging. time.sleep(MAX_DURATION + 5) print >> sys.__stdout__, ' child should not have to kill parent' for signame in "SIGHUP", "SIGUSR1", "SIGUSR2", "SIGALRM": os.kill(pid, getattr(signal, signame)) print >> sys.__stdout__, " child sent", signame, "to", pid time.sleep(1) finally: os._exit(0) | 11fbca2526a5766131e45212497e4feed4e79200 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/11fbca2526a5766131e45212497e4feed4e79200/test_signal.py |
def __hasattr__(self, attr): "Delegate attribute access to the interpreter object" return hasattr(self.tk, attr) def __delattr__(self, attr): "Delegate attribute access to the interpreter object" return delattr(self.tk, attr) | def __hasattr__(self, attr): "Delegate attribute access to the interpreter object" return hasattr(self.tk, attr) | dade502a066916c27f37d8c1fbff09249eeccded /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/dade502a066916c27f37d8c1fbff09249eeccded/Tkinter.py |
|
pass | if size > self.extrasize: size = self.extrasize | def read(self, size=None): if self.extrasize <= 0 and self.fileobj is None: return '' | 1b6f23d7919af1d6608a3e6eabf9c2564dc750d9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1b6f23d7919af1d6608a3e6eabf9c2564dc750d9/gzip.py |
self.extrasize = len(self.extrabuf) | self.extrasize = len(buf) + self.extrasize | def _unread(self, buf): self.extrabuf = buf + self.extrabuf self.extrasize = len(self.extrabuf) | 1b6f23d7919af1d6608a3e6eabf9c2564dc750d9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1b6f23d7919af1d6608a3e6eabf9c2564dc750d9/gzip.py |
return string.split(buf, '\n') | lines = string.split(buf, '\n') for i in range(len(lines)-1): lines[i] = lines[i] + '\n' if lines and not lines[-1]: del lines[-1] return lines | def readlines(self): buf = self.read() return string.split(buf, '\n') | 1b6f23d7919af1d6608a3e6eabf9c2564dc750d9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1b6f23d7919af1d6608a3e6eabf9c2564dc750d9/gzip.py |
if url[:i] == 'http': | if url[:i] == 'http': | def urlparse(url, scheme = '', allow_fragments = 1): key = url, scheme, allow_fragments cached = _parse_cache.get(key, None) if cached: return cached if len(_parse_cache) >= MAX_CACHE_SIZE: # avoid runaway growth clear_cache() find = string.find netloc = path = params = query = fragment = '' i = find(url, ':') if i > 0: if url[:i] == 'http': # optimizie the common case scheme = string.lower(url[:i]) url = url[i+1:] if url[:2] == '//': i = find(url, '/', 2) if i < 0: i = len(url) netloc = url[2:i] url = url[i:] if allow_fragments: i = string.rfind(url, '#') if i >= 0: url = url[:i] fragment = url[i+1:] i = find(url, '?') if i >= 0: url = url[:i] query = url[i+1:] i = find(url, ';') if i >= 0: url = url[:i] params = url[i+1:] tuple = scheme, netloc, url, params, query, fragment _parse_cache[key] = tuple return tuple for c in url[:i]: if c not in scheme_chars: break else: scheme, url = string.lower(url[:i]), url[i+1:] if scheme in uses_netloc: if url[:2] == '//': i = find(url, '/', 2) if i < 0: i = len(url) netloc, url = url[2:i], url[i:] if allow_fragments and scheme in uses_fragment: i = string.rfind(url, '#') if i >= 0: url, fragment = url[:i], url[i+1:] if scheme in uses_query: i = find(url, '?') if i >= 0: url, query = url[:i], url[i+1:] if scheme in uses_params: i = find(url, ';') if i >= 0: url, params = url[:i], url[i+1:] tuple = scheme, netloc, url, params, query, fragment _parse_cache[key] = tuple return tuple | 37b14f64ee6224c92225a6e432de593e14959773 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/37b14f64ee6224c92225a6e432de593e14959773/urlparse.py |
fragment = url[i+1:] | def urlparse(url, scheme = '', allow_fragments = 1): key = url, scheme, allow_fragments cached = _parse_cache.get(key, None) if cached: return cached if len(_parse_cache) >= MAX_CACHE_SIZE: # avoid runaway growth clear_cache() find = string.find netloc = path = params = query = fragment = '' i = find(url, ':') if i > 0: if url[:i] == 'http': # optimizie the common case scheme = string.lower(url[:i]) url = url[i+1:] if url[:2] == '//': i = find(url, '/', 2) if i < 0: i = len(url) netloc = url[2:i] url = url[i:] if allow_fragments: i = string.rfind(url, '#') if i >= 0: url = url[:i] fragment = url[i+1:] i = find(url, '?') if i >= 0: url = url[:i] query = url[i+1:] i = find(url, ';') if i >= 0: url = url[:i] params = url[i+1:] tuple = scheme, netloc, url, params, query, fragment _parse_cache[key] = tuple return tuple for c in url[:i]: if c not in scheme_chars: break else: scheme, url = string.lower(url[:i]), url[i+1:] if scheme in uses_netloc: if url[:2] == '//': i = find(url, '/', 2) if i < 0: i = len(url) netloc, url = url[2:i], url[i:] if allow_fragments and scheme in uses_fragment: i = string.rfind(url, '#') if i >= 0: url, fragment = url[:i], url[i+1:] if scheme in uses_query: i = find(url, '?') if i >= 0: url, query = url[:i], url[i+1:] if scheme in uses_params: i = find(url, ';') if i >= 0: url, params = url[:i], url[i+1:] tuple = scheme, netloc, url, params, query, fragment _parse_cache[key] = tuple return tuple | 37b14f64ee6224c92225a6e432de593e14959773 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/37b14f64ee6224c92225a6e432de593e14959773/urlparse.py |
|
query = url[i+1:] | def urlparse(url, scheme = '', allow_fragments = 1): key = url, scheme, allow_fragments cached = _parse_cache.get(key, None) if cached: return cached if len(_parse_cache) >= MAX_CACHE_SIZE: # avoid runaway growth clear_cache() find = string.find netloc = path = params = query = fragment = '' i = find(url, ':') if i > 0: if url[:i] == 'http': # optimizie the common case scheme = string.lower(url[:i]) url = url[i+1:] if url[:2] == '//': i = find(url, '/', 2) if i < 0: i = len(url) netloc = url[2:i] url = url[i:] if allow_fragments: i = string.rfind(url, '#') if i >= 0: url = url[:i] fragment = url[i+1:] i = find(url, '?') if i >= 0: url = url[:i] query = url[i+1:] i = find(url, ';') if i >= 0: url = url[:i] params = url[i+1:] tuple = scheme, netloc, url, params, query, fragment _parse_cache[key] = tuple return tuple for c in url[:i]: if c not in scheme_chars: break else: scheme, url = string.lower(url[:i]), url[i+1:] if scheme in uses_netloc: if url[:2] == '//': i = find(url, '/', 2) if i < 0: i = len(url) netloc, url = url[2:i], url[i:] if allow_fragments and scheme in uses_fragment: i = string.rfind(url, '#') if i >= 0: url, fragment = url[:i], url[i+1:] if scheme in uses_query: i = find(url, '?') if i >= 0: url, query = url[:i], url[i+1:] if scheme in uses_params: i = find(url, ';') if i >= 0: url, params = url[:i], url[i+1:] tuple = scheme, netloc, url, params, query, fragment _parse_cache[key] = tuple return tuple | 37b14f64ee6224c92225a6e432de593e14959773 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/37b14f64ee6224c92225a6e432de593e14959773/urlparse.py |
|
params = url[i+1:] | def urlparse(url, scheme = '', allow_fragments = 1): key = url, scheme, allow_fragments cached = _parse_cache.get(key, None) if cached: return cached if len(_parse_cache) >= MAX_CACHE_SIZE: # avoid runaway growth clear_cache() find = string.find netloc = path = params = query = fragment = '' i = find(url, ':') if i > 0: if url[:i] == 'http': # optimizie the common case scheme = string.lower(url[:i]) url = url[i+1:] if url[:2] == '//': i = find(url, '/', 2) if i < 0: i = len(url) netloc = url[2:i] url = url[i:] if allow_fragments: i = string.rfind(url, '#') if i >= 0: url = url[:i] fragment = url[i+1:] i = find(url, '?') if i >= 0: url = url[:i] query = url[i+1:] i = find(url, ';') if i >= 0: url = url[:i] params = url[i+1:] tuple = scheme, netloc, url, params, query, fragment _parse_cache[key] = tuple return tuple for c in url[:i]: if c not in scheme_chars: break else: scheme, url = string.lower(url[:i]), url[i+1:] if scheme in uses_netloc: if url[:2] == '//': i = find(url, '/', 2) if i < 0: i = len(url) netloc, url = url[2:i], url[i:] if allow_fragments and scheme in uses_fragment: i = string.rfind(url, '#') if i >= 0: url, fragment = url[:i], url[i+1:] if scheme in uses_query: i = find(url, '?') if i >= 0: url, query = url[:i], url[i+1:] if scheme in uses_params: i = find(url, ';') if i >= 0: url, params = url[:i], url[i+1:] tuple = scheme, netloc, url, params, query, fragment _parse_cache[key] = tuple return tuple | 37b14f64ee6224c92225a6e432de593e14959773 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/37b14f64ee6224c92225a6e432de593e14959773/urlparse.py |
|
SyntaxError: 'yield' outside function (<doctest test.test_generators.__test__.coroutine[10]>, line 1) | SyntaxError: 'yield' outside function (<doctest test.test_generators.__test__.coroutine[21]>, line 1) | >>> def f(): list(i for i in [(yield 26)]) | 7ec75c310a51b135d4907e5f20d244faa9a0f438 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/7ec75c310a51b135d4907e5f20d244faa9a0f438/test_generators.py |
SyntaxError: 'return' with argument inside generator (<doctest test.test_generators.__test__.coroutine[11]>, line 1) | SyntaxError: 'return' with argument inside generator (<doctest test.test_generators.__test__.coroutine[22]>, line 1) | >>> def f(): return lambda x=(yield): 1 | 7ec75c310a51b135d4907e5f20d244faa9a0f438 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/7ec75c310a51b135d4907e5f20d244faa9a0f438/test_generators.py |
SyntaxError: assignment to yield expression not possible (<doctest test.test_generators.__test__.coroutine[12]>, line 1) | SyntaxError: assignment to yield expression not possible (<doctest test.test_generators.__test__.coroutine[23]>, line 1) >>> def f(): (yield bar) = y Traceback (most recent call last): ... SyntaxError: can't assign to yield expression (<doctest test.test_generators.__test__.coroutine[24]>, line 1) >>> def f(): (yield bar) += y Traceback (most recent call last): ... SyntaxError: augmented assignment to yield expression not possible (<doctest test.test_generators.__test__.coroutine[25]>, line 1) | >>> def f(): x = yield = y | 7ec75c310a51b135d4907e5f20d244faa9a0f438 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/7ec75c310a51b135d4907e5f20d244faa9a0f438/test_generators.py |
(msg is None or mod.match(module)) and | (mod is None or mod.match(module)) and | def warn_explicit(message, category, filename, lineno, module=None, registry=None): if module is None: module = filename if module[-3:].lower() == ".py": module = module[:-3] # XXX What about leading pathname? if registry is None: registry = {} if isinstance(message, Warning): text = str(message) category = message.__class__ else: text = message message = category(message) key = (text, category, lineno) # Quick test for common case if registry.get(key): return # Search the filters for item in filters: action, msg, cat, mod, ln = item if ((msg is None or msg.match(text)) and issubclass(category, cat) and (msg is None or mod.match(module)) and (ln == 0 or lineno == ln)): break else: action = defaultaction # Early exit actions if action == "ignore": registry[key] = 1 return if action == "error": raise message # Other actions if action == "once": registry[key] = 1 oncekey = (text, category) if onceregistry.get(oncekey): return onceregistry[oncekey] = 1 elif action == "always": pass elif action == "module": registry[key] = 1 altkey = (text, category, 0) if registry.get(altkey): return registry[altkey] = 1 elif action == "default": registry[key] = 1 else: # Unrecognized actions are errors raise RuntimeError( "Unrecognized action (%r) in warnings.filters:\n %s" % (action, item)) # Print message and context showwarning(message, category, filename, lineno) | 37d0208e5d510bc9da42f15d8122edcce1f5ef3c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/37d0208e5d510bc9da42f15d8122edcce1f5ef3c/warnings.py |
if self.disp.format == 'mono': nline = (len(data)*8)/self.vw elif self.disp.format == 'grey2': nline = (len(data)*4)/self.vw elif self.disp.format == 'grey4': nline = (len(data)*2)/self.vw else: nline = len(data)/self.vw if nline*self.vw <> len(data): print 'Incorrect-sized video fragment ignored' return | nline = len(data)/self.linewidth() if nline*self.linewidth() <> len(data): print 'Incorrect-sized video fragment ignored' return | def putnextpacket(self, pos, data): if self.disp.format == 'mono': # Unfortunately size-check is difficult for # packed video nline = (len(data)*8)/self.vw elif self.disp.format == 'grey2': nline = (len(data)*4)/self.vw elif self.disp.format == 'grey4': nline = (len(data)*2)/self.vw else: nline = len(data)/self.vw if nline*self.vw <> len(data): print 'Incorrect-sized video fragment ignored' return oldwid = gl.winget() gl.winset(self.wid) self.disp.showpartframe(data, None, (0, pos, self.vw, nline)) gl.winset(oldwid) | 11a506675edf1746a18f4af9ef54bc48ed370b0f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/11a506675edf1746a18f4af9ef54bc48ed370b0f/LiveVideoOut.py |
def handle(self): """ Handle multiple requests - each expected to be a 4-byte length, followed by the LogRecord in pickle format. Logs the record according to whatever policy is configured locally. """ while 1: try: chunk = self.connection.recv(4) if len(chunk) < 4: break slen = struct.unpack(">L", chunk)[0] #print slen chunk = self.connection.recv(slen) while len(chunk) < slen: chunk = chunk + self.connection.recv(slen - len(chunk)) obj = self.unPickle(chunk) record = logging.LogRecord(None, None, "", 0, "", (), None) record.__dict__.update(obj) self.handleLogRecord(record) except: raise | 0844d53e3656902c7bcae91b70ecad553c369283 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/0844d53e3656902c7bcae91b70ecad553c369283/test_logging.py |
||
rd, wr, ex = select([self.socket.fileno()], | rd, wr, ex = select.select([self.socket.fileno()], | def serve_until_stopped(self): abort = 0 while not abort: rd, wr, ex = select([self.socket.fileno()], [], [], self.timeout) if rd: self.handle_request() abort = self.abort | 0844d53e3656902c7bcae91b70ecad553c369283 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/0844d53e3656902c7bcae91b70ecad553c369283/test_logging.py |
sys.stdout.write("About to start TCP server...\n") | def test_main(): rootLogger = logging.getLogger("") rootLogger.setLevel(logging.DEBUG) hdlr = logging.StreamHandler(sys.stdout) fmt = logging.Formatter(logging.BASIC_FORMAT) hdlr.setFormatter(fmt) rootLogger.addHandler(hdlr) #Set up a handler such that all events are sent via a socket to the log #receiver (logrecv). #The handler will only be added to the rootLogger for some of the tests hdlr = logging.handlers.SocketHandler('localhost', logging.handlers.DEFAULT_TCP_LOGGING_PORT) #Configure the logger for logrecv so events do not propagate beyond it. #The sockLogger output is buffered in memory until the end of the test, #and printed at the end. sockOut = cStringIO.StringIO() sockLogger = logging.getLogger("logrecv") sockLogger.setLevel(logging.DEBUG) sockhdlr = logging.StreamHandler(sockOut) sockhdlr.setFormatter(logging.Formatter( "%(name)s -> %(levelname)s: %(message)s")) sockLogger.addHandler(sockhdlr) sockLogger.propagate = 0 #Set up servers threads = [] tcpserver = LogRecordSocketReceiver() sys.stdout.write("About to start TCP server...\n") threads.append(threading.Thread(target=runTCP, args=(tcpserver,))) for thread in threads: thread.start() try: banner("log_test0", "begin") rootLogger.addHandler(hdlr) test0() rootLogger.removeHandler(hdlr) banner("log_test0", "end") banner("log_test1", "begin") test1() banner("log_test1", "end") banner("log_test2", "begin") test2() banner("log_test2", "end") banner("log_test3", "begin") test3() banner("log_test3", "end") banner("logrecv output", "begin") sys.stdout.write(sockOut.getvalue()) sockOut.close() banner("logrecv output", "end") finally: #shut down server tcpserver.abort = 1 for thread in threads: thread.join() | 0844d53e3656902c7bcae91b70ecad553c369283 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/0844d53e3656902c7bcae91b70ecad553c369283/test_logging.py |
|
banner("logrecv output", "begin") sys.stdout.write(sockOut.getvalue()) sockOut.close() banner("logrecv output", "end") | def test_main(): rootLogger = logging.getLogger("") rootLogger.setLevel(logging.DEBUG) hdlr = logging.StreamHandler(sys.stdout) fmt = logging.Formatter(logging.BASIC_FORMAT) hdlr.setFormatter(fmt) rootLogger.addHandler(hdlr) #Set up a handler such that all events are sent via a socket to the log #receiver (logrecv). #The handler will only be added to the rootLogger for some of the tests hdlr = logging.handlers.SocketHandler('localhost', logging.handlers.DEFAULT_TCP_LOGGING_PORT) #Configure the logger for logrecv so events do not propagate beyond it. #The sockLogger output is buffered in memory until the end of the test, #and printed at the end. sockOut = cStringIO.StringIO() sockLogger = logging.getLogger("logrecv") sockLogger.setLevel(logging.DEBUG) sockhdlr = logging.StreamHandler(sockOut) sockhdlr.setFormatter(logging.Formatter( "%(name)s -> %(levelname)s: %(message)s")) sockLogger.addHandler(sockhdlr) sockLogger.propagate = 0 #Set up servers threads = [] tcpserver = LogRecordSocketReceiver() sys.stdout.write("About to start TCP server...\n") threads.append(threading.Thread(target=runTCP, args=(tcpserver,))) for thread in threads: thread.start() try: banner("log_test0", "begin") rootLogger.addHandler(hdlr) test0() rootLogger.removeHandler(hdlr) banner("log_test0", "end") banner("log_test1", "begin") test1() banner("log_test1", "end") banner("log_test2", "begin") test2() banner("log_test2", "end") banner("log_test3", "begin") test3() banner("log_test3", "end") banner("logrecv output", "begin") sys.stdout.write(sockOut.getvalue()) sockOut.close() banner("logrecv output", "end") finally: #shut down server tcpserver.abort = 1 for thread in threads: thread.join() | 0844d53e3656902c7bcae91b70ecad553c369283 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/0844d53e3656902c7bcae91b70ecad553c369283/test_logging.py |
|
sys.stdout.flush() | def test_main(): rootLogger = logging.getLogger("") rootLogger.setLevel(logging.DEBUG) hdlr = logging.StreamHandler(sys.stdout) fmt = logging.Formatter(logging.BASIC_FORMAT) hdlr.setFormatter(fmt) rootLogger.addHandler(hdlr) #Set up a handler such that all events are sent via a socket to the log #receiver (logrecv). #The handler will only be added to the rootLogger for some of the tests hdlr = logging.handlers.SocketHandler('localhost', logging.handlers.DEFAULT_TCP_LOGGING_PORT) #Configure the logger for logrecv so events do not propagate beyond it. #The sockLogger output is buffered in memory until the end of the test, #and printed at the end. sockOut = cStringIO.StringIO() sockLogger = logging.getLogger("logrecv") sockLogger.setLevel(logging.DEBUG) sockhdlr = logging.StreamHandler(sockOut) sockhdlr.setFormatter(logging.Formatter( "%(name)s -> %(levelname)s: %(message)s")) sockLogger.addHandler(sockhdlr) sockLogger.propagate = 0 #Set up servers threads = [] tcpserver = LogRecordSocketReceiver() sys.stdout.write("About to start TCP server...\n") threads.append(threading.Thread(target=runTCP, args=(tcpserver,))) for thread in threads: thread.start() try: banner("log_test0", "begin") rootLogger.addHandler(hdlr) test0() rootLogger.removeHandler(hdlr) banner("log_test0", "end") banner("log_test1", "begin") test1() banner("log_test1", "end") banner("log_test2", "begin") test2() banner("log_test2", "end") banner("log_test3", "begin") test3() banner("log_test3", "end") banner("logrecv output", "begin") sys.stdout.write(sockOut.getvalue()) sockOut.close() banner("logrecv output", "end") finally: #shut down server tcpserver.abort = 1 for thread in threads: thread.join() | 0844d53e3656902c7bcae91b70ecad553c369283 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/0844d53e3656902c7bcae91b70ecad553c369283/test_logging.py |
|
__import__(ext.name) | imp.load_dynamic(ext.name, ext_filename) | def build_extension(self, ext): | 5040d17b0506ec706385694db75b0cd71d5ab816 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5040d17b0506ec706385694db75b0cd71d5ab816/setup.py |
oparg = ord(code[i]) + ord(code[i+1])*256 | oparg = ord(code[i]) + ord(code[i+1])*256 + extended_arg extended_arg = 0 | def disassemble(co, lasti=-1): """Disassemble a code object.""" code = co.co_code labels = findlabels(code) n = len(code) i = 0 while i < n: c = code[i] op = ord(c) if op == SET_LINENO and i > 0: print # Extra blank line if i == lasti: print '-->', else: print ' ', if i in labels: print '>>', else: print ' ', print string.rjust(`i`, 4), print string.ljust(opname[op], 20), i = i+1 if op >= HAVE_ARGUMENT: oparg = ord(code[i]) + ord(code[i+1])*256 i = i+2 print string.rjust(`oparg`, 5), if op in hasconst: print '(' + `co.co_consts[oparg]` + ')', elif op in hasname: print '(' + co.co_names[oparg] + ')', elif op in hasjrel: print '(to ' + `i + oparg` + ')', elif op in haslocal: print '(' + co.co_varnames[oparg] + ')', elif op in hascompare: print '(' + cmp_op[oparg] + ')', print | aae123dd6672b549f7f87ca80e3dac359180254c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/aae123dd6672b549f7f87ca80e3dac359180254c/dis.py |
self.simpleElement("real", str(value)) | self.simpleElement("real", repr(value)) | def writeValue(self, value): if isinstance(value, (str, unicode)): self.simpleElement("string", value) elif isinstance(value, bool): # must switch for bool before int, as bool is a # subclass of int... if value: self.simpleElement("true") else: self.simpleElement("false") elif isinstance(value, int): self.simpleElement("integer", str(value)) elif isinstance(value, float): # should perhaps use repr() for better precision? self.simpleElement("real", str(value)) elif isinstance(value, dict): self.writeDict(value) elif isinstance(value, Data): self.writeData(value) elif isinstance(value, Date): self.simpleElement("date", value.toString()) elif isinstance(value, (tuple, list)): self.writeArray(value) else: raise TypeError("unsuported type: %s" % type(value)) | db18cae3fb4acb2ad7fd458106f7bd6f0e45be2f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/db18cae3fb4acb2ad7fd458106f7bd6f0e45be2f/plistlib.py |
import base64 | def fromBase64(cls, data): import base64 return cls(base64.decodestring(data)) | db18cae3fb4acb2ad7fd458106f7bd6f0e45be2f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/db18cae3fb4acb2ad7fd458106f7bd6f0e45be2f/plistlib.py |
|
import base64 | def asBase64(self): import base64 return base64.encodestring(self.data) | db18cae3fb4acb2ad7fd458106f7bd6f0e45be2f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/db18cae3fb4acb2ad7fd458106f7bd6f0e45be2f/plistlib.py |
|
"""Primitive date wrapper, uses time floats internally, is agnostic about time zones. | """Primitive date wrapper, uses UTC datetime instances internally. | def __repr__(self): return "%s(%s)" % (self.__class__.__name__, repr(self.data)) | db18cae3fb4acb2ad7fd458106f7bd6f0e45be2f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/db18cae3fb4acb2ad7fd458106f7bd6f0e45be2f/plistlib.py |
if isinstance(date, str): from xml.utils.iso8601 import parse date = parse(date) | if isinstance(date, datetime.datetime): pass elif isinstance(date, (float, int)): date = datetime.datetime.fromtimestamp(date) elif isinstance(date, basestring): order = ('year', 'month', 'day', 'hour', 'minute', 'second') gd = _dateParser.match(date).groupdict() lst = [] for key in order: val = gd[key] if val is None: break lst.append(int(val)) date = datetime.datetime(*lst) else: raise ValueError, "Can't convert %r to datetime" % (date,) | def __init__(self, date): if isinstance(date, str): from xml.utils.iso8601 import parse date = parse(date) self.date = date | db18cae3fb4acb2ad7fd458106f7bd6f0e45be2f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/db18cae3fb4acb2ad7fd458106f7bd6f0e45be2f/plistlib.py |
from xml.utils.iso8601 import tostring return tostring(self.date) | d = self.date return '%04d-%02d-%02dT%02d:%02d:%02dZ' % ( d.year, d.month, d.day, d.second, d.minute, d.hour, ) | def toString(self): from xml.utils.iso8601 import tostring return tostring(self.date) | db18cae3fb4acb2ad7fd458106f7bd6f0e45be2f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/db18cae3fb4acb2ad7fd458106f7bd6f0e45be2f/plistlib.py |
elif isinstance(other, (int, float)): return cmp(self.date, other) | elif isinstance(other, (datetime.datetime, float, int, basestring)): return cmp(self.date, Date(other).date) | def __cmp__(self, other): if isinstance(other, self.__class__): return cmp(self.date, other.date) elif isinstance(other, (int, float)): return cmp(self.date, other) else: return cmp(id(self), id(other)) | db18cae3fb4acb2ad7fd458106f7bd6f0e45be2f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/db18cae3fb4acb2ad7fd458106f7bd6f0e45be2f/plistlib.py |
def parse(self, file): | def parse(self, fileobj): | def parse(self, file): from xml.parsers.expat import ParserCreate parser = ParserCreate() parser.StartElementHandler = self.handleBeginElement parser.EndElementHandler = self.handleEndElement parser.CharacterDataHandler = self.handleData parser.ParseFile(file) return self.root | db18cae3fb4acb2ad7fd458106f7bd6f0e45be2f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/db18cae3fb4acb2ad7fd458106f7bd6f0e45be2f/plistlib.py |
parser.ParseFile(file) | parser.ParseFile(fileobj) | def parse(self, file): from xml.parsers.expat import ParserCreate parser = ParserCreate() parser.StartElementHandler = self.handleBeginElement parser.EndElementHandler = self.handleEndElement parser.CharacterDataHandler = self.handleData parser.ParseFile(file) return self.root | db18cae3fb4acb2ad7fd458106f7bd6f0e45be2f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/db18cae3fb4acb2ad7fd458106f7bd6f0e45be2f/plistlib.py |
compile_dir(dir, maxlevels, None, force) | success = success and compile_dir(dir, maxlevels, None, force) return success | def compile_path(skip_curdir=1, maxlevels=0, force=0): """Byte-compile all module on sys.path. Arguments (all optional): skip_curdir: if true, skip current directory (default true) maxlevels: max recursion level (default 0) force: as for compile_dir() (default 0) """ for dir in sys.path: if (not dir or dir == os.curdir) and skip_curdir: print 'Skipping current directory' else: compile_dir(dir, maxlevels, None, force) | 43466024fcd34a55fb212b6e9e92f95bc4f0917e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/43466024fcd34a55fb212b6e9e92f95bc4f0917e/compileall.py |
compile_dir(dir, maxlevels, ddir, force) | success = success and compile_dir(dir, maxlevels, ddir, force) | def main(): """Script main program.""" import getopt try: opts, args = getopt.getopt(sys.argv[1:], 'lfd:') except getopt.error, msg: print msg print "usage: compileall [-l] [-f] [-d destdir] [directory ...]" print "-l: don't recurse down" print "-f: force rebuild even if timestamps are up-to-date" print "-d destdir: purported directory name for error messages" print "if no directory arguments, -l sys.path is assumed" sys.exit(2) maxlevels = 10 ddir = None force = 0 for o, a in opts: if o == '-l': maxlevels = 0 if o == '-d': ddir = a if o == '-f': force = 1 if ddir: if len(args) != 1: print "-d destdir require exactly one directory argument" sys.exit(2) try: if args: for dir in args: compile_dir(dir, maxlevels, ddir, force) else: compile_path() except KeyboardInterrupt: print "\n[interrupt]" | 43466024fcd34a55fb212b6e9e92f95bc4f0917e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/43466024fcd34a55fb212b6e9e92f95bc4f0917e/compileall.py |
compile_path() | success = compile_path() | def main(): """Script main program.""" import getopt try: opts, args = getopt.getopt(sys.argv[1:], 'lfd:') except getopt.error, msg: print msg print "usage: compileall [-l] [-f] [-d destdir] [directory ...]" print "-l: don't recurse down" print "-f: force rebuild even if timestamps are up-to-date" print "-d destdir: purported directory name for error messages" print "if no directory arguments, -l sys.path is assumed" sys.exit(2) maxlevels = 10 ddir = None force = 0 for o, a in opts: if o == '-l': maxlevels = 0 if o == '-d': ddir = a if o == '-f': force = 1 if ddir: if len(args) != 1: print "-d destdir require exactly one directory argument" sys.exit(2) try: if args: for dir in args: compile_dir(dir, maxlevels, ddir, force) else: compile_path() except KeyboardInterrupt: print "\n[interrupt]" | 43466024fcd34a55fb212b6e9e92f95bc4f0917e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/43466024fcd34a55fb212b6e9e92f95bc4f0917e/compileall.py |
main() | sys.exit(not main()) | def main(): """Script main program.""" import getopt try: opts, args = getopt.getopt(sys.argv[1:], 'lfd:') except getopt.error, msg: print msg print "usage: compileall [-l] [-f] [-d destdir] [directory ...]" print "-l: don't recurse down" print "-f: force rebuild even if timestamps are up-to-date" print "-d destdir: purported directory name for error messages" print "if no directory arguments, -l sys.path is assumed" sys.exit(2) maxlevels = 10 ddir = None force = 0 for o, a in opts: if o == '-l': maxlevels = 0 if o == '-d': ddir = a if o == '-f': force = 1 if ddir: if len(args) != 1: print "-d destdir require exactly one directory argument" sys.exit(2) try: if args: for dir in args: compile_dir(dir, maxlevels, ddir, force) else: compile_path() except KeyboardInterrupt: print "\n[interrupt]" | 43466024fcd34a55fb212b6e9e92f95bc4f0917e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/43466024fcd34a55fb212b6e9e92f95bc4f0917e/compileall.py |
f = codecs.getwriter(self.encoding)(s) | f = codecs.getreader(self.encoding)(s) | def test_badbom(self): s = StringIO.StringIO("\xff\xff") f = codecs.getwriter(self.encoding)(s) self.assertRaises(UnicodeError, f.read) | dba72778e1699efe6169309e525352455797125c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/dba72778e1699efe6169309e525352455797125c/test_codecs.py |
f = codecs.getwriter(self.encoding)(s) | f = codecs.getreader(self.encoding)(s) | def test_badbom(self): s = StringIO.StringIO("\xff\xff") f = codecs.getwriter(self.encoding)(s) self.assertRaises(UnicodeError, f.read) | dba72778e1699efe6169309e525352455797125c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/dba72778e1699efe6169309e525352455797125c/test_codecs.py |
def addwork(self, job): if not job: raise TypeError, 'cannot add null job' | def addwork(self, func, args): job = (func, args) | def addwork(self, job): if not job: raise TypeError, 'cannot add null job' self.mutex.acquire() self.work.append(job) self.mutex.release() if len(self.work) == 1: self.todo.release() | 1f2d599483f0de4985b22ff58524ec806da21e64 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1f2d599483f0de4985b22ff58524ec806da21e64/find.py |
Ctrl-E Go to right edge (nospaces off) or end of line (nospaces on). | Ctrl-E Go to right edge (stripspaces off) or end of line (stripspaces on). | def rectangle(win, uly, ulx, lry, lrx): "Draw a rectangle." win.vline(uly+1, ulx, curses.ACS_VLINE, lry - uly - 1) win.hline(uly, ulx+1, curses.ACS_HLINE, lrx - ulx - 1) win.hline(lry, ulx+1, curses.ACS_HLINE, lrx - ulx - 1) win.vline(uly+1, lrx, curses.ACS_VLINE, lry - uly - 1) win.addch(uly, ulx, curses.ACS_ULCORNER) win.addch(uly, lrx, curses.ACS_URCORNER) win.addch(lry, lrx, curses.ACS_LRCORNER) win.addch(lry, ulx, curses.ACS_LLCORNER) | ecb4ce01035f420a5b56798053ec52bfbf5f9123 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ecb4ce01035f420a5b56798053ec52bfbf5f9123/textpad.py |
Ctrl-L Refresh screen | Ctrl-L Refresh screen. | def rectangle(win, uly, ulx, lry, lrx): "Draw a rectangle." win.vline(uly+1, ulx, curses.ACS_VLINE, lry - uly - 1) win.hline(uly, ulx+1, curses.ACS_HLINE, lrx - ulx - 1) win.hline(lry, ulx+1, curses.ACS_HLINE, lrx - ulx - 1) win.vline(uly+1, lrx, curses.ACS_VLINE, lry - uly - 1) win.addch(uly, ulx, curses.ACS_ULCORNER) win.addch(uly, lrx, curses.ACS_URCORNER) win.addch(lry, lrx, curses.ACS_LRCORNER) win.addch(lry, ulx, curses.ACS_LLCORNER) | ecb4ce01035f420a5b56798053ec52bfbf5f9123 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ecb4ce01035f420a5b56798053ec52bfbf5f9123/textpad.py |
def firstblank(self, y): | def _end_of_line(self, y): | def firstblank(self, y): "Go to the location of the first blank on the given line." last = self.maxx while 1: if ascii.ascii(self.win.inch(y, last)) != ascii.SP: last = last + 1 break elif last == 0: break last = last - 1 return last | ecb4ce01035f420a5b56798053ec52bfbf5f9123 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ecb4ce01035f420a5b56798053ec52bfbf5f9123/textpad.py |
self.win.move(y-1, self.firstblank(y-1)) | self.win.move(y-1, self._end_of_line(y-1)) | def do_command(self, ch): "Process a single editing command." (y, x) = self.win.getyx() self.lastcmd = ch if ascii.isprint(ch): if y < self.maxy or x < self.maxx: # The try-catch ignores the error we trigger from some curses # versions by trying to write into the lowest-rightmost spot # in the self.window. try: self.win.addch(ch) except ERR: pass elif ch == ascii.SOH: # ^a self.win.move(y, 0) elif ch in (ascii.STX,curses.KEY_LEFT, ascii.BS,curses.KEY_BACKSPACE): if x > 0: self.win.move(y, x-1) elif y == 0: pass elif self.stripspaces: self.win.move(y-1, self.firstblank(y-1)) else: self.win.move(y-1, self.maxx) if ch in (ascii.BS, curses.KEY_BACKSPACE): self.win.delch() elif ch == ascii.EOT: # ^d self.win.delch() elif ch == ascii.ENQ: # ^e if self.stripspaces: self.win.move(y, self.firstblank(y)) else: self.win.move(y, self.maxx) elif ch in (ascii.ACK, curses.KEY_RIGHT): # ^f if x < self.maxx: self.win.move(y, x+1) elif y == self.maxy: pass else: self.win.move(y+1, 0) elif ch == ascii.BEL: # ^g return 0 elif ch == ascii.NL: # ^j if self.maxy == 0: return 0 elif y < self.maxy: self.win.move(y+1, 0) elif ch == ascii.VT: # ^k if x == 0 and self.firstblank(y) == 0: self.win.deleteln() else: self.win.clrtoeol() elif ch == ascii.FF: # ^l self.win.refresh() elif ch in (ascii.SO, curses.KEY_DOWN): # ^n if y < self.maxy: self.win.move(y+1, x) elif ch == ascii.SI: # ^o self.win.insertln() elif ch in (ascii.DLE, curses.KEY_UP): # ^p if y > 0: self.win.move(y-1, x) return 1 | ecb4ce01035f420a5b56798053ec52bfbf5f9123 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ecb4ce01035f420a5b56798053ec52bfbf5f9123/textpad.py |
self.win.move(y, self.firstblank(y)) | self.win.move(y, self._end_of_line(y)) | def do_command(self, ch): "Process a single editing command." (y, x) = self.win.getyx() self.lastcmd = ch if ascii.isprint(ch): if y < self.maxy or x < self.maxx: # The try-catch ignores the error we trigger from some curses # versions by trying to write into the lowest-rightmost spot # in the self.window. try: self.win.addch(ch) except ERR: pass elif ch == ascii.SOH: # ^a self.win.move(y, 0) elif ch in (ascii.STX,curses.KEY_LEFT, ascii.BS,curses.KEY_BACKSPACE): if x > 0: self.win.move(y, x-1) elif y == 0: pass elif self.stripspaces: self.win.move(y-1, self.firstblank(y-1)) else: self.win.move(y-1, self.maxx) if ch in (ascii.BS, curses.KEY_BACKSPACE): self.win.delch() elif ch == ascii.EOT: # ^d self.win.delch() elif ch == ascii.ENQ: # ^e if self.stripspaces: self.win.move(y, self.firstblank(y)) else: self.win.move(y, self.maxx) elif ch in (ascii.ACK, curses.KEY_RIGHT): # ^f if x < self.maxx: self.win.move(y, x+1) elif y == self.maxy: pass else: self.win.move(y+1, 0) elif ch == ascii.BEL: # ^g return 0 elif ch == ascii.NL: # ^j if self.maxy == 0: return 0 elif y < self.maxy: self.win.move(y+1, 0) elif ch == ascii.VT: # ^k if x == 0 and self.firstblank(y) == 0: self.win.deleteln() else: self.win.clrtoeol() elif ch == ascii.FF: # ^l self.win.refresh() elif ch in (ascii.SO, curses.KEY_DOWN): # ^n if y < self.maxy: self.win.move(y+1, x) elif ch == ascii.SI: # ^o self.win.insertln() elif ch in (ascii.DLE, curses.KEY_UP): # ^p if y > 0: self.win.move(y-1, x) return 1 | ecb4ce01035f420a5b56798053ec52bfbf5f9123 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ecb4ce01035f420a5b56798053ec52bfbf5f9123/textpad.py |
if x == 0 and self.firstblank(y) == 0: | if x == 0 and self._end_of_line(y) == 0: | def do_command(self, ch): "Process a single editing command." (y, x) = self.win.getyx() self.lastcmd = ch if ascii.isprint(ch): if y < self.maxy or x < self.maxx: # The try-catch ignores the error we trigger from some curses # versions by trying to write into the lowest-rightmost spot # in the self.window. try: self.win.addch(ch) except ERR: pass elif ch == ascii.SOH: # ^a self.win.move(y, 0) elif ch in (ascii.STX,curses.KEY_LEFT, ascii.BS,curses.KEY_BACKSPACE): if x > 0: self.win.move(y, x-1) elif y == 0: pass elif self.stripspaces: self.win.move(y-1, self.firstblank(y-1)) else: self.win.move(y-1, self.maxx) if ch in (ascii.BS, curses.KEY_BACKSPACE): self.win.delch() elif ch == ascii.EOT: # ^d self.win.delch() elif ch == ascii.ENQ: # ^e if self.stripspaces: self.win.move(y, self.firstblank(y)) else: self.win.move(y, self.maxx) elif ch in (ascii.ACK, curses.KEY_RIGHT): # ^f if x < self.maxx: self.win.move(y, x+1) elif y == self.maxy: pass else: self.win.move(y+1, 0) elif ch == ascii.BEL: # ^g return 0 elif ch == ascii.NL: # ^j if self.maxy == 0: return 0 elif y < self.maxy: self.win.move(y+1, 0) elif ch == ascii.VT: # ^k if x == 0 and self.firstblank(y) == 0: self.win.deleteln() else: self.win.clrtoeol() elif ch == ascii.FF: # ^l self.win.refresh() elif ch in (ascii.SO, curses.KEY_DOWN): # ^n if y < self.maxy: self.win.move(y+1, x) elif ch == ascii.SI: # ^o self.win.insertln() elif ch in (ascii.DLE, curses.KEY_UP): # ^p if y > 0: self.win.move(y-1, x) return 1 | ecb4ce01035f420a5b56798053ec52bfbf5f9123 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ecb4ce01035f420a5b56798053ec52bfbf5f9123/textpad.py |
stop = self.firstblank(y) | stop = self._end_of_line(y) | def gather(self): "Collect and return the contents of the window." result = "" for y in range(self.maxy+1): self.win.move(y, 0) stop = self.firstblank(y) #sys.stderr.write("y=%d, firstblank(y)=%d\n" % (y, stop)) if stop == 0 and self.stripspaces: continue for x in range(self.maxx+1): if self.stripspaces and x == stop: break result = result + chr(ascii.ascii(self.win.inch(y, x))) if self.maxy > 0: result = result + "\n" return result | ecb4ce01035f420a5b56798053ec52bfbf5f9123 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ecb4ce01035f420a5b56798053ec52bfbf5f9123/textpad.py |
while not os.path.isdir(":Mac:Plugins"): | while not os.path.isdir(":Mac:PlugIns"): | def gotopluginfolder(): """Go to the plugin folder, assuming we are somewhere in the Python tree""" import os while not os.path.isdir(":Mac:Plugins"): os.chdir("::") os.chdir(":Mac:Plugins") if verbose: print "current directory is", os.getcwd() | 6f64d41ac974d9168ddb8f710ec995dc98e77fc6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/6f64d41ac974d9168ddb8f710ec995dc98e77fc6/ConfigurePython.py |
os.chdir(":Mac:Plugins") | os.chdir(":Mac:PlugIns") | def gotopluginfolder(): """Go to the plugin folder, assuming we are somewhere in the Python tree""" import os while not os.path.isdir(":Mac:Plugins"): os.chdir("::") os.chdir(":Mac:Plugins") if verbose: print "current directory is", os.getcwd() | 6f64d41ac974d9168ddb8f710ec995dc98e77fc6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/6f64d41ac974d9168ddb8f710ec995dc98e77fc6/ConfigurePython.py |
if not os.path.exists(src): if not os.path.exists(altsrc): | if not os.path.exists(os.path.join(sys.exec_prefix, src)): if not os.path.exists(os.path.join(sys.exec_prefix, altsrc)): | def mkcorealias(src, altsrc): import string import macostools version = string.split(sys.version)[0] dst = getextensiondirfile(src+ ' ' + version) if not os.path.exists(src): if not os.path.exists(altsrc): if verbose: print '*', src, 'not found' return 0 src = altsrc try: os.unlink(dst) except os.error: pass macostools.mkalias(src, dst) if verbose: print ' ', dst, '->', src return 1 | 6f64d41ac974d9168ddb8f710ec995dc98e77fc6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/6f64d41ac974d9168ddb8f710ec995dc98e77fc6/ConfigurePython.py |
macostools.mkalias(src, dst) | macostools.mkalias(os.path.join(sys.exec_prefix, src), dst) | def mkcorealias(src, altsrc): import string import macostools version = string.split(sys.version)[0] dst = getextensiondirfile(src+ ' ' + version) if not os.path.exists(src): if not os.path.exists(altsrc): if verbose: print '*', src, 'not found' return 0 src = altsrc try: os.unlink(dst) except os.error: pass macostools.mkalias(src, dst) if verbose: print ' ', dst, '->', src return 1 | 6f64d41ac974d9168ddb8f710ec995dc98e77fc6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/6f64d41ac974d9168ddb8f710ec995dc98e77fc6/ConfigurePython.py |
if intro is not None: self.intro = intro if self.intro: self.stdout.write(str(self.intro)+"\n") stop = None while not stop: if self.cmdqueue: line = self.cmdqueue.pop(0) else: if self.use_rawinput: try: line = raw_input(self.prompt) except EOFError: line = 'EOF' else: self.stdout.write(self.prompt) self.stdout.flush() line = self.stdin.readline() if not len(line): line = 'EOF' else: line = line[:-1] line = self.precmd(line) stop = self.onecmd(line) stop = self.postcmd(stop, line) self.postloop() def precmd(self, line): """Hook method executed just before the command line is interpreted, but after the input prompt is generated and issued. """ return line def postcmd(self, stop, line): """Hook method executed just after a command dispatch is finished.""" return stop def preloop(self): """Hook method executed once when the cmdloop() method is called.""" if self.completekey: | if self.use_rawinput and self.completekey: | def cmdloop(self, intro=None): """Repeatedly issue a prompt, accept input, parse an initial prefix off the received input, and dispatch to action methods, passing them the remainder of the line as argument. | 39682cc9eb4d740b6d603f582659bcec4f5238f9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/39682cc9eb4d740b6d603f582659bcec4f5238f9/cmd.py |
if self.completekey: try: import readline readline.set_completer(self.old_completer) except ImportError: pass | pass | def postloop(self): """Hook method executed once when the cmdloop() method is about to return. | 39682cc9eb4d740b6d603f582659bcec4f5238f9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/39682cc9eb4d740b6d603f582659bcec4f5238f9/cmd.py |
def run_suite(suite): | def run_suite(suite, testclass=None): | def run_suite(suite): """Run tests from a unittest.TestSuite-derived class.""" if verbose: runner = unittest.TextTestRunner(sys.stdout, verbosity=2) else: runner = BasicTestRunner() result = runner.run(suite) if not result.wasSuccessful(): if len(result.errors) == 1 and not result.failures: err = result.errors[0][1] elif len(result.failures) == 1 and not result.errors: err = result.failures[0][1] else: raise TestFailed("errors occurred in %s.%s" % (testclass.__module__, testclass.__name__)) raise TestFailed(err) | f28cb9da8b6967491d4ef661a2d730f795d81316 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f28cb9da8b6967491d4ef661a2d730f795d81316/test_support.py |
raise TestFailed("errors occurred in %s.%s" % (testclass.__module__, testclass.__name__)) | if testclass is None: msg = "errors occurred; run in verbose mode for details" else: msg = "errors occurred in %s.%s" \ % (testclass.__module__, testclass.__name__) raise TestFailed(msg) | def run_suite(suite): """Run tests from a unittest.TestSuite-derived class.""" if verbose: runner = unittest.TextTestRunner(sys.stdout, verbosity=2) else: runner = BasicTestRunner() result = runner.run(suite) if not result.wasSuccessful(): if len(result.errors) == 1 and not result.failures: err = result.errors[0][1] elif len(result.failures) == 1 and not result.errors: err = result.failures[0][1] else: raise TestFailed("errors occurred in %s.%s" % (testclass.__module__, testclass.__name__)) raise TestFailed(err) | f28cb9da8b6967491d4ef661a2d730f795d81316 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f28cb9da8b6967491d4ef661a2d730f795d81316/test_support.py |
run_suite(unittest.makeSuite(testclass)) | run_suite(unittest.makeSuite(testclass), testclass) | def run_unittest(testclass): """Run tests from a unittest.TestCase-derived class.""" run_suite(unittest.makeSuite(testclass)) | f28cb9da8b6967491d4ef661a2d730f795d81316 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f28cb9da8b6967491d4ef661a2d730f795d81316/test_support.py |
return _Dialog._fixresult(widget, result) | return _Dialog._fixresult(self, widget, result) | def _fixresult(self, widget, result): if isinstance(result, tuple): # multiple results: result = tuple([getattr(r, "string", r) for r in result]) if result: import os path, file = os.path.split(result[0]) self.options["initialdir"] = path # don't set initialfile or filename, as we have multiple of these return result if not widget.tk.wantobjects() and "multiple" in self.options: # Need to split result explicitly return self._fixresult(widget, widget.tk.splitlist(result)) return _Dialog._fixresult(widget, result) | 02857c1278d1a81a932ad904e0a731667e9c0cb7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/02857c1278d1a81a932ad904e0a731667e9c0cb7/tkFileDialog.py |
def _import_hook(self, fqname, globals=None, locals=None, fromlist=None): """Python calls this hook to locate and import a module.""" | 1074dd8465de6cd653f9538d144f0d85e05ebf73 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1074dd8465de6cd653f9538d144f0d85e05ebf73/imputil.py |
||
return top_module | if fromlist: return getattr(top_module, parts[1]) else: return top_module | def _import_hook(self, fqname, globals=None, locals=None, fromlist=None): """Python calls this hook to locate and import a module.""" | 1074dd8465de6cd653f9538d144f0d85e05ebf73 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1074dd8465de6cd653f9538d144f0d85e05ebf73/imputil.py |
self.editFont=tkFont.Font(self,('courier',12,'normal')) | self.editFont=tkFont.Font(self,('courier',10,'normal')) | def CreatePageFontTab(self): #tkVars self.fontSize=StringVar(self) self.fontBold=BooleanVar(self) self.fontName=StringVar(self) self.spaceNum=IntVar(self) #self.tabCols=IntVar(self) self.indentBySpaces=BooleanVar(self) self.editFont=tkFont.Font(self,('courier',12,'normal')) ##widget creation #body frame frame=self.tabPages.pages['Fonts/Tabs']['page'] #body section frames frameFont=Frame(frame,borderwidth=2,relief=GROOVE) frameIndent=Frame(frame,borderwidth=2,relief=GROOVE) #frameFont labelFontTitle=Label(frameFont,text='Set Base Editor Font') frameFontName=Frame(frameFont) frameFontParam=Frame(frameFont) labelFontNameTitle=Label(frameFontName,justify=LEFT, text='Font :') self.listFontName=Listbox(frameFontName,height=5,takefocus=FALSE, exportselection=FALSE) self.listFontName.bind('<ButtonRelease-1>',self.OnListFontButtonRelease) scrollFont=Scrollbar(frameFontName) scrollFont.config(command=self.listFontName.yview) self.listFontName.config(yscrollcommand=scrollFont.set) labelFontSizeTitle=Label(frameFontParam,text='Size :') self.optMenuFontSize=DynOptionMenu(frameFontParam,self.fontSize,None, command=self.SetFontSample) checkFontBold=Checkbutton(frameFontParam,variable=self.fontBold, onvalue=1,offvalue=0,text='Bold',command=self.SetFontSample) frameFontSample=Frame(frameFont,relief=SOLID,borderwidth=1) self.labelFontSample=Label(frameFontSample, text='AaBbCcDdEe\nFfGgHhIiJjK\n1234567890\n#:+=(){}[]', justify=LEFT,font=self.editFont) #frameIndent labelIndentTitle=Label(frameIndent,text='Set Indentation Defaults') frameIndentType=Frame(frameIndent) frameIndentSize=Frame(frameIndent) labelIndentTypeTitle=Label(frameIndentType, text='Choose indentation type :') radioUseSpaces=Radiobutton(frameIndentType,variable=self.indentBySpaces, value=1,text='Tab key inserts spaces') radioUseTabs=Radiobutton(frameIndentType,variable=self.indentBySpaces, value=0,text='Tab key inserts tabs') labelIndentSizeTitle=Label(frameIndentSize, text='Choose indentation size :') labelSpaceNumTitle=Label(frameIndentSize,justify=LEFT, text='indent width') self.scaleSpaceNum=Scale(frameIndentSize,variable=self.spaceNum, orient='horizontal',tickinterval=2,from_=2,to=16) #labeltabColsTitle=Label(frameIndentSize,justify=LEFT, # text='when tab key inserts tabs,\ncolumns per tab') #self.scaleTabCols=Scale(frameIndentSize,variable=self.tabCols, # orient='horizontal',tickinterval=2,from_=2,to=8) #widget packing #body frameFont.pack(side=LEFT,padx=5,pady=10,expand=TRUE,fill=BOTH) frameIndent.pack(side=LEFT,padx=5,pady=10,fill=Y) #frameFont labelFontTitle.pack(side=TOP,anchor=W,padx=5,pady=5) frameFontName.pack(side=TOP,padx=5,pady=5,fill=X) frameFontParam.pack(side=TOP,padx=5,pady=5,fill=X) labelFontNameTitle.pack(side=TOP,anchor=W) self.listFontName.pack(side=LEFT,expand=TRUE,fill=X) scrollFont.pack(side=LEFT,fill=Y) labelFontSizeTitle.pack(side=LEFT,anchor=W) self.optMenuFontSize.pack(side=LEFT,anchor=W) checkFontBold.pack(side=LEFT,anchor=W,padx=20) frameFontSample.pack(side=TOP,padx=5,pady=5,expand=TRUE,fill=BOTH) self.labelFontSample.pack(expand=TRUE,fill=BOTH) #frameIndent labelIndentTitle.pack(side=TOP,anchor=W,padx=5,pady=5) frameIndentType.pack(side=TOP,padx=5,fill=X) frameIndentSize.pack(side=TOP,padx=5,pady=5,fill=BOTH) labelIndentTypeTitle.pack(side=TOP,anchor=W,padx=5,pady=5) radioUseSpaces.pack(side=TOP,anchor=W,padx=5) radioUseTabs.pack(side=TOP,anchor=W,padx=5) labelIndentSizeTitle.pack(side=TOP,anchor=W,padx=5,pady=5) labelSpaceNumTitle.pack(side=TOP,anchor=W,padx=5) self.scaleSpaceNum.pack(side=TOP,padx=5,fill=X) #labeltabColsTitle.pack(side=TOP,anchor=W,padx=5) #self.scaleTabCols.pack(side=TOP,padx=5,fill=X) return frame | ca3c212db32de8c5626f76ab7c4b9881107ad630 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ca3c212db32de8c5626f76ab7c4b9881107ad630/configDialog.py |
self.fontName.set(self.listFontName.get(ANCHOR)) | font = self.listFontName.get(ANCHOR) self.fontName.set(font.lower()) | def OnListFontButtonRelease(self,event): self.fontName.set(self.listFontName.get(ANCHOR)) self.SetFontSample() | ca3c212db32de8c5626f76ab7c4b9881107ad630 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ca3c212db32de8c5626f76ab7c4b9881107ad630/configDialog.py |
self.fontName.set(configuredFont) if configuredFont in fonts: currentFontIndex=fonts.index(configuredFont) | lc_configuredFont = configuredFont.lower() self.fontName.set(lc_configuredFont) lc_fonts = [s.lower() for s in fonts] if lc_configuredFont in lc_fonts: currentFontIndex = lc_fonts.index(lc_configuredFont) | def LoadFontCfg(self): ##base editor font selection list fonts=list(tkFont.families(self)) fonts.sort() for font in fonts: self.listFontName.insert(END,font) configuredFont=idleConf.GetOption('main','EditorWindow','font', default='courier') self.fontName.set(configuredFont) if configuredFont in fonts: currentFontIndex=fonts.index(configuredFont) self.listFontName.see(currentFontIndex) self.listFontName.select_set(currentFontIndex) self.listFontName.select_anchor(currentFontIndex) ##font size dropdown fontSize=idleConf.GetOption('main','EditorWindow','font-size', default='12') self.optMenuFontSize.SetMenu(('7','8','9','10','11','12','13','14', '16','18','20','22'),fontSize ) ##fontWeight self.fontBold.set(idleConf.GetOption('main','EditorWindow', 'font-bold',default=0,type='bool')) ##font sample self.SetFontSample() | ca3c212db32de8c5626f76ab7c4b9881107ad630 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ca3c212db32de8c5626f76ab7c4b9881107ad630/configDialog.py |
default='12') | default='10') | def LoadFontCfg(self): ##base editor font selection list fonts=list(tkFont.families(self)) fonts.sort() for font in fonts: self.listFontName.insert(END,font) configuredFont=idleConf.GetOption('main','EditorWindow','font', default='courier') self.fontName.set(configuredFont) if configuredFont in fonts: currentFontIndex=fonts.index(configuredFont) self.listFontName.see(currentFontIndex) self.listFontName.select_set(currentFontIndex) self.listFontName.select_anchor(currentFontIndex) ##font size dropdown fontSize=idleConf.GetOption('main','EditorWindow','font-size', default='12') self.optMenuFontSize.SetMenu(('7','8','9','10','11','12','13','14', '16','18','20','22'),fontSize ) ##fontWeight self.fontBold.set(idleConf.GetOption('main','EditorWindow', 'font-bold',default=0,type='bool')) ##font sample self.SetFontSample() | ca3c212db32de8c5626f76ab7c4b9881107ad630 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ca3c212db32de8c5626f76ab7c4b9881107ad630/configDialog.py |
self.relative = 0 | def initialize_options (self): self.bdist_dir = None self.plat_name = None self.format = None self.keep_temp = 0 self.dist_dir = None self.skip_build = 0 | 907684388e7725cdde587a53061abd2b263d5600 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/907684388e7725cdde587a53061abd2b263d5600/bdist_dumb.py |
|
self.make_archive(os.path.join(self.dist_dir, archive_basename), self.format, root_dir=self.bdist_dir) | pseudoinstall_root = os.path.join(self.dist_dir, archive_basename) if not self.relative: archive_root = self.bdist_dir else: if (self.distribution.has_ext_modules() and (install.install_base != install.install_platbase)): raise DistutilsPlatformError, \ ("can't make a dumb built distribution where " "base and platbase are different (%s, %s)" % (repr(install.install_base), repr(install.install_platbase))) else: archive_root = os.path.join(self.bdist_dir, ensure_relative(install.install_base)) self.make_archive(pseudoinstall_root, self.format, root_dir=archive_root) | def run (self): | 907684388e7725cdde587a53061abd2b263d5600 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/907684388e7725cdde587a53061abd2b263d5600/bdist_dumb.py |
self.assert_(isinstance(bi[0], int)) | self.assert_(isinstance(bi[0], (int, long))) | def test_buffer_info(self): a = array.array(self.typecode, self.example) self.assertRaises(TypeError, a.buffer_info, 42) bi = a.buffer_info() self.assert_(isinstance(bi, tuple)) self.assertEqual(len(bi), 2) self.assert_(isinstance(bi[0], int)) self.assert_(isinstance(bi[1], int)) self.assertEqual(bi[1], len(a)) | e8c3bf57d99b78c504b8b1565eede81d85f0a429 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e8c3bf57d99b78c504b8b1565eede81d85f0a429/test_array.py |
labelEmail.grid(row=6,column=0,columnspan=2,sticky=W,padx=10,pady=0) | labelEmail.grid(row=6, column=0, columnspan=2, sticky=W, padx=10, pady=0) | def CreateWidgets(self): frameMain = Frame(self, borderwidth=2, relief=SUNKEN) frameButtons = Frame(self) frameButtons.pack(side=BOTTOM, fill=X) frameMain.pack(side=TOP, expand=TRUE, fill=BOTH) self.buttonOk = Button(frameButtons, text='Close', command=self.Ok) self.buttonOk.pack(padx=5, pady=5) #self.picture = Image('photo', data=self.pictureData) frameBg = Frame(frameMain, bg=self.bg) frameBg.pack(expand=TRUE, fill=BOTH) labelTitle = Label(frameBg, text='IDLE', fg=self.fg, bg=self.bg, font=('courier', 24, 'bold')) labelTitle.grid(row=0, column=0, sticky=W, padx=10, pady=10) #labelPicture = Label(frameBg, text='[picture]') #image=self.picture, bg=self.bg) #labelPicture.grid(row=1, column=1, sticky=W, rowspan=2, # padx=0, pady=3) byline = "Python's Integrated DeveLopment Environment" + 5*'\n' labelDesc = Label(frameBg, text=byline, justify=LEFT, fg=self.fg, bg=self.bg) labelDesc.grid(row=2, column=0, sticky=W, columnspan=3, padx=10, pady=5) labelEmail = Label(frameBg, text='email: [email protected]', justify=LEFT, fg=self.fg, bg=self.bg) labelEmail.grid(row=6,column=0,columnspan=2,sticky=W,padx=10,pady=0) labelWWW = Label(frameBg, text='www: http://www.python.org/idle/', justify=LEFT, fg=self.fg, bg=self.bg) labelWWW.grid(row=7, column=0, columnspan=2, sticky=W, padx=10, pady=0) Frame(frameBg, borderwidth=1, relief=SUNKEN, height=2, bg=self.bg).grid(row=8, column=0, sticky=EW, columnspan=3, padx=5, pady=5) labelPythonVer = Label(frameBg, text='Python version: ' + \ sys.version.split()[0], fg=self.fg, bg=self.bg) labelPythonVer.grid(row=9, column=0, sticky=W, padx=10, pady=0) # handle weird tk version num in windoze python >= 1.6 (?!?) tkVer = `TkVersion`.split('.') tkVer[len(tkVer)-1] = str('%.3g' % (float('.'+tkVer[len(tkVer)-1])))[2:] if tkVer[len(tkVer)-1] == '': tkVer[len(tkVer)-1] = '0' tkVer = string.join(tkVer,'.') labelTkVer = Label(frameBg, text='Tk version: '+ tkVer, fg=self.fg, bg=self.bg) labelTkVer.grid(row=9, column=1, sticky=W, padx=2, pady=0) py_button_f = Frame(frameBg, bg=self.bg) py_button_f.grid(row=10, column=0, columnspan=2, sticky=NSEW) buttonLicense = Button(py_button_f, text='License', width=8, highlightbackground=self.bg, command=self.ShowLicense) buttonLicense.pack(side=LEFT, padx=10, pady=10) buttonCopyright = Button(py_button_f, text='Copyright', width=8, highlightbackground=self.bg, command=self.ShowCopyright) buttonCopyright.pack(side=LEFT, padx=10, pady=10) buttonCredits = Button(py_button_f, text='Credits', width=8, highlightbackground=self.bg, command=self.ShowPythonCredits) buttonCredits.pack(side=LEFT, padx=10, pady=10) Frame(frameBg, borderwidth=1, relief=SUNKEN, height=2, bg=self.bg).grid(row=11, column=0, sticky=EW, columnspan=3, padx=5, pady=5) idle_v = Label(frameBg, text='IDLE version ' + idlever.IDLE_VERSION, fg=self.fg, bg=self.bg) idle_v.grid(row=12, column=0, sticky=W, padx=10, pady=0) idle_button_f = Frame(frameBg, bg=self.bg) idle_button_f.grid(row=13, column=0, columnspan=3, sticky=NSEW) idle_about_b = Button(idle_button_f, text='README', width=8, highlightbackground=self.bg, command=self.ShowIDLEAbout) idle_about_b.pack(side=LEFT, padx=10, pady=10) idle_news_b = Button(idle_button_f, text='NEWS', width=8, highlightbackground=self.bg, command=self.ShowIDLENEWS) idle_news_b.pack(side=LEFT, padx=10, pady=10) idle_credits_b = Button(idle_button_f, text='Credits', width=8, highlightbackground=self.bg, command=self.ShowIDLECredits) idle_credits_b.pack(side=LEFT, padx=10, pady=10) | 9d05254d7e8763cc0b622bb8106f4694aaa82b32 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9d05254d7e8763cc0b622bb8106f4694aaa82b32/aboutDialog.py |
idle_v = Label(frameBg, text='IDLE version ' + idlever.IDLE_VERSION, | idle_v = Label(frameBg, text='IDLE version: ' + idlever.IDLE_VERSION, | def CreateWidgets(self): frameMain = Frame(self, borderwidth=2, relief=SUNKEN) frameButtons = Frame(self) frameButtons.pack(side=BOTTOM, fill=X) frameMain.pack(side=TOP, expand=TRUE, fill=BOTH) self.buttonOk = Button(frameButtons, text='Close', command=self.Ok) self.buttonOk.pack(padx=5, pady=5) #self.picture = Image('photo', data=self.pictureData) frameBg = Frame(frameMain, bg=self.bg) frameBg.pack(expand=TRUE, fill=BOTH) labelTitle = Label(frameBg, text='IDLE', fg=self.fg, bg=self.bg, font=('courier', 24, 'bold')) labelTitle.grid(row=0, column=0, sticky=W, padx=10, pady=10) #labelPicture = Label(frameBg, text='[picture]') #image=self.picture, bg=self.bg) #labelPicture.grid(row=1, column=1, sticky=W, rowspan=2, # padx=0, pady=3) byline = "Python's Integrated DeveLopment Environment" + 5*'\n' labelDesc = Label(frameBg, text=byline, justify=LEFT, fg=self.fg, bg=self.bg) labelDesc.grid(row=2, column=0, sticky=W, columnspan=3, padx=10, pady=5) labelEmail = Label(frameBg, text='email: [email protected]', justify=LEFT, fg=self.fg, bg=self.bg) labelEmail.grid(row=6,column=0,columnspan=2,sticky=W,padx=10,pady=0) labelWWW = Label(frameBg, text='www: http://www.python.org/idle/', justify=LEFT, fg=self.fg, bg=self.bg) labelWWW.grid(row=7, column=0, columnspan=2, sticky=W, padx=10, pady=0) Frame(frameBg, borderwidth=1, relief=SUNKEN, height=2, bg=self.bg).grid(row=8, column=0, sticky=EW, columnspan=3, padx=5, pady=5) labelPythonVer = Label(frameBg, text='Python version: ' + \ sys.version.split()[0], fg=self.fg, bg=self.bg) labelPythonVer.grid(row=9, column=0, sticky=W, padx=10, pady=0) # handle weird tk version num in windoze python >= 1.6 (?!?) tkVer = `TkVersion`.split('.') tkVer[len(tkVer)-1] = str('%.3g' % (float('.'+tkVer[len(tkVer)-1])))[2:] if tkVer[len(tkVer)-1] == '': tkVer[len(tkVer)-1] = '0' tkVer = string.join(tkVer,'.') labelTkVer = Label(frameBg, text='Tk version: '+ tkVer, fg=self.fg, bg=self.bg) labelTkVer.grid(row=9, column=1, sticky=W, padx=2, pady=0) py_button_f = Frame(frameBg, bg=self.bg) py_button_f.grid(row=10, column=0, columnspan=2, sticky=NSEW) buttonLicense = Button(py_button_f, text='License', width=8, highlightbackground=self.bg, command=self.ShowLicense) buttonLicense.pack(side=LEFT, padx=10, pady=10) buttonCopyright = Button(py_button_f, text='Copyright', width=8, highlightbackground=self.bg, command=self.ShowCopyright) buttonCopyright.pack(side=LEFT, padx=10, pady=10) buttonCredits = Button(py_button_f, text='Credits', width=8, highlightbackground=self.bg, command=self.ShowPythonCredits) buttonCredits.pack(side=LEFT, padx=10, pady=10) Frame(frameBg, borderwidth=1, relief=SUNKEN, height=2, bg=self.bg).grid(row=11, column=0, sticky=EW, columnspan=3, padx=5, pady=5) idle_v = Label(frameBg, text='IDLE version ' + idlever.IDLE_VERSION, fg=self.fg, bg=self.bg) idle_v.grid(row=12, column=0, sticky=W, padx=10, pady=0) idle_button_f = Frame(frameBg, bg=self.bg) idle_button_f.grid(row=13, column=0, columnspan=3, sticky=NSEW) idle_about_b = Button(idle_button_f, text='README', width=8, highlightbackground=self.bg, command=self.ShowIDLEAbout) idle_about_b.pack(side=LEFT, padx=10, pady=10) idle_news_b = Button(idle_button_f, text='NEWS', width=8, highlightbackground=self.bg, command=self.ShowIDLENEWS) idle_news_b.pack(side=LEFT, padx=10, pady=10) idle_credits_b = Button(idle_button_f, text='Credits', width=8, highlightbackground=self.bg, command=self.ShowIDLECredits) idle_credits_b.pack(side=LEFT, padx=10, pady=10) | 9d05254d7e8763cc0b622bb8106f4694aaa82b32 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9d05254d7e8763cc0b622bb8106f4694aaa82b32/aboutDialog.py |
fn=os.path.join(os.path.abspath(os.path.dirname(__file__)),viewFile) | fn = os.path.join(os.path.abspath(os.path.dirname(__file__)), viewFile) | def ViewFile(self, viewTitle, viewFile, encoding=None): fn=os.path.join(os.path.abspath(os.path.dirname(__file__)),viewFile) if encoding: import codecs try: textFile = codecs.open(fn, 'r') except IOError: tkMessageBox.showerror(title='File Load Error', message='Unable to load file '+ `fileName`+' .') return else: data = textFile.read() else: data = None textView.TextViewer(self, viewTitle, fn, data=data) | 9d05254d7e8763cc0b622bb8106f4694aaa82b32 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9d05254d7e8763cc0b622bb8106f4694aaa82b32/aboutDialog.py |
aboutDialog.AboutDialog(root,'About') | aboutDialog.AboutDialog(root, 'About') | def run(): import aboutDialog aboutDialog.AboutDialog(root,'About') | 9d05254d7e8763cc0b622bb8106f4694aaa82b32 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9d05254d7e8763cc0b622bb8106f4694aaa82b32/aboutDialog.py |
parent = readmodule(package, path, inpackage) child = readmodule(submodule, parent['__path__'], 1) | parent = readmodule_ex(package, path, inpackage) child = readmodule_ex(submodule, parent['__path__'], 1) | def readmodule_ex(module, path=[], inpackage=0): '''Read a module file and return a dictionary of classes. Search for MODULE in PATH and sys.path, read and parse the module and return a dictionary with one entry for each class found in the module.''' dict = {} i = module.rfind('.') if i >= 0: # Dotted module name package = module[:i].strip() submodule = module[i+1:].strip() parent = readmodule(package, path, inpackage) child = readmodule(submodule, parent['__path__'], 1) return child if _modules.has_key(module): # we've seen this module before... return _modules[module] if module in sys.builtin_module_names: # this is a built-in module _modules[module] = dict return dict # search the path for the module f = None if inpackage: try: f, file, (suff, mode, type) = \ imp.find_module(module, path) except ImportError: f = None if f is None: fullpath = list(path) + sys.path f, file, (suff, mode, type) = imp.find_module(module, fullpath) if type == imp.PKG_DIRECTORY: dict['__path__'] = [file] _modules[module] = dict path = [file] + path f, file, (suff, mode, type) = \ imp.find_module('__init__', [file]) if type != imp.PY_SOURCE: # not Python source, can't do anything with this module f.close() _modules[module] = dict return dict _modules[module] = dict classstack = [] # stack of (class, indent) pairs src = f.read() f.close() # To avoid having to stop the regexp at each newline, instead # when we need a line number we simply string.count the number of # newlines in the string since the last time we did this; i.e., # lineno = lineno + \ # string.count(src, '\n', last_lineno_pos, here) # last_lineno_pos = here countnl = string.count lineno, last_lineno_pos = 1, 0 i = 0 while 1: m = _getnext(src, i) if not m: break start, i = m.span() if m.start("Method") >= 0: # found a method definition or function thisindent = _indent(m.group("MethodIndent")) meth_name = m.group("MethodName") lineno = lineno + \ countnl(src, '\n', last_lineno_pos, start) last_lineno_pos = start # close all classes indented at least as much while classstack and \ classstack[-1][1] >= thisindent: del classstack[-1] if classstack: # it's a class method cur_class = classstack[-1][0] cur_class._addmethod(meth_name, lineno) else: # it's a function f = Function(module, meth_name, file, lineno) dict[meth_name] = f elif m.start("String") >= 0: pass elif m.start("Class") >= 0: # we found a class definition thisindent = _indent(m.group("ClassIndent")) # close all classes indented at least as much while classstack and \ classstack[-1][1] >= thisindent: del classstack[-1] lineno = lineno + \ countnl(src, '\n', last_lineno_pos, start) last_lineno_pos = start class_name = m.group("ClassName") inherit = m.group("ClassSupers") if inherit: # the class inherits from other classes inherit = inherit[1:-1].strip() names = [] for n in inherit.split(','): n = n.strip() if dict.has_key(n): # we know this super class n = dict[n] else: c = n.split('.') if len(c) > 1: # super class # is of the # form module.class: # look in # module for class m = c[-2] c = c[-1] if _modules.has_key(m): d = _modules[m] if d.has_key(c): n = d[c] names.append(n) inherit = names # remember this class cur_class = Class(module, class_name, inherit, file, lineno) dict[class_name] = cur_class classstack.append((cur_class, thisindent)) elif m.start("Import") >= 0: # import module for n in m.group("ImportList").split(','): n = n.strip() try: # recursively read the imported module d = readmodule(n, path, inpackage) except: ##print 'module', n, 'not found' pass elif m.start("ImportFrom") >= 0: # from module import stuff mod = m.group("ImportFromPath") names = m.group("ImportFromList").split(',') try: # recursively read the imported module d = readmodule(mod, path, inpackage) except: ##print 'module', mod, 'not found' continue # add any classes that were defined in the # imported module to our name space if they # were mentioned in the list for n in names: n = n.strip() if d.has_key(n): dict[n] = d[n] elif n == '*': # only add a name if not # already there (to mimic what # Python does internally) # also don't add names that # start with _ for n in d.keys(): if n[0] != '_' and \ not dict.has_key(n): dict[n] = d[n] else: assert 0, "regexp _getnext found something unexpected" return dict | b25c78db0ea0d77e2a8bbcfb2cd7827a285c1d32 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b25c78db0ea0d77e2a8bbcfb2cd7827a285c1d32/pyclbr.py |
d = readmodule(n, path, inpackage) | d = readmodule_ex(n, path, inpackage) | def readmodule_ex(module, path=[], inpackage=0): '''Read a module file and return a dictionary of classes. Search for MODULE in PATH and sys.path, read and parse the module and return a dictionary with one entry for each class found in the module.''' dict = {} i = module.rfind('.') if i >= 0: # Dotted module name package = module[:i].strip() submodule = module[i+1:].strip() parent = readmodule(package, path, inpackage) child = readmodule(submodule, parent['__path__'], 1) return child if _modules.has_key(module): # we've seen this module before... return _modules[module] if module in sys.builtin_module_names: # this is a built-in module _modules[module] = dict return dict # search the path for the module f = None if inpackage: try: f, file, (suff, mode, type) = \ imp.find_module(module, path) except ImportError: f = None if f is None: fullpath = list(path) + sys.path f, file, (suff, mode, type) = imp.find_module(module, fullpath) if type == imp.PKG_DIRECTORY: dict['__path__'] = [file] _modules[module] = dict path = [file] + path f, file, (suff, mode, type) = \ imp.find_module('__init__', [file]) if type != imp.PY_SOURCE: # not Python source, can't do anything with this module f.close() _modules[module] = dict return dict _modules[module] = dict classstack = [] # stack of (class, indent) pairs src = f.read() f.close() # To avoid having to stop the regexp at each newline, instead # when we need a line number we simply string.count the number of # newlines in the string since the last time we did this; i.e., # lineno = lineno + \ # string.count(src, '\n', last_lineno_pos, here) # last_lineno_pos = here countnl = string.count lineno, last_lineno_pos = 1, 0 i = 0 while 1: m = _getnext(src, i) if not m: break start, i = m.span() if m.start("Method") >= 0: # found a method definition or function thisindent = _indent(m.group("MethodIndent")) meth_name = m.group("MethodName") lineno = lineno + \ countnl(src, '\n', last_lineno_pos, start) last_lineno_pos = start # close all classes indented at least as much while classstack and \ classstack[-1][1] >= thisindent: del classstack[-1] if classstack: # it's a class method cur_class = classstack[-1][0] cur_class._addmethod(meth_name, lineno) else: # it's a function f = Function(module, meth_name, file, lineno) dict[meth_name] = f elif m.start("String") >= 0: pass elif m.start("Class") >= 0: # we found a class definition thisindent = _indent(m.group("ClassIndent")) # close all classes indented at least as much while classstack and \ classstack[-1][1] >= thisindent: del classstack[-1] lineno = lineno + \ countnl(src, '\n', last_lineno_pos, start) last_lineno_pos = start class_name = m.group("ClassName") inherit = m.group("ClassSupers") if inherit: # the class inherits from other classes inherit = inherit[1:-1].strip() names = [] for n in inherit.split(','): n = n.strip() if dict.has_key(n): # we know this super class n = dict[n] else: c = n.split('.') if len(c) > 1: # super class # is of the # form module.class: # look in # module for class m = c[-2] c = c[-1] if _modules.has_key(m): d = _modules[m] if d.has_key(c): n = d[c] names.append(n) inherit = names # remember this class cur_class = Class(module, class_name, inherit, file, lineno) dict[class_name] = cur_class classstack.append((cur_class, thisindent)) elif m.start("Import") >= 0: # import module for n in m.group("ImportList").split(','): n = n.strip() try: # recursively read the imported module d = readmodule(n, path, inpackage) except: ##print 'module', n, 'not found' pass elif m.start("ImportFrom") >= 0: # from module import stuff mod = m.group("ImportFromPath") names = m.group("ImportFromList").split(',') try: # recursively read the imported module d = readmodule(mod, path, inpackage) except: ##print 'module', mod, 'not found' continue # add any classes that were defined in the # imported module to our name space if they # were mentioned in the list for n in names: n = n.strip() if d.has_key(n): dict[n] = d[n] elif n == '*': # only add a name if not # already there (to mimic what # Python does internally) # also don't add names that # start with _ for n in d.keys(): if n[0] != '_' and \ not dict.has_key(n): dict[n] = d[n] else: assert 0, "regexp _getnext found something unexpected" return dict | b25c78db0ea0d77e2a8bbcfb2cd7827a285c1d32 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b25c78db0ea0d77e2a8bbcfb2cd7827a285c1d32/pyclbr.py |
d = readmodule(mod, path, inpackage) | d = readmodule_ex(mod, path, inpackage) | def readmodule_ex(module, path=[], inpackage=0): '''Read a module file and return a dictionary of classes. Search for MODULE in PATH and sys.path, read and parse the module and return a dictionary with one entry for each class found in the module.''' dict = {} i = module.rfind('.') if i >= 0: # Dotted module name package = module[:i].strip() submodule = module[i+1:].strip() parent = readmodule(package, path, inpackage) child = readmodule(submodule, parent['__path__'], 1) return child if _modules.has_key(module): # we've seen this module before... return _modules[module] if module in sys.builtin_module_names: # this is a built-in module _modules[module] = dict return dict # search the path for the module f = None if inpackage: try: f, file, (suff, mode, type) = \ imp.find_module(module, path) except ImportError: f = None if f is None: fullpath = list(path) + sys.path f, file, (suff, mode, type) = imp.find_module(module, fullpath) if type == imp.PKG_DIRECTORY: dict['__path__'] = [file] _modules[module] = dict path = [file] + path f, file, (suff, mode, type) = \ imp.find_module('__init__', [file]) if type != imp.PY_SOURCE: # not Python source, can't do anything with this module f.close() _modules[module] = dict return dict _modules[module] = dict classstack = [] # stack of (class, indent) pairs src = f.read() f.close() # To avoid having to stop the regexp at each newline, instead # when we need a line number we simply string.count the number of # newlines in the string since the last time we did this; i.e., # lineno = lineno + \ # string.count(src, '\n', last_lineno_pos, here) # last_lineno_pos = here countnl = string.count lineno, last_lineno_pos = 1, 0 i = 0 while 1: m = _getnext(src, i) if not m: break start, i = m.span() if m.start("Method") >= 0: # found a method definition or function thisindent = _indent(m.group("MethodIndent")) meth_name = m.group("MethodName") lineno = lineno + \ countnl(src, '\n', last_lineno_pos, start) last_lineno_pos = start # close all classes indented at least as much while classstack and \ classstack[-1][1] >= thisindent: del classstack[-1] if classstack: # it's a class method cur_class = classstack[-1][0] cur_class._addmethod(meth_name, lineno) else: # it's a function f = Function(module, meth_name, file, lineno) dict[meth_name] = f elif m.start("String") >= 0: pass elif m.start("Class") >= 0: # we found a class definition thisindent = _indent(m.group("ClassIndent")) # close all classes indented at least as much while classstack and \ classstack[-1][1] >= thisindent: del classstack[-1] lineno = lineno + \ countnl(src, '\n', last_lineno_pos, start) last_lineno_pos = start class_name = m.group("ClassName") inherit = m.group("ClassSupers") if inherit: # the class inherits from other classes inherit = inherit[1:-1].strip() names = [] for n in inherit.split(','): n = n.strip() if dict.has_key(n): # we know this super class n = dict[n] else: c = n.split('.') if len(c) > 1: # super class # is of the # form module.class: # look in # module for class m = c[-2] c = c[-1] if _modules.has_key(m): d = _modules[m] if d.has_key(c): n = d[c] names.append(n) inherit = names # remember this class cur_class = Class(module, class_name, inherit, file, lineno) dict[class_name] = cur_class classstack.append((cur_class, thisindent)) elif m.start("Import") >= 0: # import module for n in m.group("ImportList").split(','): n = n.strip() try: # recursively read the imported module d = readmodule(n, path, inpackage) except: ##print 'module', n, 'not found' pass elif m.start("ImportFrom") >= 0: # from module import stuff mod = m.group("ImportFromPath") names = m.group("ImportFromList").split(',') try: # recursively read the imported module d = readmodule(mod, path, inpackage) except: ##print 'module', mod, 'not found' continue # add any classes that were defined in the # imported module to our name space if they # were mentioned in the list for n in names: n = n.strip() if d.has_key(n): dict[n] = d[n] elif n == '*': # only add a name if not # already there (to mimic what # Python does internally) # also don't add names that # start with _ for n in d.keys(): if n[0] != '_' and \ not dict.has_key(n): dict[n] = d[n] else: assert 0, "regexp _getnext found something unexpected" return dict | b25c78db0ea0d77e2a8bbcfb2cd7827a285c1d32 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b25c78db0ea0d77e2a8bbcfb2cd7827a285c1d32/pyclbr.py |
import Plist builder.plist = Plist.fromFile(plistname) | import plistlib builder.plist = plistlib.Plist.fromFile(plistname) | def process_common_macho(template, progress, code, rsrcname, destname, is_update, raw=0, others=[], filename=None): # Check that we have a filename if filename is None: raise BuildError, "Need source filename on MacOSX" # First make sure the name ends in ".app" if destname[-4:] != '.app': destname = destname + '.app' # Now deduce the short name destdir, shortname = os.path.split(destname) if shortname[-4:] == '.app': # Strip the .app suffix shortname = shortname[:-4] # And deduce the .plist and .icns names plistname = None icnsname = None if rsrcname and rsrcname[-5:] == '.rsrc': tmp = rsrcname[:-5] plistname = tmp + '.plist' if os.path.exists(plistname): icnsname = tmp + '.icns' if not os.path.exists(icnsname): icnsname = None else: plistname = None if not os.path.exists(rsrcname): rsrcname = None if progress: progress.label('Creating bundle...') import bundlebuilder builder = bundlebuilder.AppBuilder(verbosity=0) builder.mainprogram = filename builder.builddir = destdir builder.name = shortname if rsrcname: builder.resources.append(rsrcname) for o in others: builder.resources.append(o) if plistname: import Plist builder.plist = Plist.fromFile(plistname) if icnsname: builder.iconfile = icnsname builder.setup() builder.build() if progress: progress.label('Done.') progress.inc(0) | 675eba2fe3b2cd91ba5f45394df00a4a0dc716d4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/675eba2fe3b2cd91ba5f45394df00a4a0dc716d4/buildtools.py |
if row: | if row is not None: | def grid_slaves(self, row=None, column=None): args = () if row: args = args + ('-row', row) if column: args = args + ('-column', column) return map(self._nametowidget, self.tk.splitlist(self.tk.call( ('grid', 'slaves', self._w) + args))) | d3b81ace8b8e39939950bc7a3d05f280a88af87f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d3b81ace8b8e39939950bc7a3d05f280a88af87f/Tkinter.py |
if column: | if column is not None: | def grid_slaves(self, row=None, column=None): args = () if row: args = args + ('-row', row) if column: args = args + ('-column', column) return map(self._nametowidget, self.tk.splitlist(self.tk.call( ('grid', 'slaves', self._w) + args))) | d3b81ace8b8e39939950bc7a3d05f280a88af87f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d3b81ace8b8e39939950bc7a3d05f280a88af87f/Tkinter.py |
return self._bind((self._w, 'bind', tagOrId), sequence, func, add) | res = self._bind((self._w, 'bind', tagOrId), sequence, func, add) if sequence and func and res: if self._tagcommands is None: self._tagcommands = {} list = self._tagcommands.get(tagOrId) or [] self._tagcommands[tagOrId] = list list.append(res) return res | def tag_bind(self, tagOrId, sequence=None, func=None, add=None): return self._bind((self._w, 'bind', tagOrId), sequence, func, add) | d3b81ace8b8e39939950bc7a3d05f280a88af87f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d3b81ace8b8e39939950bc7a3d05f280a88af87f/Tkinter.py |
def search(self, charset, criteria): | def search(self, charset, *criteria): | def search(self, charset, criteria): """Search mailbox for matching messages. | 2fbd7617bcdf8eddf623f673ab3b45c3d8327a08 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2fbd7617bcdf8eddf623f673ab3b45c3d8327a08/imaplib.py |
(typ, [data]) = <instance>.search(charset, criteria) | (typ, [data]) = <instance>.search(charset, criterium, ...) | def search(self, charset, criteria): """Search mailbox for matching messages. | 2fbd7617bcdf8eddf623f673ab3b45c3d8327a08 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2fbd7617bcdf8eddf623f673ab3b45c3d8327a08/imaplib.py |
typ, dat = self._simple_command(name, charset, criteria) | typ, dat = apply(self._simple_command, (name, charset) + criteria) | def search(self, charset, criteria): """Search mailbox for matching messages. | 2fbd7617bcdf8eddf623f673ab3b45c3d8327a08 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2fbd7617bcdf8eddf623f673ab3b45c3d8327a08/imaplib.py |
import getpass, sys host = '' if sys.argv[1:]: host = sys.argv[1] | import getopt, getpass, sys try: optlist, args = getopt.getopt(sys.argv[1:], 'd:') except getopt.error, val: pass for opt,val in optlist: if opt == '-d': Debug = int(val) if not args: args = ('',) host = args[0] | def print_log(): _mesg('last %d IMAP4 interactions:' % len(_cmd_log)) for secs,line in _cmd_log: _mesg(line, secs) | 2fbd7617bcdf8eddf623f673ab3b45c3d8327a08 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2fbd7617bcdf8eddf623f673ab3b45c3d8327a08/imaplib.py |
('search', (None, '(TO zork)')), | ('search', (None, 'SUBJECT', 'test')), | def print_log(): _mesg('last %d IMAP4 interactions:' % len(_cmd_log)) for secs,line in _cmd_log: _mesg(line, secs) | 2fbd7617bcdf8eddf623f673ab3b45c3d8327a08 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2fbd7617bcdf8eddf623f673ab3b45c3d8327a08/imaplib.py |
Debug = 5 M = IMAP4(host) _mesg('PROTOCOL_VERSION = %s' % M.PROTOCOL_VERSION) for cmd,args in test_seq1: run(cmd, args) for ml in run('list', ('/tmp/', 'yy%')): mo = re.match(r'.*"([^"]+)"$', ml) if mo: path = mo.group(1) else: path = string.split(ml)[-1] run('delete', (path,)) for cmd,args in test_seq2: dat = run(cmd, args) if (cmd,args) != ('uid', ('SEARCH', 'ALL')): continue uid = string.split(dat[-1]) if not uid: continue run('uid', ('FETCH', '%s' % uid[-1], '(FLAGS INTERNALDATE RFC822.SIZE RFC822.HEADER RFC822.TEXT)')) | try: M = IMAP4(host) _mesg('PROTOCOL_VERSION = %s' % M.PROTOCOL_VERSION) for cmd,args in test_seq1: run(cmd, args) for ml in run('list', ('/tmp/', 'yy%')): mo = re.match(r'.*"([^"]+)"$', ml) if mo: path = mo.group(1) else: path = string.split(ml)[-1] run('delete', (path,)) for cmd,args in test_seq2: dat = run(cmd, args) if (cmd,args) != ('uid', ('SEARCH', 'ALL')): continue uid = string.split(dat[-1]) if not uid: continue run('uid', ('FETCH', '%s' % uid[-1], '(FLAGS INTERNALDATE RFC822.SIZE RFC822.HEADER RFC822.TEXT)')) print '\nAll tests OK.' except: print '\nTests failed.' if not Debug: print ''' If you would like to see debugging output, try: %s -d5 ''' % sys.argv[0] raise | def run(cmd, args): _mesg('%s %s' % (cmd, args)) typ, dat = apply(eval('M.%s' % cmd), args) _mesg('%s => %s %s' % (cmd, typ, dat)) return dat | 2fbd7617bcdf8eddf623f673ab3b45c3d8327a08 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2fbd7617bcdf8eddf623f673ab3b45c3d8327a08/imaplib.py |
mod = imp.new_module(fullname) sys.modules[fullname] = mod | mod = sys.modules.setdefault(fullname,imp.new_module(fullname)) | def load_module(self, fullname): ispkg, code = self.modules[fullname] mod = imp.new_module(fullname) sys.modules[fullname] = mod mod.__file__ = "<%s>" % self.__class__.__name__ mod.__loader__ = self if ispkg: mod.__path__ = self._get__path__() exec code in mod.__dict__ return mod | 080f60c4b086ffa6826afaabfc730dab04834791 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/080f60c4b086ffa6826afaabfc730dab04834791/test_importhooks.py |
def generate_help (header=None): | def generate_help (self, header=None): | def generate_help (header=None): """Generate help text (a list of strings, one per suggested line of output) from the option table for this FancyGetopt object.""" | d183c094086d3a6602c3b41c939969541baa11df /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d183c094086d3a6602c3b41c939969541baa11df/fancy_getopt.py |
def print_help (self, file=None, header=None): | def print_help (self, header=None, file=None): | def print_help (self, file=None, header=None): if file is None: file = sys.stdout for line in self.generate_help (header): file.write (line + "\n") | d183c094086d3a6602c3b41c939969541baa11df /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d183c094086d3a6602c3b41c939969541baa11df/fancy_getopt.py |
testtype('u', u'\u263a') | if have_unicode: testtype('u', unicode(r'\u263a', 'unicode-escape')) | def main(): testtype('c', 'c') testtype('u', u'\u263a') for type in (['b', 'h', 'i', 'l', 'f', 'd']): testtype(type, 1) testunicode() testsubclassing() unlink(TESTFN) | db6b399f23452fdc46f5281f0de1fff07600367f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/db6b399f23452fdc46f5281f0de1fff07600367f/test_array.py |
testunicode() | if have_unicode: testunicode() | def main(): testtype('c', 'c') testtype('u', u'\u263a') for type in (['b', 'h', 'i', 'l', 'f', 'd']): testtype(type, 1) testunicode() testsubclassing() unlink(TESTFN) | db6b399f23452fdc46f5281f0de1fff07600367f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/db6b399f23452fdc46f5281f0de1fff07600367f/test_array.py |
array.array('b', u'foo') | array.array('b', unicode('foo', 'ascii')) | def testunicode(): try: array.array('b', u'foo') except TypeError: pass else: raise TestFailed("creating a non-unicode array from " "a Unicode string should fail") x = array.array('u', u'\xa0\xc2\u1234') x.fromunicode(u' ') x.fromunicode(u'') x.fromunicode(u'') x.fromunicode(u'\x11abc\xff\u1234') s = x.tounicode() if s != u'\xa0\xc2\u1234 \x11abc\xff\u1234': raise TestFailed("fromunicode()/tounicode()") s = u'\x00="\'a\\b\x80\xff\u0000\u0001\u1234' a = array.array('u', s) if verbose: print "repr of type 'u' array:", repr(a) print " expected: array('u', %r)" % s | db6b399f23452fdc46f5281f0de1fff07600367f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/db6b399f23452fdc46f5281f0de1fff07600367f/test_array.py |
x = array.array('u', u'\xa0\xc2\u1234') x.fromunicode(u' ') x.fromunicode(u'') x.fromunicode(u'') x.fromunicode(u'\x11abc\xff\u1234') | x = array.array('u', unicode(r'\xa0\xc2\u1234', 'unicode-escape')) x.fromunicode(unicode(' ', 'ascii')) x.fromunicode(unicode('', 'ascii')) x.fromunicode(unicode('', 'ascii')) x.fromunicode(unicode(r'\x11abc\xff\u1234', 'unicode-escape')) | def testunicode(): try: array.array('b', u'foo') except TypeError: pass else: raise TestFailed("creating a non-unicode array from " "a Unicode string should fail") x = array.array('u', u'\xa0\xc2\u1234') x.fromunicode(u' ') x.fromunicode(u'') x.fromunicode(u'') x.fromunicode(u'\x11abc\xff\u1234') s = x.tounicode() if s != u'\xa0\xc2\u1234 \x11abc\xff\u1234': raise TestFailed("fromunicode()/tounicode()") s = u'\x00="\'a\\b\x80\xff\u0000\u0001\u1234' a = array.array('u', s) if verbose: print "repr of type 'u' array:", repr(a) print " expected: array('u', %r)" % s | db6b399f23452fdc46f5281f0de1fff07600367f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/db6b399f23452fdc46f5281f0de1fff07600367f/test_array.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.