rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
return _apply(s.count, args)
return s.count(*args)
def count(s, *args): """count(s, sub[, start[,end]]) -> int Return the number of occurrences of substring sub in string s[start:end]. Optional arguments start and end are interpreted as in slice notation. """ return _apply(s.count, args)
046d27215fd0037f40cc90b85a66f76ff424347e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/046d27215fd0037f40cc90b85a66f76ff424347e/string.py
return _apply(s.find, args)
return s.find(*args)
def find(s, *args): """find(s, sub [,start [,end]]) -> in Return the lowest index in s where substring sub is found, such that sub is contained within s[start,end]. Optional arguments start and end are interpreted as in slice notation. Return -1 on failure. """ return _apply(s.find, args)
046d27215fd0037f40cc90b85a66f76ff424347e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/046d27215fd0037f40cc90b85a66f76ff424347e/string.py
return _apply(s.rfind, args)
return s.rfind(*args)
def rfind(s, *args): """rfind(s, sub [,start [,end]]) -> int Return the highest index in s where substring sub is found, such that sub is contained within s[start,end]. Optional arguments start and end are interpreted as in slice notation. Return -1 on failure. """ return _apply(s.rfind, args)
046d27215fd0037f40cc90b85a66f76ff424347e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/046d27215fd0037f40cc90b85a66f76ff424347e/string.py
n = width - len(s) if n <= 0: return s return s + ' '*n
return s.ljust(width)
def ljust(s, width): """ljust(s, width) -> string Return a left-justified version of s, in a field of the specified width, padded with spaces as needed. The string is never truncated. """ n = width - len(s) if n <= 0: return s return s + ' '*n
046d27215fd0037f40cc90b85a66f76ff424347e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/046d27215fd0037f40cc90b85a66f76ff424347e/string.py
n = width - len(s) if n <= 0: return s return ' '*n + s
return s.rjust(width)
def rjust(s, width): """rjust(s, width) -> string Return a right-justified version of s, in a field of the specified width, padded with spaces as needed. The string is never truncated. """ n = width - len(s) if n <= 0: return s return ' '*n + s
046d27215fd0037f40cc90b85a66f76ff424347e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/046d27215fd0037f40cc90b85a66f76ff424347e/string.py
n = width - len(s) if n <= 0: return s half = n/2 if n%2 and width%2: half = half+1 return ' '*half + s + ' '*(n-half)
return s.center(width)
def center(s, width): """center(s, width) -> string Return a center version of s, in a field of the specified width. padded with spaces as needed. The string is never truncated. """ n = width - len(s) if n <= 0: return s half = n/2 if n%2 and width%2: # This ensures that center(center(s, i), j) = center(s, j) half = half+1 return ' '*half + s + ' '*(n-half)
046d27215fd0037f40cc90b85a66f76ff424347e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/046d27215fd0037f40cc90b85a66f76ff424347e/string.py
res = line = '' for c in s: if c == '\t': c = ' '*(tabsize - len(line) % tabsize) line = line + c if c == '\n': res = res + line line = '' return res + line
return s.expandtabs(tabsize)
def expandtabs(s, tabsize=8): """expandtabs(s [,tabsize]) -> string Return a copy of the string s with all tab characters replaced by the appropriate number of spaces, depending on the current column, and the tabsize (default 8). """ res = line = '' for c in s: if c == '\t': c = ' '*(tabsize - len(line) % tabsize) line = line + c if c == '\n': res = res + line line = '' return res + line
046d27215fd0037f40cc90b85a66f76ff424347e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/046d27215fd0037f40cc90b85a66f76ff424347e/string.py
try: ''.upper except AttributeError: from stringold import *
def replace(s, old, new, maxsplit=-1): """replace (str, old, new[, maxsplit]) -> string Return a copy of string str with all occurrences of substring old replaced by new. If the optional argument maxsplit is given, only the first maxsplit occurrences are replaced. """ return s.replace(old, new, maxsplit)
046d27215fd0037f40cc90b85a66f76ff424347e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/046d27215fd0037f40cc90b85a66f76ff424347e/string.py
def printsum(filename, out = sys.stdout):
def printsum(filename, out=sys.stdout):
def printsum(filename, out = sys.stdout): try: fp = open(filename, rmode) except IOError, msg: sys.stderr.write('%s: Can\'t open: %s\n' % (filename, msg)) return 1 if fnfilter: filename = fnfilter(filename) sts = printsumfp(fp, filename, out) fp.close() return sts
1a3abcb648565b1c521c41d49ecd7c93a45c6d97 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1a3abcb648565b1c521c41d49ecd7c93a45c6d97/md5sum.py
def printsumfp(fp, filename, out = sys.stdout):
def printsumfp(fp, filename, out=sys.stdout):
def printsumfp(fp, filename, out = sys.stdout): m = md5.new() try: while 1: data = fp.read(bufsize) if not data: break m.update(data) except IOError, msg: sys.stderr.write('%s: I/O error: %s\n' % (filename, msg)) return 1 out.write('%s %s\n' % (m.hexdigest(), filename)) return 0
1a3abcb648565b1c521c41d49ecd7c93a45c6d97 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1a3abcb648565b1c521c41d49ecd7c93a45c6d97/md5sum.py
if not data: break
if not data: break
def printsumfp(fp, filename, out = sys.stdout): m = md5.new() try: while 1: data = fp.read(bufsize) if not data: break m.update(data) except IOError, msg: sys.stderr.write('%s: I/O error: %s\n' % (filename, msg)) return 1 out.write('%s %s\n' % (m.hexdigest(), filename)) return 0
1a3abcb648565b1c521c41d49ecd7c93a45c6d97 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1a3abcb648565b1c521c41d49ecd7c93a45c6d97/md5sum.py
def main(args = sys.argv[1:], out = sys.stdout):
def main(args = sys.argv[1:], out=sys.stdout):
def main(args = sys.argv[1:], out = sys.stdout): global fnfilter, rmode, bufsize try: opts, args = getopt.getopt(args, 'blts:') except getopt.error, msg: sys.stderr.write('%s: %s\n%s' % (sys.argv[0], msg, usage)) return 2 for o, a in opts: if o == '-l': fnfilter = os.path.basename if o == '-b': rmode = 'rb' if o == '-t': rmode = 'r' if o == '-s': bufsize = int(a) if not args: args = ['-'] return sum(args, out)
1a3abcb648565b1c521c41d49ecd7c93a45c6d97 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1a3abcb648565b1c521c41d49ecd7c93a45c6d97/md5sum.py
if o == '-b':
elif o == '-b':
def main(args = sys.argv[1:], out = sys.stdout): global fnfilter, rmode, bufsize try: opts, args = getopt.getopt(args, 'blts:') except getopt.error, msg: sys.stderr.write('%s: %s\n%s' % (sys.argv[0], msg, usage)) return 2 for o, a in opts: if o == '-l': fnfilter = os.path.basename if o == '-b': rmode = 'rb' if o == '-t': rmode = 'r' if o == '-s': bufsize = int(a) if not args: args = ['-'] return sum(args, out)
1a3abcb648565b1c521c41d49ecd7c93a45c6d97 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1a3abcb648565b1c521c41d49ecd7c93a45c6d97/md5sum.py
if o == '-t':
elif o == '-t':
def main(args = sys.argv[1:], out = sys.stdout): global fnfilter, rmode, bufsize try: opts, args = getopt.getopt(args, 'blts:') except getopt.error, msg: sys.stderr.write('%s: %s\n%s' % (sys.argv[0], msg, usage)) return 2 for o, a in opts: if o == '-l': fnfilter = os.path.basename if o == '-b': rmode = 'rb' if o == '-t': rmode = 'r' if o == '-s': bufsize = int(a) if not args: args = ['-'] return sum(args, out)
1a3abcb648565b1c521c41d49ecd7c93a45c6d97 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1a3abcb648565b1c521c41d49ecd7c93a45c6d97/md5sum.py
if o == '-s':
elif o == '-s':
def main(args = sys.argv[1:], out = sys.stdout): global fnfilter, rmode, bufsize try: opts, args = getopt.getopt(args, 'blts:') except getopt.error, msg: sys.stderr.write('%s: %s\n%s' % (sys.argv[0], msg, usage)) return 2 for o, a in opts: if o == '-l': fnfilter = os.path.basename if o == '-b': rmode = 'rb' if o == '-t': rmode = 'r' if o == '-s': bufsize = int(a) if not args: args = ['-'] return sum(args, out)
1a3abcb648565b1c521c41d49ecd7c93a45c6d97 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1a3abcb648565b1c521c41d49ecd7c93a45c6d97/md5sum.py
if code in self.BUGGY_RANGE_CHECK:
if not PY_STRUCT_RANGE_CHECKING and code in self.BUGGY_RANGE_CHECK:
def test_one(self, x, pack=struct.pack, unpack=struct.unpack, unhexlify=binascii.unhexlify): if verbose: print "trying std", self.formatpair, "on", x, "==", hex(x)
aa70a17e13bb8cb6da043d63a3a9b957ee97779e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/aa70a17e13bb8cb6da043d63a3a9b957ee97779e/test_struct.py
pathlist = os.environ['PATH'].split(':')
pathlist = os.environ['PATH'].split(os.pathsep)
def msg(str): sys.stderr.write(str + '\n')
7f7e1371ebf897942a18939e2262277e16c83637 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7f7e1371ebf897942a18939e2262277e16c83637/which.py
def f(): for i in range(1000): yield i
686b14d7ad700cfb3d3f0538695f0aa8e6c1b0b8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/686b14d7ad700cfb3d3f0538695f0aa8e6c1b0b8/test_types.py
vereq(iter(T()).next(), '0!!!')
vereq(iter(T((1,2))).next(), 1)
def __getitem__(self, key): return str(key) + '!!!'
686b14d7ad700cfb3d3f0538695f0aa8e6c1b0b8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/686b14d7ad700cfb3d3f0538695f0aa8e6c1b0b8/test_types.py
def selfmodifyingComparison(x,y): z.append(1) return cmp(x, y)
686b14d7ad700cfb3d3f0538695f0aa8e6c1b0b8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/686b14d7ad700cfb3d3f0538695f0aa8e6c1b0b8/test_types.py
vereq(iter(L()).next(), '0!!!')
vereq(iter(L([1,2])).next(), 1)
def __getitem__(self, key): return str(key) + '!!!'
686b14d7ad700cfb3d3f0538695f0aa8e6c1b0b8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/686b14d7ad700cfb3d3f0538695f0aa8e6c1b0b8/test_types.py
map(lambda t: apply(priDB.put, t), ProductIndex)
map(lambda t, priDB=priDB: apply(priDB.put, t), ProductIndex)
def test01_join(self): if verbose: print '\n', '-=' * 30 print "Running %s.test01_join..." % \ self.__class__.__name__
ad30fa03a4d8dc163141a5e73be52760f15864c0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ad30fa03a4d8dc163141a5e73be52760f15864c0/test_join.py
map(lambda t: apply(secDB.put, t), ColorIndex)
map(lambda t, secDB=secDB: apply(secDB.put, t), ColorIndex)
def test01_join(self): if verbose: print '\n', '-=' * 30 print "Running %s.test01_join..." % \ self.__class__.__name__
ad30fa03a4d8dc163141a5e73be52760f15864c0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ad30fa03a4d8dc163141a5e73be52760f15864c0/test_join.py
if not mimetypes.inited: mimetypes.init()
def guess_type(self, path): """Guess the type of a file.
83cc0d0addd23dbd2b32f4de9835538496ad71cd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/83cc0d0addd23dbd2b32f4de9835538496ad71cd/SimpleHTTPServer.py
return self.list == []
return not self.list
def is_empty (self): return self.list == []
b562bc672bff106f1cbf2aad7770b654bfe374ec /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b562bc672bff106f1cbf2aad7770b654bfe374ec/asynchat.py
try: thunk() except TestFailed: if verbose: print "failed (expected %s but got %s)" % (result, test_result) raise TestFailed, name else: if verbose: print "ok"
thunk() if verbose: print "ok"
def run_test(name, thunk): if verbose: print "testing %s..." % name, try: thunk() except TestFailed: if verbose: print "failed (expected %s but got %s)" % (result, test_result) raise TestFailed, name else: if verbose: print "ok"
c907bd89de2af748dfe40d829477469de47c8ee1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c907bd89de2af748dfe40d829477469de47c8ee1/test_gc.py
if gc.collect() != 1: raise TestFailed
expect(gc.collect(), 1, "list")
def test_list(): l = [] l.append(l) gc.collect() del l if gc.collect() != 1: raise TestFailed
c907bd89de2af748dfe40d829477469de47c8ee1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c907bd89de2af748dfe40d829477469de47c8ee1/test_gc.py
if gc.collect() != 1: raise TestFailed
expect(gc.collect(), 1, "dict")
def test_dict(): d = {} d[1] = d gc.collect() del d if gc.collect() != 1: raise TestFailed
c907bd89de2af748dfe40d829477469de47c8ee1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c907bd89de2af748dfe40d829477469de47c8ee1/test_gc.py
if gc.collect() != 2: raise TestFailed
expect(gc.collect(), 2, "tuple")
def test_tuple(): # since tuples are immutable we close the loop with a list l = [] t = (l,) l.append(t) gc.collect() del t del l if gc.collect() != 2: raise TestFailed
c907bd89de2af748dfe40d829477469de47c8ee1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c907bd89de2af748dfe40d829477469de47c8ee1/test_gc.py
if gc.collect() == 0: raise TestFailed
expect_not(gc.collect(), 0, "class")
def test_class(): class A: pass A.a = A gc.collect() del A if gc.collect() == 0: raise TestFailed
c907bd89de2af748dfe40d829477469de47c8ee1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c907bd89de2af748dfe40d829477469de47c8ee1/test_gc.py
if gc.collect() == 0: raise TestFailed
expect_not(gc.collect(), 0, "instance")
def test_instance(): class A: pass a = A() a.a = a gc.collect() del a if gc.collect() == 0: raise TestFailed
c907bd89de2af748dfe40d829477469de47c8ee1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c907bd89de2af748dfe40d829477469de47c8ee1/test_gc.py
if gc.collect() == 0: raise TestFailed
expect_not(gc.collect(), 0, "method")
def __init__(self): self.init = self.__init__
c907bd89de2af748dfe40d829477469de47c8ee1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c907bd89de2af748dfe40d829477469de47c8ee1/test_gc.py
if gc.collect() == 0: raise TestFailed
expect_not(gc.collect(), 0, "finalizer")
def __del__(self): pass
c907bd89de2af748dfe40d829477469de47c8ee1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c907bd89de2af748dfe40d829477469de47c8ee1/test_gc.py
raise TestFailed
raise TestFailed, "didn't find obj in garbage (finalizer)"
def __del__(self): pass
c907bd89de2af748dfe40d829477469de47c8ee1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c907bd89de2af748dfe40d829477469de47c8ee1/test_gc.py
if gc.collect() != 2: raise TestFailed
expect(gc.collect(), 2, "function")
exec("def f(): pass\n") in d
c907bd89de2af748dfe40d829477469de47c8ee1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c907bd89de2af748dfe40d829477469de47c8ee1/test_gc.py
if gc.collect() != 1: raise TestFailed
expect(gc.collect(), 1, "frame")
def f(): frame = sys._getframe()
c907bd89de2af748dfe40d829477469de47c8ee1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c907bd89de2af748dfe40d829477469de47c8ee1/test_gc.py
raise TestFailed
raise TestFailed, "didn't find obj in garbage (saveall)"
def test_saveall(): # Verify that cyclic garbage like lists show up in gc.garbage if the # SAVEALL option is enabled. debug = gc.get_debug() gc.set_debug(debug | gc.DEBUG_SAVEALL) l = [] l.append(l) id_l = id(l) del l gc.collect() try: for obj in gc.garbage: if id(obj) == id_l: del obj[:] break else: raise TestFailed gc.garbage.remove(obj) finally: gc.set_debug(debug)
c907bd89de2af748dfe40d829477469de47c8ee1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c907bd89de2af748dfe40d829477469de47c8ee1/test_gc.py
print "db.h: found", db_ver, "in", d
if db_setup_debug: print "db.h: found", db_ver, "in", d
def detect_modules(self): # Ensure that /usr/local is always used add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
738446f44d6d37d920d00fa99bbb1a7084bd537b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/738446f44d6d37d920d00fa99bbb1a7084bd537b/setup.py
print "db lib: using", db_ver, dblib if db_setup_debug: print "db: lib dir", dblib_dir, "inc dir", db_incdir
if db_setup_debug: print "db lib: using", db_ver, dblib print "db: lib dir", dblib_dir, "inc dir", db_incdir
def detect_modules(self): # Ensure that /usr/local is always used add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
738446f44d6d37d920d00fa99bbb1a7084bd537b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/738446f44d6d37d920d00fa99bbb1a7084bd537b/setup.py
sqlite_setup_debug = True
sqlite_setup_debug = False
def detect_modules(self): # Ensure that /usr/local is always used add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
738446f44d6d37d920d00fa99bbb1a7084bd537b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/738446f44d6d37d920d00fa99bbb1a7084bd537b/setup.py
print "%s/sqlite3.h: version %s"%(d, sqlite_version)
if sqlite_setup_debug: print "%s/sqlite3.h: version %s"%(d, sqlite_version)
def detect_modules(self): # Ensure that /usr/local is always used add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
738446f44d6d37d920d00fa99bbb1a7084bd537b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/738446f44d6d37d920d00fa99bbb1a7084bd537b/setup.py
def _parsegen(self): # Create a new message and start by parsing headers. self._new_message() headers = [] # Collect the headers, searching for a line that doesn't match the RFC # 2822 header or continuation pattern (including an empty line). for line in self._input: if line is NeedMoreData: yield NeedMoreData continue if not headerRE.match(line): # If we saw the RFC defined header/body separator # (i.e. newline), just throw it away. Otherwise the line is # part of the body so push it back. if not NLCRE.match(line): self._input.unreadline(line) break headers.append(line) # Done with the headers, so parse them and figure out what we're # supposed to see in the body of the message. self._parse_headers(headers) # Headers-only parsing is a backwards compatibility hack, which was # necessary in the older parser, which could throw errors. All # remaining lines in the input are thrown into the message body. if self._headersonly: lines = [] while True: line = self._input.readline() if line is NeedMoreData: yield NeedMoreData continue if line == '': break lines.append(line) self._cur.set_payload(EMPTYSTRING.join(lines)) return if self._cur.get_content_type() == 'message/delivery-status': # message/delivery-status contains blocks of headers separated by # a blank line. We'll represent each header block as a separate # nested message object, but the processing is a bit different # than standard message/* types because there is no body for the # nested messages. A blank line separates the subparts. while True: self._input.push_eof_matcher(NLCRE.match) for retval in self._parsegen(): if retval is NeedMoreData: yield NeedMoreData continue break msg = self._pop_message() # We need to pop the EOF matcher in order to tell if we're at # the end of the current file, not the end of the last block # of message headers. self._input.pop_eof_matcher() # The input stream must be sitting at the newline or at the # EOF. We want to see if we're at the end of this subpart, so # first consume the blank line, then test the next line to see # if we're at this subpart's EOF. line = self._input.readline() line = self._input.readline() if line == '': break # Not at EOF so this is a line we're going to need. self._input.unreadline(line) return if self._cur.get_content_maintype() == 'message': # The message claims to be a message/* type, then what follows is # another RFC 2822 message. for retval in self._parsegen(): if retval is NeedMoreData: yield NeedMoreData continue break self._pop_message() return if self._cur.get_content_maintype() == 'multipart': boundary = self._cur.get_boundary() if boundary is None: # The message /claims/ to be a multipart but it has not # defined a boundary. That's a problem which we'll handle by # reading everything until the EOF and marking the message as # defective. self._cur.defects.append(Errors.NoBoundaryInMultipartDefect()) lines = [] for line in self._input: if line is NeedMoreData: yield NeedMoreData continue lines.append(line) self._cur.set_payload(EMPTYSTRING.join(lines)) return # Create a line match predicate which matches the inter-part # boundary as well as the end-of-multipart boundary. Don't push # this onto the input stream until we've scanned past the # preamble. separator = '--' + boundary boundaryre = re.compile( '(?P<sep>' + re.escape(separator) + r')(?P<end>--)?(?P<ws>[ \t]*)(?P<linesep>\r\n|\r|\n)$') capturing_preamble = True preamble = [] linesep = False while True: line = self._input.readline() if line is NeedMoreData: yield NeedMoreData continue if line == '': break mo = boundaryre.match(line) if mo: # If we're looking at the end boundary, we're done with # this multipart. If there was a newline at the end of # the closing boundary, then we need to initialize the # epilogue with the empty string (see below). if mo.group('end'): linesep = mo.group('linesep') break # We saw an inter-part boundary. Were we in the preamble? if capturing_preamble: if preamble: # According to RFC 2046, the last newline belongs # to the boundary. lastline = preamble[-1] eolmo = NLCRE_eol.search(lastline) if eolmo: preamble[-1] = lastline[:-len(eolmo.group(0))] self._cur.preamble = EMPTYSTRING.join(preamble) #import pdb ; pdb.set_trace() # See SF bug #1030941 capturing_preamble = False self._input.unreadline(line) continue # We saw a boundary separating two parts. Consume any # multiple boundary lines that may be following. Our # interpretation of RFC 2046 BNF grammar does not produce # body parts within such double boundaries. while True: line = self._input.readline() if line is NeedMoreData: yield NeedMoreData continue mo = boundaryre.match(line) if not mo: self._input.unreadline(line) break # Recurse to parse this subpart; the input stream points # at the subpart's first line. self._input.push_eof_matcher(boundaryre.match) for retval in self._parsegen(): if retval is NeedMoreData: yield NeedMoreData continue break # Because of RFC 2046, the newline preceding the boundary # separator actually belongs to the boundary, not the # previous subpart's payload (or epilogue if the previous # part is a multipart). if self._last.get_content_maintype() == 'multipart': epilogue = self._last.epilogue if epilogue == '': self._last.epilogue = None elif epilogue is not None: mo = NLCRE_eol.search(epilogue) if mo: end = len(mo.group(0)) self._last.epilogue = epilogue[:-end] else: payload = self._last.get_payload() if isinstance(payload, basestring): mo = NLCRE_eol.search(payload) if mo: payload = payload[:-len(mo.group(0))] self._last.set_payload(payload) self._input.pop_eof_matcher() self._pop_message() # Set the multipart up for newline cleansing, which will # happen if we're in a nested multipart. self._last = self._cur else: # I think we must be in the preamble assert capturing_preamble preamble.append(line) # We've seen either the EOF or the end boundary. If we're still # capturing the preamble, we never saw the start boundary. Note # that as a defect and store the captured text as the payload. # Otherwise everything from here to the EOF is epilogue. if capturing_preamble: self._cur.defects.append(Errors.StartBoundaryNotFoundDefect()) self._cur.set_payload(EMPTYSTRING.join(preamble)) return # If the end boundary ended in a newline, we'll need to make sure # the epilogue isn't None if linesep: epilogue = [''] else: epilogue = [] for line in self._input: if line is NeedMoreData: yield NeedMoreData continue epilogue.append(line) # Any CRLF at the front of the epilogue is not technically part of # the epilogue. Also, watch out for an empty string epilogue, # which means a single newline. if epilogue: firstline = epilogue[0] bolmo = NLCRE_bol.match(firstline) if bolmo: epilogue[0] = firstline[len(bolmo.group(0)):] self._cur.epilogue = EMPTYSTRING.join(epilogue) return # Otherwise, it's some non-multipart type, so the entire rest of the # file contents becomes the payload. lines = [] for line in self._input: if line is NeedMoreData: yield NeedMoreData continue lines.append(line) self._cur.set_payload(EMPTYSTRING.join(lines))
dee0cf12e3430e146738fd0d7a16a35071e3b913 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/dee0cf12e3430e146738fd0d7a16a35071e3b913/FeedParser.py
def _parsegen(self): # Create a new message and start by parsing headers. self._new_message() headers = [] # Collect the headers, searching for a line that doesn't match the RFC # 2822 header or continuation pattern (including an empty line). for line in self._input: if line is NeedMoreData: yield NeedMoreData continue if not headerRE.match(line): # If we saw the RFC defined header/body separator # (i.e. newline), just throw it away. Otherwise the line is # part of the body so push it back. if not NLCRE.match(line): self._input.unreadline(line) break headers.append(line) # Done with the headers, so parse them and figure out what we're # supposed to see in the body of the message. self._parse_headers(headers) # Headers-only parsing is a backwards compatibility hack, which was # necessary in the older parser, which could throw errors. All # remaining lines in the input are thrown into the message body. if self._headersonly: lines = [] while True: line = self._input.readline() if line is NeedMoreData: yield NeedMoreData continue if line == '': break lines.append(line) self._cur.set_payload(EMPTYSTRING.join(lines)) return if self._cur.get_content_type() == 'message/delivery-status': # message/delivery-status contains blocks of headers separated by # a blank line. We'll represent each header block as a separate # nested message object, but the processing is a bit different # than standard message/* types because there is no body for the # nested messages. A blank line separates the subparts. while True: self._input.push_eof_matcher(NLCRE.match) for retval in self._parsegen(): if retval is NeedMoreData: yield NeedMoreData continue break msg = self._pop_message() # We need to pop the EOF matcher in order to tell if we're at # the end of the current file, not the end of the last block # of message headers. self._input.pop_eof_matcher() # The input stream must be sitting at the newline or at the # EOF. We want to see if we're at the end of this subpart, so # first consume the blank line, then test the next line to see # if we're at this subpart's EOF. line = self._input.readline() line = self._input.readline() if line == '': break # Not at EOF so this is a line we're going to need. self._input.unreadline(line) return if self._cur.get_content_maintype() == 'message': # The message claims to be a message/* type, then what follows is # another RFC 2822 message. for retval in self._parsegen(): if retval is NeedMoreData: yield NeedMoreData continue break self._pop_message() return if self._cur.get_content_maintype() == 'multipart': boundary = self._cur.get_boundary() if boundary is None: # The message /claims/ to be a multipart but it has not # defined a boundary. That's a problem which we'll handle by # reading everything until the EOF and marking the message as # defective. self._cur.defects.append(Errors.NoBoundaryInMultipartDefect()) lines = [] for line in self._input: if line is NeedMoreData: yield NeedMoreData continue lines.append(line) self._cur.set_payload(EMPTYSTRING.join(lines)) return # Create a line match predicate which matches the inter-part # boundary as well as the end-of-multipart boundary. Don't push # this onto the input stream until we've scanned past the # preamble. separator = '--' + boundary boundaryre = re.compile( '(?P<sep>' + re.escape(separator) + r')(?P<end>--)?(?P<ws>[ \t]*)(?P<linesep>\r\n|\r|\n)$') capturing_preamble = True preamble = [] linesep = False while True: line = self._input.readline() if line is NeedMoreData: yield NeedMoreData continue if line == '': break mo = boundaryre.match(line) if mo: # If we're looking at the end boundary, we're done with # this multipart. If there was a newline at the end of # the closing boundary, then we need to initialize the # epilogue with the empty string (see below). if mo.group('end'): linesep = mo.group('linesep') break # We saw an inter-part boundary. Were we in the preamble? if capturing_preamble: if preamble: # According to RFC 2046, the last newline belongs # to the boundary. lastline = preamble[-1] eolmo = NLCRE_eol.search(lastline) if eolmo: preamble[-1] = lastline[:-len(eolmo.group(0))] self._cur.preamble = EMPTYSTRING.join(preamble) #import pdb ; pdb.set_trace() # See SF bug #1030941 capturing_preamble = False self._input.unreadline(line) continue # We saw a boundary separating two parts. Consume any # multiple boundary lines that may be following. Our # interpretation of RFC 2046 BNF grammar does not produce # body parts within such double boundaries. while True: line = self._input.readline() if line is NeedMoreData: yield NeedMoreData continue mo = boundaryre.match(line) if not mo: self._input.unreadline(line) break # Recurse to parse this subpart; the input stream points # at the subpart's first line. self._input.push_eof_matcher(boundaryre.match) for retval in self._parsegen(): if retval is NeedMoreData: yield NeedMoreData continue break # Because of RFC 2046, the newline preceding the boundary # separator actually belongs to the boundary, not the # previous subpart's payload (or epilogue if the previous # part is a multipart). if self._last.get_content_maintype() == 'multipart': epilogue = self._last.epilogue if epilogue == '': self._last.epilogue = None elif epilogue is not None: mo = NLCRE_eol.search(epilogue) if mo: end = len(mo.group(0)) self._last.epilogue = epilogue[:-end] else: payload = self._last.get_payload() if isinstance(payload, basestring): mo = NLCRE_eol.search(payload) if mo: payload = payload[:-len(mo.group(0))] self._last.set_payload(payload) self._input.pop_eof_matcher() self._pop_message() # Set the multipart up for newline cleansing, which will # happen if we're in a nested multipart. self._last = self._cur else: # I think we must be in the preamble assert capturing_preamble preamble.append(line) # We've seen either the EOF or the end boundary. If we're still # capturing the preamble, we never saw the start boundary. Note # that as a defect and store the captured text as the payload. # Otherwise everything from here to the EOF is epilogue. if capturing_preamble: self._cur.defects.append(Errors.StartBoundaryNotFoundDefect()) self._cur.set_payload(EMPTYSTRING.join(preamble)) return # If the end boundary ended in a newline, we'll need to make sure # the epilogue isn't None if linesep: epilogue = [''] else: epilogue = [] for line in self._input: if line is NeedMoreData: yield NeedMoreData continue epilogue.append(line) # Any CRLF at the front of the epilogue is not technically part of # the epilogue. Also, watch out for an empty string epilogue, # which means a single newline. if epilogue: firstline = epilogue[0] bolmo = NLCRE_bol.match(firstline) if bolmo: epilogue[0] = firstline[len(bolmo.group(0)):] self._cur.epilogue = EMPTYSTRING.join(epilogue) return # Otherwise, it's some non-multipart type, so the entire rest of the # file contents becomes the payload. lines = [] for line in self._input: if line is NeedMoreData: yield NeedMoreData continue lines.append(line) self._cur.set_payload(EMPTYSTRING.join(lines))
dee0cf12e3430e146738fd0d7a16a35071e3b913 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/dee0cf12e3430e146738fd0d7a16a35071e3b913/FeedParser.py
if (arg[0],arg[-1]) in (('(',')'),('"','"')):
if len(arg) >= 2 and (arg[0],arg[-1]) in (('(',')'),('"','"')):
def _checkquote(self, arg):
c09acfda778bba61267708458d12268aa5fecc62 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c09acfda778bba61267708458d12268aa5fecc62/imaplib.py
if self.mustquote.search(arg) is None:
if arg and self.mustquote.search(arg) is None:
def _checkquote(self, arg):
c09acfda778bba61267708458d12268aa5fecc62 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c09acfda778bba61267708458d12268aa5fecc62/imaplib.py
tixlib = os.environ.get('TIX_LIBRARY') if tixlib is not None: self.tk.eval('global auto_path; lappend auto_path {%s}' % tixlib) self.tk.eval('global tcl_pkgPath; lappend tcl_pkgPath {%s}' % tixlib)
tixlib = os.environ.get('TIX_LIBRARY') if tixlib is not None: self.tk.eval('global auto_path; lappend auto_path {%s}' % tixlib) self.tk.eval('global tcl_pkgPath; lappend tcl_pkgPath {%s}' % tixlib)
def __init__(self, screenName=None, baseName=None, className='Tk'): Tkinter.Tk.__init__(self, screenName, baseName, className)
22710823fb554a796dc96c44885d7a9389426824 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/22710823fb554a796dc96c44885d7a9389426824/Tix.py
self.tk.eval('package require Tix')
self.tk.eval('package require Tix')
def __init__(self, screenName=None, baseName=None, className='Tk'): Tkinter.Tk.__init__(self, screenName, baseName, className)
22710823fb554a796dc96c44885d7a9389426824 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/22710823fb554a796dc96c44885d7a9389426824/Tix.py
1) It is possible to give a list of options which must be part of the creation command (so called Tix 'static' options). These cannot be given as a 'config' command later. 2) It is possible to give the name of an existing TK widget. These are child widgets created automatically by a Tix mega-widget. The Tk call to create these widgets is therefore bypassed in TixWidget.__init__
1) It is possible to give a list of options which must be part of the creation command (so called Tix 'static' options). These cannot be given as a 'config' command later. 2) It is possible to give the name of an existing TK widget. These are child widgets created automatically by a Tix mega-widget. The Tk call to create these widgets is therefore bypassed in TixWidget.__init__
def slaves(self): return map(self._nametowidget, self.tk.splitlist( self.tk.call( 'tixForm', 'slaves', self._w)))
22710823fb554a796dc96c44885d7a9389426824 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/22710823fb554a796dc96c44885d7a9389426824/Tix.py
static_options=None, cnf={}, kw={}): if kw: cnf = _cnfmerge((cnf, kw)) else: cnf = _cnfmerge(cnf) extra=() if static_options: for k,v in cnf.items()[:]: if k in static_options: extra = extra + ('-' + k, v) del cnf[k] self.widgetName = widgetName Widget._setup(self, master, cnf) if widgetName: apply(self.tk.call, (widgetName, self._w) + extra) if cnf: Widget.config(self, cnf) self.subwidget_list = {}
static_options=None, cnf={}, kw={}): if kw: cnf = _cnfmerge((cnf, kw)) else: cnf = _cnfmerge(cnf) extra=() if static_options: for k,v in cnf.items()[:]: if k in static_options: extra = extra + ('-' + k, v) del cnf[k] self.widgetName = widgetName Widget._setup(self, master, cnf) if widgetName: apply(self.tk.call, (widgetName, self._w) + extra) if cnf: Widget.config(self, cnf) self.subwidget_list = {}
def __init__ (self, master=None, widgetName=None,
22710823fb554a796dc96c44885d7a9389426824 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/22710823fb554a796dc96c44885d7a9389426824/Tix.py
if self.subwidget_list.has_key(name): return self.subwidget_list[name] raise AttributeError, name
if self.subwidget_list.has_key(name): return self.subwidget_list[name] raise AttributeError, name
def __getattr__(self, name):
22710823fb554a796dc96c44885d7a9389426824 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/22710823fb554a796dc96c44885d7a9389426824/Tix.py
self.tk.call('tixSetSilent', self._w, value)
self.tk.call('tixSetSilent', self._w, value)
def set_silent(self, value):
22710823fb554a796dc96c44885d7a9389426824 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/22710823fb554a796dc96c44885d7a9389426824/Tix.py
n = self._subwidget_name(name) if not n: raise TclError, "Subwidget " + name + " not child of " + self._name n = n[len(self._w)+1:] return self._nametowidget(n)
n = self._subwidget_name(name) if not n: raise TclError, "Subwidget " + name + " not child of " + self._name n = n[len(self._w)+1:] return self._nametowidget(n)
def subwidget(self, name):
22710823fb554a796dc96c44885d7a9389426824 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/22710823fb554a796dc96c44885d7a9389426824/Tix.py
names = self._subwidget_names() if not names: return [] retlist = [] for name in names: name = name[len(self._w)+1:] try: retlist.append(self._nametowidget(name)) except: pass return retlist
names = self._subwidget_names() if not names: return [] retlist = [] for name in names: name = name[len(self._w)+1:] try: retlist.append(self._nametowidget(name)) except: pass return retlist
def subwidgets_all(self):
22710823fb554a796dc96c44885d7a9389426824 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/22710823fb554a796dc96c44885d7a9389426824/Tix.py
try: return self.tk.call(self._w, 'subwidget', name) except TclError: return None
try: return self.tk.call(self._w, 'subwidget', name) except TclError: return None
def _subwidget_name(self,name):
22710823fb554a796dc96c44885d7a9389426824 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/22710823fb554a796dc96c44885d7a9389426824/Tix.py
try: x = self.tk.call(self._w, 'subwidgets', '-all') return self.tk.split(x) except TclError: return None
try: x = self.tk.call(self._w, 'subwidgets', '-all') return self.tk.split(x) except TclError: return None
def _subwidget_names(self):
22710823fb554a796dc96c44885d7a9389426824 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/22710823fb554a796dc96c44885d7a9389426824/Tix.py
if option == '': return elif type(option) != type(''): option = `option` if type(value) != type(''): value = `value` names = self._subwidget_names() for name in names: self.tk.call(name, 'configure', '-' + option, value)
if option == '': return elif type(option) != type(''): option = `option` if type(value) != type(''): value = `value` names = self._subwidget_names() for name in names: self.tk.call(name, 'configure', '-' + option, value)
def config_all(self, option, value):
22710823fb554a796dc96c44885d7a9389426824 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/22710823fb554a796dc96c44885d7a9389426824/Tix.py
destroy_physically=1, check_intermediate=1): if check_intermediate: path = master._subwidget_name(name) try: path = path[len(master._w)+1:] plist = string.splitfields(path, '.') except: plist = [] if (not check_intermediate) or len(plist) < 2: TixWidget.__init__(self, master, None, None, {'name' : name}) else: parent = master for i in range(len(plist) - 1): n = string.joinfields(plist[:i+1], '.') try: w = master._nametowidget(n) parent = w except KeyError: parent = TixSubWidget(parent, plist[i], destroy_physically=0, check_intermediate=0) TixWidget.__init__(self, parent, None, None, {'name' : name}) self.destroy_physically = destroy_physically
destroy_physically=1, check_intermediate=1): if check_intermediate: path = master._subwidget_name(name) try: path = path[len(master._w)+1:] plist = string.splitfields(path, '.') except: plist = [] if (not check_intermediate) or len(plist) < 2: TixWidget.__init__(self, master, None, None, {'name' : name}) else: parent = master for i in range(len(plist) - 1): n = string.joinfields(plist[:i+1], '.') try: w = master._nametowidget(n) parent = w except KeyError: parent = TixSubWidget(parent, plist[i], destroy_physically=0, check_intermediate=0) TixWidget.__init__(self, parent, None, None, {'name' : name}) self.destroy_physically = destroy_physically
def __init__(self, master, name,
22710823fb554a796dc96c44885d7a9389426824 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/22710823fb554a796dc96c44885d7a9389426824/Tix.py
for c in self.children.values(): c.destroy() if self.master.children.has_key(self._name): del self.master.children[self._name] if self.master.subwidget_list.has_key(self._name): del self.master.subwidget_list[self._name] if self.destroy_physically: self.tk.call('destroy', self._w)
for c in self.children.values(): c.destroy() if self.master.children.has_key(self._name): del self.master.children[self._name] if self.master.subwidget_list.has_key(self._name): del self.master.subwidget_list[self._name] if self.destroy_physically: self.tk.call('destroy', self._w)
def destroy(self):
22710823fb554a796dc96c44885d7a9389426824 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/22710823fb554a796dc96c44885d7a9389426824/Tix.py
dict[x[0][1:]] = (x[0][1:],) + x[1:]
dict[x[0][1:]] = (x[0][1:],) + x[1:]
def _lst2dict(lst): dict = {} for x in lst: dict[x[0][1:]] = (x[0][1:],) + x[1:] return dict
22710823fb554a796dc96c44885d7a9389426824 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/22710823fb554a796dc96c44885d7a9389426824/Tix.py
master = _default_root if not master and cnf.has_key('refwindow'): master=cnf['refwindow'] elif not master and kw.has_key('refwindow'): master= kw['refwindow'] elif not master: raise RuntimeError, "Too early to create display style: no root window" self.tk = master.tk self.stylename = apply(self.tk.call, ('tixDisplayStyle', itemtype) + self._options(cnf,kw) )
master = _default_root if not master and cnf.has_key('refwindow'): master=cnf['refwindow'] elif not master and kw.has_key('refwindow'): master= kw['refwindow'] elif not master: raise RuntimeError, "Too early to create display style: no root window" self.tk = master.tk self.stylename = apply(self.tk.call, ('tixDisplayStyle', itemtype) + self._options(cnf,kw) )
def __init__(self, itemtype, cnf={}, **kw ):
22710823fb554a796dc96c44885d7a9389426824 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/22710823fb554a796dc96c44885d7a9389426824/Tix.py
return self.stylename
return self.stylename
def __str__(self):
22710823fb554a796dc96c44885d7a9389426824 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/22710823fb554a796dc96c44885d7a9389426824/Tix.py
if kw and cnf: cnf = _cnfmerge((cnf, kw)) elif kw: cnf = kw opts = () for k, v in cnf.items(): opts = opts + ('-'+k, v) return opts
if kw and cnf: cnf = _cnfmerge((cnf, kw)) elif kw: cnf = kw opts = () for k, v in cnf.items(): opts = opts + ('-'+k, v) return opts
def _options(self, cnf, kw ):
22710823fb554a796dc96c44885d7a9389426824 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/22710823fb554a796dc96c44885d7a9389426824/Tix.py
self.tk.call(self.stylename, 'delete') del(self)
self.tk.call(self.stylename, 'delete') del(self)
def delete(self):
22710823fb554a796dc96c44885d7a9389426824 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/22710823fb554a796dc96c44885d7a9389426824/Tix.py
self.tk.call(self.stylename, 'configure', '-%s'%key, value)
self.tk.call(self.stylename, 'configure', '-%s'%key, value)
def __setitem__(self,key,value):
22710823fb554a796dc96c44885d7a9389426824 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/22710823fb554a796dc96c44885d7a9389426824/Tix.py
return _lst2dict( self.tk.split( apply(self.tk.call, (self.stylename, 'configure') + self._options(cnf,kw))))
return _lst2dict( self.tk.split( apply(self.tk.call, (self.stylename, 'configure') + self._options(cnf,kw))))
def config(self, cnf={}, **kw):
22710823fb554a796dc96c44885d7a9389426824 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/22710823fb554a796dc96c44885d7a9389426824/Tix.py
return self.tk.call(self.stylename, 'cget', '-%s'%key, value)
return self.tk.call(self.stylename, 'cget', '-%s'%key, value)
def __getitem__(self,key):
22710823fb554a796dc96c44885d7a9389426824 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/22710823fb554a796dc96c44885d7a9389426824/Tix.py
Subwidget Class --------- ----- label Label message Message"""
Subwidget Class --------- ----- label Label message Message"""
def __getitem__(self,key):
22710823fb554a796dc96c44885d7a9389426824 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/22710823fb554a796dc96c44885d7a9389426824/Tix.py
TixWidget.__init__(self, master, 'tixBalloon', ['options'], cnf, kw) self.subwidget_list['label'] = _dummyLabel(self, 'label', destroy_physically=0) self.subwidget_list['message'] = _dummyLabel(self, 'message', destroy_physically=0)
TixWidget.__init__(self, master, 'tixBalloon', ['options'], cnf, kw) self.subwidget_list['label'] = _dummyLabel(self, 'label', destroy_physically=0) self.subwidget_list['message'] = _dummyLabel(self, 'message', destroy_physically=0)
def __init__(self, master=None, cnf={}, **kw):
22710823fb554a796dc96c44885d7a9389426824 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/22710823fb554a796dc96c44885d7a9389426824/Tix.py
"""Bind balloon widget to another. One balloon widget may be bound to several widgets at the same time""" apply(self.tk.call, (self._w, 'bind', widget._w) + self._options(cnf, kw))
"""Bind balloon widget to another. One balloon widget may be bound to several widgets at the same time""" apply(self.tk.call, (self._w, 'bind', widget._w) + self._options(cnf, kw))
def bind_widget(self, widget, cnf={}, **kw):
22710823fb554a796dc96c44885d7a9389426824 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/22710823fb554a796dc96c44885d7a9389426824/Tix.py
self.tk.call(self._w, 'unbind', widget._w)
self.tk.call(self._w, 'unbind', widget._w)
def unbind_widget(self, widget):
22710823fb554a796dc96c44885d7a9389426824 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/22710823fb554a796dc96c44885d7a9389426824/Tix.py
TixWidget.__init__(self, master, 'tixButtonBox', ['orientation', 'options'], cnf, kw)
TixWidget.__init__(self, master, 'tixButtonBox', ['orientation', 'options'], cnf, kw)
def __init__(self, master=None, cnf={}, **kw):
22710823fb554a796dc96c44885d7a9389426824 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/22710823fb554a796dc96c44885d7a9389426824/Tix.py
"""Add a button with given name to box.""" btn = apply(self.tk.call, (self._w, 'add', name) + self._options(cnf, kw)) self.subwidget_list[name] = _dummyButton(self, name) return btn
"""Add a button with given name to box.""" btn = apply(self.tk.call, (self._w, 'add', name) + self._options(cnf, kw)) self.subwidget_list[name] = _dummyButton(self, name) return btn
def add(self, name, cnf={}, **kw):
22710823fb554a796dc96c44885d7a9389426824 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/22710823fb554a796dc96c44885d7a9389426824/Tix.py
if self.subwidget_list.has_key(name): self.tk.call(self._w, 'invoke', name)
if self.subwidget_list.has_key(name): self.tk.call(self._w, 'invoke', name)
def invoke(self, name):
22710823fb554a796dc96c44885d7a9389426824 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/22710823fb554a796dc96c44885d7a9389426824/Tix.py
Subwidget Class --------- ----- entry Entry arrow Button slistbox ScrolledListBox tick Button } cross Button } present if created with the fancy option"""
Subwidget Class --------- ----- entry Entry arrow Button slistbox ScrolledListBox tick Button } cross Button } present if created with the fancy option"""
def invoke(self, name):
22710823fb554a796dc96c44885d7a9389426824 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/22710823fb554a796dc96c44885d7a9389426824/Tix.py
TixWidget.__init__(self, master, 'tixComboBox', ['editable', 'dropdown', 'fancy', 'options'], cnf, kw) self.subwidget_list['label'] = _dummyLabel(self, 'label') self.subwidget_list['entry'] = _dummyEntry(self, 'entry') self.subwidget_list['arrow'] = _dummyButton(self, 'arrow') self.subwidget_list['slistbox'] = _dummyScrolledListBox(self, 'slistbox') try: self.subwidget_list['tick'] = _dummyButton(self, 'tick') self.subwidget_list['cross'] = _dummyButton(self, 'cross') except TypeError: pass
TixWidget.__init__(self, master, 'tixComboBox', ['editable', 'dropdown', 'fancy', 'options'], cnf, kw) self.subwidget_list['label'] = _dummyLabel(self, 'label') self.subwidget_list['entry'] = _dummyEntry(self, 'entry') self.subwidget_list['arrow'] = _dummyButton(self, 'arrow') self.subwidget_list['slistbox'] = _dummyScrolledListBox(self, 'slistbox') try: self.subwidget_list['tick'] = _dummyButton(self, 'tick') self.subwidget_list['cross'] = _dummyButton(self, 'cross') except TypeError: pass
def __init__ (self, master=None, cnf={}, **kw):
22710823fb554a796dc96c44885d7a9389426824 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/22710823fb554a796dc96c44885d7a9389426824/Tix.py
self.tk.call(self._w, 'addhistory', str)
self.tk.call(self._w, 'addhistory', str)
def add_history(self, str):
22710823fb554a796dc96c44885d7a9389426824 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/22710823fb554a796dc96c44885d7a9389426824/Tix.py
self.tk.call(self._w, 'appendhistory', str)
self.tk.call(self._w, 'appendhistory', str)
def append_history(self, str):
22710823fb554a796dc96c44885d7a9389426824 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/22710823fb554a796dc96c44885d7a9389426824/Tix.py
self.tk.call(self._w, 'insert', index, str)
self.tk.call(self._w, 'insert', index, str)
def insert(self, index, str):
22710823fb554a796dc96c44885d7a9389426824 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/22710823fb554a796dc96c44885d7a9389426824/Tix.py
self.tk.call(self._w, 'pick', index)
self.tk.call(self._w, 'pick', index)
def pick(self, index):
22710823fb554a796dc96c44885d7a9389426824 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/22710823fb554a796dc96c44885d7a9389426824/Tix.py
Subwidget Class --------- ----- incr Button decr Button entry Entry label Label"""
Subwidget Class --------- ----- incr Button decr Button entry Entry label Label"""
def pick(self, index):
22710823fb554a796dc96c44885d7a9389426824 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/22710823fb554a796dc96c44885d7a9389426824/Tix.py
TixWidget.__init__(self, master, 'tixControl', ['options'], cnf, kw) self.subwidget_list['incr'] = _dummyButton(self, 'incr') self.subwidget_list['decr'] = _dummyButton(self, 'decr') self.subwidget_list['label'] = _dummyLabel(self, 'label') self.subwidget_list['entry'] = _dummyEntry(self, 'entry')
TixWidget.__init__(self, master, 'tixControl', ['options'], cnf, kw) self.subwidget_list['incr'] = _dummyButton(self, 'incr') self.subwidget_list['decr'] = _dummyButton(self, 'decr') self.subwidget_list['label'] = _dummyLabel(self, 'label') self.subwidget_list['entry'] = _dummyEntry(self, 'entry')
def __init__ (self, master=None, cnf={}, **kw):
22710823fb554a796dc96c44885d7a9389426824 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/22710823fb554a796dc96c44885d7a9389426824/Tix.py
self.tk.call(self._w, 'decr')
self.tk.call(self._w, 'decr')
def decrement(self):
22710823fb554a796dc96c44885d7a9389426824 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/22710823fb554a796dc96c44885d7a9389426824/Tix.py
self.tk.call(self._w, 'incr')
self.tk.call(self._w, 'incr')
def increment(self):
22710823fb554a796dc96c44885d7a9389426824 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/22710823fb554a796dc96c44885d7a9389426824/Tix.py
self.tk.call(self._w, 'invoke')
self.tk.call(self._w, 'invoke')
def invoke(self):
22710823fb554a796dc96c44885d7a9389426824 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/22710823fb554a796dc96c44885d7a9389426824/Tix.py
self.tk.call(self._w, 'update')
self.tk.call(self._w, 'update')
def update(self):
22710823fb554a796dc96c44885d7a9389426824 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/22710823fb554a796dc96c44885d7a9389426824/Tix.py
Subwidget Class --------- ----- hlist HList hsb Scrollbar vsb Scrollbar""" def __init__(self, master, cnf={}, **kw): TixWidget.__init__(self, master, 'tixDirList', ['options'], cnf, kw) self.subwidget_list['hlist'] = _dummyHList(self, 'hlist') self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
Subwidget Class --------- ----- hlist HList hsb Scrollbar vsb Scrollbar""" def __init__(self, master, cnf={}, **kw): TixWidget.__init__(self, master, 'tixDirList', ['options'], cnf, kw) self.subwidget_list['hlist'] = _dummyHList(self, 'hlist') self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
def update(self):
22710823fb554a796dc96c44885d7a9389426824 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/22710823fb554a796dc96c44885d7a9389426824/Tix.py
self.tk.call(self._w, 'chdir', dir)
self.tk.call(self._w, 'chdir', dir)
def chdir(self, dir):
22710823fb554a796dc96c44885d7a9389426824 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/22710823fb554a796dc96c44885d7a9389426824/Tix.py
Subwidget Class --------- ----- hlist HList hsb Scrollbar vsb Scrollbar""" def __init__(self, master, cnf={}, **kw): TixWidget.__init__(self, master, 'tixDirTree', ['options'], cnf, kw) self.subwidget_list['hlist'] = _dummyHList(self, 'hlist') self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
Subwidget Class --------- ----- hlist HList hsb Scrollbar vsb Scrollbar""" def __init__(self, master, cnf={}, **kw): TixWidget.__init__(self, master, 'tixDirTree', ['options'], cnf, kw) self.subwidget_list['hlist'] = _dummyHList(self, 'hlist') self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
def chdir(self, dir):
22710823fb554a796dc96c44885d7a9389426824 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/22710823fb554a796dc96c44885d7a9389426824/Tix.py
self.tk.call(self._w, 'chdir', dir)
self.tk.call(self._w, 'chdir', dir)
def chdir(self, dir):
22710823fb554a796dc96c44885d7a9389426824 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/22710823fb554a796dc96c44885d7a9389426824/Tix.py
Subwidget Class --------- ----- cancel Button ok Button hidden Checkbutton types ComboBox dir ComboBox file ComboBox dirlist ScrolledListBox filelist ScrolledListBox""" def __init__(self, master, cnf={}, **kw): TixWidget.__init__(self, master, 'tixExFileSelectBox', ['options'], cnf, kw) self.subwidget_list['cancel'] = _dummyButton(self, 'cancel') self.subwidget_list['ok'] = _dummyButton(self, 'ok') self.subwidget_list['hidden'] = _dummyCheckbutton(self, 'hidden') self.subwidget_list['types'] = _dummyComboBox(self, 'types') self.subwidget_list['dir'] = _dummyComboBox(self, 'dir') self.subwidget_list['dirlist'] = _dummyDirList(self, 'dirlist') self.subwidget_list['file'] = _dummyComboBox(self, 'file') self.subwidget_list['filelist'] = _dummyScrolledListBox(self, 'filelist')
Subwidget Class --------- ----- cancel Button ok Button hidden Checkbutton types ComboBox dir ComboBox file ComboBox dirlist ScrolledListBox filelist ScrolledListBox""" def __init__(self, master, cnf={}, **kw): TixWidget.__init__(self, master, 'tixExFileSelectBox', ['options'], cnf, kw) self.subwidget_list['cancel'] = _dummyButton(self, 'cancel') self.subwidget_list['ok'] = _dummyButton(self, 'ok') self.subwidget_list['hidden'] = _dummyCheckbutton(self, 'hidden') self.subwidget_list['types'] = _dummyComboBox(self, 'types') self.subwidget_list['dir'] = _dummyComboBox(self, 'dir') self.subwidget_list['dirlist'] = _dummyDirList(self, 'dirlist') self.subwidget_list['file'] = _dummyComboBox(self, 'file') self.subwidget_list['filelist'] = _dummyScrolledListBox(self, 'filelist')
def chdir(self, dir):
22710823fb554a796dc96c44885d7a9389426824 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/22710823fb554a796dc96c44885d7a9389426824/Tix.py
self.tk.call(self._w, 'filter')
self.tk.call(self._w, 'filter')
def filter(self):
22710823fb554a796dc96c44885d7a9389426824 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/22710823fb554a796dc96c44885d7a9389426824/Tix.py
self.tk.call(self._w, 'invoke')
self.tk.call(self._w, 'invoke')
def invoke(self):
22710823fb554a796dc96c44885d7a9389426824 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/22710823fb554a796dc96c44885d7a9389426824/Tix.py
Subwidgets Class ---------- ----- fsbox ExFileSelectBox""" def __init__(self, master, cnf={}, **kw): TixWidget.__init__(self, master, 'tixExFileSelectDialog', ['options'], cnf, kw) self.subwidget_list['fsbox'] = _dummyExFileSelectBox(self, 'fsbox')
Subwidgets Class ---------- ----- fsbox ExFileSelectBox""" def __init__(self, master, cnf={}, **kw): TixWidget.__init__(self, master, 'tixExFileSelectDialog', ['options'], cnf, kw) self.subwidget_list['fsbox'] = _dummyExFileSelectBox(self, 'fsbox')
def invoke(self):
22710823fb554a796dc96c44885d7a9389426824 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/22710823fb554a796dc96c44885d7a9389426824/Tix.py
self.tk.call(self._w, 'popup')
self.tk.call(self._w, 'popup')
def popup(self):
22710823fb554a796dc96c44885d7a9389426824 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/22710823fb554a796dc96c44885d7a9389426824/Tix.py
self.tk.call(self._w, 'popdown')
self.tk.call(self._w, 'popdown')
def popdown(self):
22710823fb554a796dc96c44885d7a9389426824 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/22710823fb554a796dc96c44885d7a9389426824/Tix.py
Subwidget Class --------- ----- selection ComboBox filter ComboBox dirlist ScrolledListBox filelist ScrolledListBox""" def __init__(self, master, cnf={}, **kw): TixWidget.__init__(self, master, 'tixFileSelectBox', ['options'], cnf, kw) self.subwidget_list['dirlist'] = _dummyScrolledListBox(self, 'dirlist') self.subwidget_list['filelist'] = _dummyScrolledListBox(self, 'filelist') self.subwidget_list['filter'] = _dummyComboBox(self, 'filter') self.subwidget_list['selection'] = _dummyComboBox(self, 'selection') def apply_filter(self): self.tk.call(self._w, 'filter')
Subwidget Class --------- ----- selection ComboBox filter ComboBox dirlist ScrolledListBox filelist ScrolledListBox""" def __init__(self, master, cnf={}, **kw): TixWidget.__init__(self, master, 'tixFileSelectBox', ['options'], cnf, kw) self.subwidget_list['dirlist'] = _dummyScrolledListBox(self, 'dirlist') self.subwidget_list['filelist'] = _dummyScrolledListBox(self, 'filelist') self.subwidget_list['filter'] = _dummyComboBox(self, 'filter') self.subwidget_list['selection'] = _dummyComboBox(self, 'selection') def apply_filter(self): self.tk.call(self._w, 'filter')
def popdown(self):
22710823fb554a796dc96c44885d7a9389426824 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/22710823fb554a796dc96c44885d7a9389426824/Tix.py
self.tk.call(self._w, 'invoke')
self.tk.call(self._w, 'invoke')
def invoke(self):
22710823fb554a796dc96c44885d7a9389426824 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/22710823fb554a796dc96c44885d7a9389426824/Tix.py
Subwidgets Class ---------- ----- btns StdButtonBox fsbox FileSelectBox""" def __init__(self, master, cnf={}, **kw): TixWidget.__init__(self, master, 'tixFileSelectDialog', ['options'], cnf, kw) self.subwidget_list['btns'] = _dummyStdButtonBox(self, 'btns') self.subwidget_list['fsbox'] = _dummyFileSelectBox(self, 'fsbox')
Subwidgets Class ---------- ----- btns StdButtonBox fsbox FileSelectBox""" def __init__(self, master, cnf={}, **kw): TixWidget.__init__(self, master, 'tixFileSelectDialog', ['options'], cnf, kw) self.subwidget_list['btns'] = _dummyStdButtonBox(self, 'btns') self.subwidget_list['fsbox'] = _dummyFileSelectBox(self, 'fsbox')
def invoke(self):
22710823fb554a796dc96c44885d7a9389426824 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/22710823fb554a796dc96c44885d7a9389426824/Tix.py
self.tk.call(self._w, 'popup')
self.tk.call(self._w, 'popup')
def popup(self):
22710823fb554a796dc96c44885d7a9389426824 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/22710823fb554a796dc96c44885d7a9389426824/Tix.py
self.tk.call(self._w, 'popdown')
self.tk.call(self._w, 'popdown')
def popdown(self):
22710823fb554a796dc96c44885d7a9389426824 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/22710823fb554a796dc96c44885d7a9389426824/Tix.py