rem
stringlengths 0
322k
| add
stringlengths 0
2.05M
| context
stringlengths 8
228k
|
---|---|---|
transform = element._as_immutable except AttributeError: pass else: element = transform() self._data[element] = True | self._data[element] = True except TypeError: transform = getattr(element, "_as_temporary_immutable", None) if transform is None: raise self._data[transform()] = True | def add(self, element): """Add an element to a set. |
transform = element._as_temporarily_immutable except AttributeError: pass else: element = transform() del self._data[element] | del self._data[element] except TypeError: transform = getattr(element, "_as_temporary_immutable", None) if transform is None: raise del self._data[transform()] | def remove(self, element): """Remove an element from a set; it must be a member. |
gp.pixmode(GL.PM_RTOL, 1) | gl.pixmode(GL.PM_RTOL, 1) | def showpartframe(self, data, chromdata, (x,y,w,h)): pmsize = self.bpp xpf, ypf = self.xpf, self.ypf if self.upside_down: gl.pixmode(GL.PM_TTOB, 1) if self.mirror_image: gp.pixmode(GL.PM_RTOL, 1) if self.format in ('jpeg', 'jpeggrey'): import jpeg data, width, height, bytes = jpeg.decompress(data) pmsize = bytes*8 elif self.format == 'compress': if not self.decompressor: import cl, CL scheme = cl.QueryScheme(self.compressheader) self.decompressor = cl.OpenDecompressor(scheme) headersize = self.decompressor.ReadHeader(self.compressheader) width = self.decompressor.GetParam(CL.IMAGE_WIDTH) height = self.decompressor.GetParam(CL.IMAGE_HEIGHT) params = [CL.ORIGINAL_FORMAT, CL.RGBX, \ CL.ORIENTATION, CL.BOTTOM_UP, \ CL.FRAME_BUFFER_SIZE, width*height*CL.BytesPerPixel(CL.RGBX)] self.decompressor.SetParams(params) data = self.decompressor.Decompress(1, data) elif self.format in ('mono', 'grey4'): if self.mustunpack: if self.format == 'mono': data = imageop.mono2grey(data, \ w/xpf, h/ypf, 0x20, 0xdf) elif self.format == 'grey4': data = imageop.grey42grey(data, \ w/xpf, h/ypf) pmsize = 8 elif self.format == 'grey2': data = imageop.grey22grey(data, w/xpf, h/ypf) pmsize = 8 if not self.colormapinited: self.initcolormap() if self.fixcolor0: gl.mapcolor(self.color0) self.fixcolor0 = 0 xfactor = yfactor = self.magnify xfactor = xfactor * xpf yfactor = yfactor * ypf if chromdata and not self.skipchrom: cp = self.chrompack cx = int(x*xfactor*cp) + self.xorigin cy = int(y*yfactor*cp) + self.yorigin cw = (w+cp-1)/cp ch = (h+cp-1)/cp gl.rectzoom(xfactor*cp, yfactor*cp) gl.pixmode(GL.PM_SIZE, 16) gl.writemask(self.mask - ((1 << self.c0bits) - 1)) gl.lrectwrite(cx, cy, cx + cw - 1, cy + ch - 1, \ chromdata) # if pmsize < 32: gl.writemask((1 << self.c0bits) - 1) gl.pixmode(GL.PM_SIZE, pmsize) w = w/xpf h = h/ypf x = x/xpf y = y/ypf gl.rectzoom(xfactor, yfactor) x = int(x*xfactor)+self.xorigin y = int(y*yfactor)+self.yorigin gl.lrectwrite(x, y, x + w - 1, y + h - 1, data) gl.gflush() |
Node.debug=open( "debug4.out", "w" ) | Node.debug=StringIO() | def __init__( self ): self.childNodes=[] if Node._debug: index=repr( id( self ))+repr( self.__class__ ) Node.allnodes[index]=repr( self.__dict__ ) if Node.debug==None: Node.debug=open( "debug4.out", "w" ) Node.debug.write( "create %s\n"%index ) |
if type( attname_or_tuple ) == type( () ): | if type( attname_or_tuple ) == types.TupleType: | def __getitem__( self, attname_or_tuple ): if type( attname_or_tuple ) == type( () ): return self._attrsNS[attname_or_tuple] else: return self._attrs[attname_or_tuple] |
def __setitem__( self, attname ): raise TypeError, "object does not support item assignment" | def __setitem__( self, attname, value ): if type( value ) == types.StringType: node=Attr( attname ) node.value=value else: assert isinstance( value, Attr ) or type( value )==types.StringType node=value old=self._attrs.get( attname, None) if old: old.unlink() self._attrs[node.name]=node self._attrsNS[(node.namespaceURI,node.localName)]=node | def __setitem__( self, attname ): raise TypeError, "object does not support item assignment" |
self.assertEqual(0x7fffffff, 2147483647) | if platform_long_is_32_bits: self.assertEqual(0x7fffffff, 2147483647) else: self.assertEqual(0x7fffffffffffffff, 9223372036854775807) | def test_hex_baseline(self): # Baseline tests self.assertEqual(0x0, 0) self.assertEqual(0x10, 16) self.assertEqual(0x7fffffff, 2147483647) # Ditto with a minus sign and parentheses self.assertEqual(-(0x0), 0) self.assertEqual(-(0x10), -16) self.assertEqual(-(0x7fffffff), -2147483647) # Ditto with a minus sign and NO parentheses self.assertEqual(-0x0, 0) self.assertEqual(-0x10, -16) self.assertEqual(-0x7fffffff, -2147483647) |
self.assertEqual(-(0x7fffffff), -2147483647) | if platform_long_is_32_bits: self.assertEqual(-(0x7fffffff), -2147483647) else: self.assertEqual(-(0x7fffffffffffffff), -9223372036854775807) | def test_hex_baseline(self): # Baseline tests self.assertEqual(0x0, 0) self.assertEqual(0x10, 16) self.assertEqual(0x7fffffff, 2147483647) # Ditto with a minus sign and parentheses self.assertEqual(-(0x0), 0) self.assertEqual(-(0x10), -16) self.assertEqual(-(0x7fffffff), -2147483647) # Ditto with a minus sign and NO parentheses self.assertEqual(-0x0, 0) self.assertEqual(-0x10, -16) self.assertEqual(-0x7fffffff, -2147483647) |
self.assertEqual(-0x7fffffff, -2147483647) | if platform_long_is_32_bits: self.assertEqual(-0x7fffffff, -2147483647) else: self.assertEqual(-0x7fffffffffffffff, -9223372036854775807) | def test_hex_baseline(self): # Baseline tests self.assertEqual(0x0, 0) self.assertEqual(0x10, 16) self.assertEqual(0x7fffffff, 2147483647) # Ditto with a minus sign and parentheses self.assertEqual(-(0x0), 0) self.assertEqual(-(0x10), -16) self.assertEqual(-(0x7fffffff), -2147483647) # Ditto with a minus sign and NO parentheses self.assertEqual(-0x0, 0) self.assertEqual(-0x10, -16) self.assertEqual(-0x7fffffff, -2147483647) |
self.assertEqual(0x80000000, -2147483648L) self.assertEqual(0xffffffff, -1) self.assertEqual(-(0x80000000), 2147483648L) self.assertEqual(-(0xffffffff), 1) self.assertEqual(-0x80000000, 2147483648L) self.assertEqual(-0xffffffff, 1) | if platform_long_is_32_bits: self.assertEqual(0x80000000, -2147483648L) self.assertEqual(0xffffffff, -1) self.assertEqual(-(0x80000000), 2147483648L) self.assertEqual(-(0xffffffff), 1) self.assertEqual(-0x80000000, 2147483648L) self.assertEqual(-0xffffffff, 1) else: self.assertEqual(0x8000000000000000, -9223372036854775808L) self.assertEqual(0xffffffffffffffff, -1) self.assertEqual(-(0x8000000000000000), 9223372036854775808L) self.assertEqual(-(0xffffffffffffffff), 1) self.assertEqual(-0x8000000000000000, 9223372036854775808L) self.assertEqual(-0xffffffffffffffff, 1) | def test_hex_unsigned(self): # This test is in a <string> so we can ignore the warnings exec """if 1: # Positive-looking constants with negavive values self.assertEqual(0x80000000, -2147483648L) self.assertEqual(0xffffffff, -1) # Ditto with a minus sign and parentheses self.assertEqual(-(0x80000000), 2147483648L) self.assertEqual(-(0xffffffff), 1) # Ditto with a minus sign and NO parentheses # This failed in Python 2.2 through 2.2.2 and in 2.3a1 self.assertEqual(-0x80000000, 2147483648L) self.assertEqual(-0xffffffff, 1) \n""" |
self.assertEqual(017777777777, 2147483647) | if platform_long_is_32_bits: self.assertEqual(017777777777, 2147483647) else: self.assertEqual(0777777777777777777777, 9223372036854775807) | def test_oct_baseline(self): # Baseline tests self.assertEqual(00, 0) self.assertEqual(020, 16) self.assertEqual(017777777777, 2147483647) # Ditto with a minus sign and parentheses self.assertEqual(-(00), 0) self.assertEqual(-(020), -16) self.assertEqual(-(017777777777), -2147483647) # Ditto with a minus sign and NO parentheses self.assertEqual(-00, 0) self.assertEqual(-020, -16) self.assertEqual(-017777777777, -2147483647) |
self.assertEqual(-(017777777777), -2147483647) | if platform_long_is_32_bits: self.assertEqual(-(017777777777), -2147483647) else: self.assertEqual(-(0777777777777777777777), -9223372036854775807) | def test_oct_baseline(self): # Baseline tests self.assertEqual(00, 0) self.assertEqual(020, 16) self.assertEqual(017777777777, 2147483647) # Ditto with a minus sign and parentheses self.assertEqual(-(00), 0) self.assertEqual(-(020), -16) self.assertEqual(-(017777777777), -2147483647) # Ditto with a minus sign and NO parentheses self.assertEqual(-00, 0) self.assertEqual(-020, -16) self.assertEqual(-017777777777, -2147483647) |
self.assertEqual(-017777777777, -2147483647) | if platform_long_is_32_bits: self.assertEqual(-017777777777, -2147483647) else: self.assertEqual(-0777777777777777777777, -9223372036854775807) | def test_oct_baseline(self): # Baseline tests self.assertEqual(00, 0) self.assertEqual(020, 16) self.assertEqual(017777777777, 2147483647) # Ditto with a minus sign and parentheses self.assertEqual(-(00), 0) self.assertEqual(-(020), -16) self.assertEqual(-(017777777777), -2147483647) # Ditto with a minus sign and NO parentheses self.assertEqual(-00, 0) self.assertEqual(-020, -16) self.assertEqual(-017777777777, -2147483647) |
self.assertEqual(020000000000, -2147483648L) self.assertEqual(037777777777, -1) self.assertEqual(-(020000000000), 2147483648L) self.assertEqual(-(037777777777), 1) self.assertEqual(-020000000000, 2147483648L) self.assertEqual(-037777777777, 1) | if platform_long_is_32_bits: self.assertEqual(020000000000, -2147483648L) self.assertEqual(037777777777, -1) self.assertEqual(-(020000000000), 2147483648L) self.assertEqual(-(037777777777), 1) self.assertEqual(-020000000000, 2147483648L) self.assertEqual(-037777777777, 1) else: self.assertEqual(01000000000000000000000, -9223372036854775808L) self.assertEqual(01777777777777777777777, -1) self.assertEqual(-(01000000000000000000000), 9223372036854775808L) self.assertEqual(-(01777777777777777777777), 1) self.assertEqual(-01000000000000000000000, 9223372036854775808L) self.assertEqual(-01777777777777777777777, 1) | def test_oct_unsigned(self): # This test is in a <string> so we can ignore the warnings exec """if 1: # Positive-looking constants with negavive values self.assertEqual(020000000000, -2147483648L) self.assertEqual(037777777777, -1) # Ditto with a minus sign and parentheses self.assertEqual(-(020000000000), 2147483648L) self.assertEqual(-(037777777777), 1) # Ditto with a minus sign and NO parentheses # This failed in Python 2.2 through 2.2.2 and in 2.3a1 self.assertEqual(-020000000000, 2147483648L) self.assertEqual(-037777777777, 1) \n""" |
def randrange(n): """Return a random shuffle of range(n).""" | def randfloats(n): """Return a list of n random floats in [0, 1).""" | def randrange(n): """Return a random shuffle of range(n).""" fn = os.path.join(td, "rr%06d" % n) try: fp = open(fn, "rb") except IOError: result = [] for i in range(n): result.append(random.random()) try: try: fp = open(fn, "wb") marshal.dump(result, fp) fp.close() fp = None finally: if fp: try: os.unlink(fn) except os.error: pass except IOError, msg: print "can't write", fn, ":", msg else: result = marshal.load(fp) fp.close() ##assert len(result) == n # Shuffle it a bit... for i in range(10): i = random.randrange(0, n) temp = result[:i] del result[:i] temp.reverse() result[len(result):] = temp del temp return result |
result = [] for i in range(n): result.append(random.random()) | r = random.random result = [r() for i in xrange(n)] | def randrange(n): """Return a random shuffle of range(n).""" fn = os.path.join(td, "rr%06d" % n) try: fp = open(fn, "rb") except IOError: result = [] for i in range(n): result.append(random.random()) try: try: fp = open(fn, "wb") marshal.dump(result, fp) fp.close() fp = None finally: if fp: try: os.unlink(fn) except os.error: pass except IOError, msg: print "can't write", fn, ":", msg else: result = marshal.load(fp) fp.close() ##assert len(result) == n # Shuffle it a bit... for i in range(10): i = random.randrange(0, n) temp = result[:i] del result[:i] temp.reverse() result[len(result):] = temp del temp return result |
i = random.randrange(0, n) | i = random.randrange(n) | def randrange(n): """Return a random shuffle of range(n).""" fn = os.path.join(td, "rr%06d" % n) try: fp = open(fn, "rb") except IOError: result = [] for i in range(n): result.append(random.random()) try: try: fp = open(fn, "wb") marshal.dump(result, fp) fp.close() fp = None finally: if fp: try: os.unlink(fn) except os.error: pass except IOError, msg: print "can't write", fn, ":", msg else: result = marshal.load(fp) fp.close() ##assert len(result) == n # Shuffle it a bit... for i in range(10): i = random.randrange(0, n) temp = result[:i] del result[:i] temp.reverse() result[len(result):] = temp del temp return result |
result[len(result):] = temp | result.extend(temp) | def randrange(n): """Return a random shuffle of range(n).""" fn = os.path.join(td, "rr%06d" % n) try: fp = open(fn, "rb") except IOError: result = [] for i in range(n): result.append(random.random()) try: try: fp = open(fn, "wb") marshal.dump(result, fp) fp.close() fp = None finally: if fp: try: os.unlink(fn) except os.error: pass except IOError, msg: print "can't write", fn, ":", msg else: result = marshal.load(fp) fp.close() ##assert len(result) == n # Shuffle it a bit... for i in range(10): i = random.randrange(0, n) temp = result[:i] del result[:i] temp.reverse() result[len(result):] = temp del temp return result |
def fl(): | def flush(): | def fl(): sys.stdout.flush() |
fl() | flush() | def doit(L): t0 = time.clock() L.sort() t1 = time.clock() print "%6.2f" % (t1-t0), fl() |
-sort: all equal | =sort: all equal | def tabulate(r): """Tabulate sort speed for lists of various sizes. The sizes are 2**i for i in r (the argument, a list). The output displays i, 2**i, and the time to sort arrays of 2**i floating point numbers with the following properties: *sort: random data \sort: descending data /sort: ascending data ~sort: many duplicates -sort: all equal !sort: worst case scenario """ cases = ("*sort", "\\sort", "/sort", "~sort", "-sort", "!sort") fmt = ("%2s %6s" + " %6s"*len(cases)) print fmt % (("i", "2**i") + cases) for i in r: n = 1<<i L = randrange(n) ##assert len(L) == n print "%2d %6d" % (i, n), fl() doit(L) # *sort L.reverse() doit(L) # \sort doit(L) # /sort if n > 4: del L[4:] L = L*(n/4) L = map(lambda x: --x, L) doit(L) # ~sort del L L = map(abs, [-0.5]*n) doit(L) # -sort L = range(n/2-1, -1, -1) L[len(L):] = range(n/2) doit(L) # !sort print |
cases = ("*sort", "\\sort", "/sort", "~sort", "-sort", "!sort") fmt = ("%2s %6s" + " %6s"*len(cases)) | cases = ("*sort", "\\sort", "/sort", "~sort", "=sort", "!sort") fmt = ("%2s %7s" + " %6s"*len(cases)) | def tabulate(r): """Tabulate sort speed for lists of various sizes. The sizes are 2**i for i in r (the argument, a list). The output displays i, 2**i, and the time to sort arrays of 2**i floating point numbers with the following properties: *sort: random data \sort: descending data /sort: ascending data ~sort: many duplicates -sort: all equal !sort: worst case scenario """ cases = ("*sort", "\\sort", "/sort", "~sort", "-sort", "!sort") fmt = ("%2s %6s" + " %6s"*len(cases)) print fmt % (("i", "2**i") + cases) for i in r: n = 1<<i L = randrange(n) ##assert len(L) == n print "%2d %6d" % (i, n), fl() doit(L) # *sort L.reverse() doit(L) # \sort doit(L) # /sort if n > 4: del L[4:] L = L*(n/4) L = map(lambda x: --x, L) doit(L) # ~sort del L L = map(abs, [-0.5]*n) doit(L) # -sort L = range(n/2-1, -1, -1) L[len(L):] = range(n/2) doit(L) # !sort print |
n = 1<<i L = randrange(n) print "%2d %6d" % (i, n), fl() | n = 1 << i L = randfloats(n) print "%2d %7d" % (i, n), flush() | def tabulate(r): """Tabulate sort speed for lists of various sizes. The sizes are 2**i for i in r (the argument, a list). The output displays i, 2**i, and the time to sort arrays of 2**i floating point numbers with the following properties: *sort: random data \sort: descending data /sort: ascending data ~sort: many duplicates -sort: all equal !sort: worst case scenario """ cases = ("*sort", "\\sort", "/sort", "~sort", "-sort", "!sort") fmt = ("%2s %6s" + " %6s"*len(cases)) print fmt % (("i", "2**i") + cases) for i in r: n = 1<<i L = randrange(n) ##assert len(L) == n print "%2d %6d" % (i, n), fl() doit(L) # *sort L.reverse() doit(L) # \sort doit(L) # /sort if n > 4: del L[4:] L = L*(n/4) L = map(lambda x: --x, L) doit(L) # ~sort del L L = map(abs, [-0.5]*n) doit(L) # -sort L = range(n/2-1, -1, -1) L[len(L):] = range(n/2) doit(L) # !sort print |
L = L*(n/4) | L = L * (n // 4) | def tabulate(r): """Tabulate sort speed for lists of various sizes. The sizes are 2**i for i in r (the argument, a list). The output displays i, 2**i, and the time to sort arrays of 2**i floating point numbers with the following properties: *sort: random data \sort: descending data /sort: ascending data ~sort: many duplicates -sort: all equal !sort: worst case scenario """ cases = ("*sort", "\\sort", "/sort", "~sort", "-sort", "!sort") fmt = ("%2s %6s" + " %6s"*len(cases)) print fmt % (("i", "2**i") + cases) for i in r: n = 1<<i L = randrange(n) ##assert len(L) == n print "%2d %6d" % (i, n), fl() doit(L) # *sort L.reverse() doit(L) # \sort doit(L) # /sort if n > 4: del L[4:] L = L*(n/4) L = map(lambda x: --x, L) doit(L) # ~sort del L L = map(abs, [-0.5]*n) doit(L) # -sort L = range(n/2-1, -1, -1) L[len(L):] = range(n/2) doit(L) # !sort print |
L = map(abs, [-0.5]*n) doit(L) L = range(n/2-1, -1, -1) L[len(L):] = range(n/2) | L = map(abs, [-0.5] * n) doit(L) del L half = n // 2 L = range(half - 1, -1, -1) L.extend(range(half)) L = map(float, L) | def tabulate(r): """Tabulate sort speed for lists of various sizes. The sizes are 2**i for i in r (the argument, a list). The output displays i, 2**i, and the time to sort arrays of 2**i floating point numbers with the following properties: *sort: random data \sort: descending data /sort: ascending data ~sort: many duplicates -sort: all equal !sort: worst case scenario """ cases = ("*sort", "\\sort", "/sort", "~sort", "-sort", "!sort") fmt = ("%2s %6s" + " %6s"*len(cases)) print fmt % (("i", "2**i") + cases) for i in r: n = 1<<i L = randrange(n) ##assert len(L) == n print "%2d %6d" % (i, n), fl() doit(L) # *sort L.reverse() doit(L) # \sort doit(L) # /sort if n > 4: del L[4:] L = L*(n/4) L = map(lambda x: --x, L) doit(L) # ~sort del L L = map(abs, [-0.5]*n) doit(L) # -sort L = range(n/2-1, -1, -1) L[len(L):] = range(n/2) doit(L) # !sort print |
k2 = 19 | k2 = 20 | def main(): """Main program when invoked as a script. One argument: tabulate a single row. Two arguments: tabulate a range (inclusive). Extra arguments are used to seed the random generator. """ # default range (inclusive) k1 = 15 k2 = 19 if sys.argv[1:]: # one argument: single point k1 = k2 = int(sys.argv[1]) if sys.argv[2:]: # two arguments: specify range k2 = int(sys.argv[2]) if sys.argv[3:]: # derive random seed from remaining arguments x, y, z = 0, 0, 0 for a in sys.argv[3:]: h = hash(a) h, d = divmod(h, 256) h = h & 0xffffff x = (x^h^d) & 255 h = h>>8 y = (y^h^d) & 255 h = h>>8 z = (z^h^d) & 255 whrandom.seed(x, y, z) r = range(k1, k2+1) # include the end point tabulate(r) |
x, y, z = 0, 0, 0 | x = 1 | def main(): """Main program when invoked as a script. One argument: tabulate a single row. Two arguments: tabulate a range (inclusive). Extra arguments are used to seed the random generator. """ # default range (inclusive) k1 = 15 k2 = 19 if sys.argv[1:]: # one argument: single point k1 = k2 = int(sys.argv[1]) if sys.argv[2:]: # two arguments: specify range k2 = int(sys.argv[2]) if sys.argv[3:]: # derive random seed from remaining arguments x, y, z = 0, 0, 0 for a in sys.argv[3:]: h = hash(a) h, d = divmod(h, 256) h = h & 0xffffff x = (x^h^d) & 255 h = h>>8 y = (y^h^d) & 255 h = h>>8 z = (z^h^d) & 255 whrandom.seed(x, y, z) r = range(k1, k2+1) # include the end point tabulate(r) |
h = hash(a) h, d = divmod(h, 256) h = h & 0xffffff x = (x^h^d) & 255 h = h>>8 y = (y^h^d) & 255 h = h>>8 z = (z^h^d) & 255 whrandom.seed(x, y, z) | x = 69069 * x + hash(a) random.seed(x) | def main(): """Main program when invoked as a script. One argument: tabulate a single row. Two arguments: tabulate a range (inclusive). Extra arguments are used to seed the random generator. """ # default range (inclusive) k1 = 15 k2 = 19 if sys.argv[1:]: # one argument: single point k1 = k2 = int(sys.argv[1]) if sys.argv[2:]: # two arguments: specify range k2 = int(sys.argv[2]) if sys.argv[3:]: # derive random seed from remaining arguments x, y, z = 0, 0, 0 for a in sys.argv[3:]: h = hash(a) h, d = divmod(h, 256) h = h & 0xffffff x = (x^h^d) & 255 h = h>>8 y = (y^h^d) & 255 h = h>>8 z = (z^h^d) & 255 whrandom.seed(x, y, z) r = range(k1, k2+1) # include the end point tabulate(r) |
if (new == Py_None) { | if (new == NULL || new == Py_None) { | def outputFreeIt(self, itselfname): Output("DisposeDialog(%s);", itselfname) |
self.recall(sel) | self.recall(sel, event) | def enter_callback(self, event): if self.executing and not self.reading: return # Let the default binding (insert '\n') take over # If some text is selected, recall the selection # (but only if this before the I/O mark) try: sel = self.text.get("sel.first", "sel.last") if sel: if self.text.compare("sel.last", "<=", "iomark"): self.recall(sel) return "break" except: pass # If we're strictly before the line containing iomark, recall # the current line, less a leading prompt, less leading or # trailing whitespace if self.text.compare("insert", "<", "iomark linestart"): # Check if there's a relevant stdin range -- if so, use it prev = self.text.tag_prevrange("stdin", "insert") if prev and self.text.compare("insert", "<", prev[1]): self.recall(self.text.get(prev[0], prev[1])) return "break" next = self.text.tag_nextrange("stdin", "insert") if next and self.text.compare("insert lineend", ">=", next[0]): self.recall(self.text.get(next[0], next[1])) return "break" # No stdin mark -- just get the current line, less any prompt line = self.text.get("insert linestart", "insert lineend") last_line_of_prompt = sys.ps1.split('\n')[-1] if line.startswith(last_line_of_prompt): line = line[len(last_line_of_prompt):] self.recall(line) return "break" # If we're between the beginning of the line and the iomark, i.e. # in the prompt area, move to the end of the prompt if self.text.compare("insert", "<", "iomark"): self.text.mark_set("insert", "iomark") # If we're in the current input and there's only whitespace # beyond the cursor, erase that whitespace first s = self.text.get("insert", "end-1c") if s and not s.strip(): self.text.delete("insert", "end-1c") # If we're in the current input before its last line, # insert a newline right at the insert point if self.text.compare("insert", "<", "end-1c linestart"): self.newline_and_indent_event(event) return "break" # We're in the last line; append a newline and submit it self.text.mark_set("insert", "end-1c") if self.reading: self.text.insert("insert", "\n") self.text.see("insert") else: self.newline_and_indent_event(event) self.text.tag_add("stdin", "iomark", "end-1c") self.text.update_idletasks() if self.reading: self.top.quit() # Break out of recursive mainloop() in raw_input() else: self.runit() return "break" |
self.recall(self.text.get(prev[0], prev[1])) | self.recall(self.text.get(prev[0], prev[1]), event) | def enter_callback(self, event): if self.executing and not self.reading: return # Let the default binding (insert '\n') take over # If some text is selected, recall the selection # (but only if this before the I/O mark) try: sel = self.text.get("sel.first", "sel.last") if sel: if self.text.compare("sel.last", "<=", "iomark"): self.recall(sel) return "break" except: pass # If we're strictly before the line containing iomark, recall # the current line, less a leading prompt, less leading or # trailing whitespace if self.text.compare("insert", "<", "iomark linestart"): # Check if there's a relevant stdin range -- if so, use it prev = self.text.tag_prevrange("stdin", "insert") if prev and self.text.compare("insert", "<", prev[1]): self.recall(self.text.get(prev[0], prev[1])) return "break" next = self.text.tag_nextrange("stdin", "insert") if next and self.text.compare("insert lineend", ">=", next[0]): self.recall(self.text.get(next[0], next[1])) return "break" # No stdin mark -- just get the current line, less any prompt line = self.text.get("insert linestart", "insert lineend") last_line_of_prompt = sys.ps1.split('\n')[-1] if line.startswith(last_line_of_prompt): line = line[len(last_line_of_prompt):] self.recall(line) return "break" # If we're between the beginning of the line and the iomark, i.e. # in the prompt area, move to the end of the prompt if self.text.compare("insert", "<", "iomark"): self.text.mark_set("insert", "iomark") # If we're in the current input and there's only whitespace # beyond the cursor, erase that whitespace first s = self.text.get("insert", "end-1c") if s and not s.strip(): self.text.delete("insert", "end-1c") # If we're in the current input before its last line, # insert a newline right at the insert point if self.text.compare("insert", "<", "end-1c linestart"): self.newline_and_indent_event(event) return "break" # We're in the last line; append a newline and submit it self.text.mark_set("insert", "end-1c") if self.reading: self.text.insert("insert", "\n") self.text.see("insert") else: self.newline_and_indent_event(event) self.text.tag_add("stdin", "iomark", "end-1c") self.text.update_idletasks() if self.reading: self.top.quit() # Break out of recursive mainloop() in raw_input() else: self.runit() return "break" |
self.recall(self.text.get(next[0], next[1])) | self.recall(self.text.get(next[0], next[1]), event) | def enter_callback(self, event): if self.executing and not self.reading: return # Let the default binding (insert '\n') take over # If some text is selected, recall the selection # (but only if this before the I/O mark) try: sel = self.text.get("sel.first", "sel.last") if sel: if self.text.compare("sel.last", "<=", "iomark"): self.recall(sel) return "break" except: pass # If we're strictly before the line containing iomark, recall # the current line, less a leading prompt, less leading or # trailing whitespace if self.text.compare("insert", "<", "iomark linestart"): # Check if there's a relevant stdin range -- if so, use it prev = self.text.tag_prevrange("stdin", "insert") if prev and self.text.compare("insert", "<", prev[1]): self.recall(self.text.get(prev[0], prev[1])) return "break" next = self.text.tag_nextrange("stdin", "insert") if next and self.text.compare("insert lineend", ">=", next[0]): self.recall(self.text.get(next[0], next[1])) return "break" # No stdin mark -- just get the current line, less any prompt line = self.text.get("insert linestart", "insert lineend") last_line_of_prompt = sys.ps1.split('\n')[-1] if line.startswith(last_line_of_prompt): line = line[len(last_line_of_prompt):] self.recall(line) return "break" # If we're between the beginning of the line and the iomark, i.e. # in the prompt area, move to the end of the prompt if self.text.compare("insert", "<", "iomark"): self.text.mark_set("insert", "iomark") # If we're in the current input and there's only whitespace # beyond the cursor, erase that whitespace first s = self.text.get("insert", "end-1c") if s and not s.strip(): self.text.delete("insert", "end-1c") # If we're in the current input before its last line, # insert a newline right at the insert point if self.text.compare("insert", "<", "end-1c linestart"): self.newline_and_indent_event(event) return "break" # We're in the last line; append a newline and submit it self.text.mark_set("insert", "end-1c") if self.reading: self.text.insert("insert", "\n") self.text.see("insert") else: self.newline_and_indent_event(event) self.text.tag_add("stdin", "iomark", "end-1c") self.text.update_idletasks() if self.reading: self.top.quit() # Break out of recursive mainloop() in raw_input() else: self.runit() return "break" |
self.recall(line) | self.recall(line, event) | def enter_callback(self, event): if self.executing and not self.reading: return # Let the default binding (insert '\n') take over # If some text is selected, recall the selection # (but only if this before the I/O mark) try: sel = self.text.get("sel.first", "sel.last") if sel: if self.text.compare("sel.last", "<=", "iomark"): self.recall(sel) return "break" except: pass # If we're strictly before the line containing iomark, recall # the current line, less a leading prompt, less leading or # trailing whitespace if self.text.compare("insert", "<", "iomark linestart"): # Check if there's a relevant stdin range -- if so, use it prev = self.text.tag_prevrange("stdin", "insert") if prev and self.text.compare("insert", "<", prev[1]): self.recall(self.text.get(prev[0], prev[1])) return "break" next = self.text.tag_nextrange("stdin", "insert") if next and self.text.compare("insert lineend", ">=", next[0]): self.recall(self.text.get(next[0], next[1])) return "break" # No stdin mark -- just get the current line, less any prompt line = self.text.get("insert linestart", "insert lineend") last_line_of_prompt = sys.ps1.split('\n')[-1] if line.startswith(last_line_of_prompt): line = line[len(last_line_of_prompt):] self.recall(line) return "break" # If we're between the beginning of the line and the iomark, i.e. # in the prompt area, move to the end of the prompt if self.text.compare("insert", "<", "iomark"): self.text.mark_set("insert", "iomark") # If we're in the current input and there's only whitespace # beyond the cursor, erase that whitespace first s = self.text.get("insert", "end-1c") if s and not s.strip(): self.text.delete("insert", "end-1c") # If we're in the current input before its last line, # insert a newline right at the insert point if self.text.compare("insert", "<", "end-1c linestart"): self.newline_and_indent_event(event) return "break" # We're in the last line; append a newline and submit it self.text.mark_set("insert", "end-1c") if self.reading: self.text.insert("insert", "\n") self.text.see("insert") else: self.newline_and_indent_event(event) self.text.tag_add("stdin", "iomark", "end-1c") self.text.update_idletasks() if self.reading: self.top.quit() # Break out of recursive mainloop() in raw_input() else: self.runit() return "break" |
def recall(self, s): if self.history: self.history.recall(s) | def recall(self, s, event): self.text.undo_block_start() try: self.text.tag_remove("sel", "1.0", "end") self.text.mark_set("insert", "end-1c") s = s.strip() lines = s.split('\n') if lines: prefix = self.text.get("insert linestart","insert").rstrip() if prefix and prefix[-1]==':': self.newline_and_indent_event(event) self.text.insert("insert",lines[0].strip()) if len(lines) > 1: self.newline_and_indent_event(event) for line in lines[1:]: self.text.insert("insert", line.strip()) self.newline_and_indent_event(event) else: self.text.insert("insert", s) finally: self.text.see("insert") self.text.undo_block_stop() | def recall(self, s): if self.history: self.history.recall(s) |
if pathname and pathname[0] == '/': | if not pathname: return pathname if pathname[0] == '/': | def convert_path (pathname): """Return 'pathname' as a name that will work on the native filesystem, i.e. split it on '/' and put it back together again using the current directory separator. Needed because filenames in the setup script are always supplied in Unix style, and have to be converted to the local convention before we can actually use them in the filesystem. Raises ValueError on non-Unix-ish systems if 'pathname' either starts or ends with a slash. """ if os.sep == '/': return pathname if pathname and pathname[0] == '/': raise ValueError, "path '%s' cannot be absolute" % pathname if pathname and pathname[-1] == '/': raise ValueError, "path '%s' cannot end with '/'" % pathname paths = string.split(pathname, '/') while '.' in paths: paths.remove('.') if not paths: return os.curdir return apply(os.path.join, paths) |
if pathname and pathname[-1] == '/': | if pathname[-1] == '/': | def convert_path (pathname): """Return 'pathname' as a name that will work on the native filesystem, i.e. split it on '/' and put it back together again using the current directory separator. Needed because filenames in the setup script are always supplied in Unix style, and have to be converted to the local convention before we can actually use them in the filesystem. Raises ValueError on non-Unix-ish systems if 'pathname' either starts or ends with a slash. """ if os.sep == '/': return pathname if pathname and pathname[0] == '/': raise ValueError, "path '%s' cannot be absolute" % pathname if pathname and pathname[-1] == '/': raise ValueError, "path '%s' cannot end with '/'" % pathname paths = string.split(pathname, '/') while '.' in paths: paths.remove('.') if not paths: return os.curdir return apply(os.path.join, paths) |
tag = self._command(name, mailbox, flags, date_time, message) return self._command_complete(name, tag) | return self._simple_command(name, mailbox, flags, date_time, message) | def append(self, mailbox, flags, date_time, message): """Append message to named mailbox. |
return code, self.untagged_responses.get(code, [None]) | return self._untagged_response(code, code) | def response(self, code): """Return data for response 'code' if received, or None. |
for r in ('EXISTS', 'READ-WRITE'): if self.untagged_responses.has_key(r): del self.untagged_responses[r] | self.untagged_responses = {} | def select(self, mailbox='INBOX', readonly=None): """Select a mailbox. |
command = '%s %s' % (command, flag_list) typ, dat = self._simple_command('STORE', message_set, command) | typ, dat = self._simple_command('STORE', message_set, command, flag_list) | def store(self, message_set, command, flag_list): """Alters flag dispositions for messages in mailbox. |
def uid(self, command, args): """Execute "command args" with messages identified by UID, | def uid(self, command, *args): """Execute "command arg ..." with messages identified by UID, | def uid(self, command, args): """Execute "command args" with messages identified by UID, rather than message number. |
(typ, [data]) = <instance>.uid(command, args) | (typ, [data]) = <instance>.uid(command, arg1, arg2, ...) | def uid(self, command, args): """Execute "command args" with messages identified by UID, rather than message number. |
typ, dat = self._simple_command('UID', command, args) | typ, dat = apply(self._simple_command, ('UID', command) + args) | def uid(self, command, args): """Execute "command args" with messages identified by UID, rather than message number. |
def xatom(self, name, arg1=None, arg2=None): | def xatom(self, name, *args): | def xatom(self, name, arg1=None, arg2=None): """Allow simple extension commands notified by server in CAPABILITY response. |
(typ, [data]) = <instance>.xatom(name, arg1=None, arg2=None) | (typ, [data]) = <instance>.xatom(name, arg, ...) | def xatom(self, name, arg1=None, arg2=None): """Allow simple extension commands notified by server in CAPABILITY response. |
return self._simple_command(name, arg1, arg2) | return apply(self._simple_command, (name,) + args) | def xatom(self, name, arg1=None, arg2=None): """Allow simple extension commands notified by server in CAPABILITY response. |
if d is not None: data = '%s %s' % (data, d) | if d is None: continue if type(d) is type(''): l = len(string.split(d)) else: l = 1 if l == 0 or l > 1 and (d[0],d[-1]) not in (('(',')'),('"','"')): data = '%s "%s"' % (data, d) else: data = '%s %s' % (data, d) | def _command(self, name, dat1=None, dat2=None, dat3=None, literal=None): |
resp = self._get_line()[:-2] | resp = self._get_line() | def _get_response(self): |
dat = self._get_line()[:-2] | dat = self._get_line() | def _get_response(self): |
print '\t< %s' % line[:-2] | print '\t< %s' % line | def _get_line(self): |
def _simple_command(self, name, dat1=None, dat2=None): return self._command_complete(name, self._command(name, dat1, dat2)) | def _simple_command(self, name, *args): return self._command_complete(name, apply(self._command, (name,) + args)) | def _simple_command(self, name, dat1=None, dat2=None): |
('create', ('/tmp/xxx',)), ('rename', ('/tmp/xxx', '/tmp/yyy')), ('CREATE', ('/tmp/yyz',)), ('append', ('/tmp/yyz', None, None, 'From: [email protected]\n\ndata...')), ('select', ('/tmp/yyz',)), ('recent', ()), | ('create', ('/tmp/xxx 1',)), ('rename', ('/tmp/xxx 1', '/tmp/yyy')), ('CREATE', ('/tmp/yyz 2',)), ('append', ('/tmp/yyz 2', None, None, 'From: [email protected]\n\ndata...')), ('select', ('/tmp/yyz 2',)), | def Time2Internaldate(date_time): """Convert 'date_time' to IMAP4 INTERNALDATE representation. Return string in form: '"DD-Mmm-YYYY HH:MM:SS +HHMM"' """ dttype = type(date_time) if dttype is type(1): tt = time.localtime(date_time) elif dttype is type(()): tt = date_time elif dttype is type(""): return date_time # Assume in correct format else: raise ValueError dt = time.strftime("%d-%b-%Y %H:%M:%S", tt) if dt[0] == '0': dt = ' ' + dt[1:] if time.daylight and tt[-1]: zone = -time.altzone else: zone = -time.timezone return '"' + dt + " %+02d%02d" % divmod(zone/60, 60) + '"' |
('response', ('EXISTS',)), | def Time2Internaldate(date_time): """Convert 'date_time' to IMAP4 INTERNALDATE representation. Return string in form: '"DD-Mmm-YYYY HH:MM:SS +HHMM"' """ dttype = type(date_time) if dttype is type(1): tt = time.localtime(date_time) elif dttype is type(()): tt = date_time elif dttype is type(""): return date_time # Assume in correct format else: raise ValueError dt = time.strftime("%d-%b-%Y %H:%M:%S", tt) if dt[0] == '0': dt = ' ' + dt[1:] if time.daylight and tt[-1]: zone = -time.altzone else: zone = -time.timezone return '"' + dt + " %+02d%02d" % divmod(zone/60, 60) + '"' |
|
path = string.split(ml)[-1] | mo = re.match(r'.*"([^"]+)"$', ml) if mo: path = mo.group(1) else: path = string.split(ml)[-1] | def run(cmd, args): typ, dat = apply(eval('M.%s' % cmd), args) print ' %s %s\n => %s %s' % (cmd, args, typ, dat) return dat |
run('uid', ('FETCH', '%s (FLAGS INTERNALDATE RFC822.SIZE RFC822.HEADER RFC822)' % uid)) | run('uid', ('FETCH', '%s' % uid, '(FLAGS INTERNALDATE RFC822.SIZE RFC822.HEADER RFC822)')) | def run(cmd, args): typ, dat = apply(eval('M.%s' % cmd), args) print ' %s %s\n => %s %s' % (cmd, args, typ, dat) return dat |
exception = ['<p>%s: %s' % (strong(str(etype)), str(evalue))] | exception = ['<p>%s: %s' % (strong(pydoc.html.escape(str(etype))), pydoc.html.escape(str(evalue)))] | def reader(lnum=[lnum]): highlight[lnum[0]] = 1 try: return linecache.getline(file, lnum[0]) finally: lnum[0] += 1 |
g = {'c': 0, '__builtins__': __builtins__} | import __builtin__ g = {'c': 0, '__builtins__': __builtin__} | def break_yolks(self): self.yolks = self.yolks - 2 |
print 'new.code()' d = new.code(3, 3, 3, 3, codestr, (), (), (), "<string>", "<name>", 1, "", (), ()) d = new.code(3, 3, 3, 3, codestr, (), (), (), "<string>", "<name>", 1, "") if verbose: print d | if hasattr(new, 'code'): print 'new.code()' d = new.code(3, 3, 3, 3, codestr, (), (), (), "<string>", "<name>", 1, "", (), ()) d = new.code(3, 3, 3, 3, codestr, (), (), (), "<string>", "<name>", 1, "") if verbose: print d | def break_yolks(self): self.yolks = self.yolks - 2 |
self.ofp.write(struct.pack('>h', self.crc)) | if self.crc < 0: fmt = '>h' else: fmt = '>H' self.ofp.write(struct.pack(fmt, self.crc)) | def _writecrc(self): # XXXX Should this be here?? # self.crc = binascii.crc_hqx('\0\0', self.crc) self.ofp.write(struct.pack('>h', self.crc)) self.crc = 0 |
if (inspect.getmodule(value) or object) is object: | if (all is not None or (inspect.getmodule(value) or object) is object): | def docmodule(self, object, name=None, mod=None, *ignored): """Produce HTML documentation for a module object.""" name = object.__name__ # ignore the passed-in name try: all = object.__all__ except AttributeError: all = None parts = split(name, '.') links = [] for i in range(len(parts)-1): links.append( '<a href="%s.html"><font color="#ffffff">%s</font></a>' % (join(parts[:i+1], '.'), parts[i])) linkedname = join(links + parts[-1:], '.') head = '<big><big><strong>%s</strong></big></big>' % linkedname try: path = inspect.getabsfile(object) url = path if sys.platform == 'win32': import nturl2path url = nturl2path.pathname2url(path) filelink = '<a href="file:%s">%s</a>' % (url, path) except TypeError: filelink = '(built-in)' info = [] if hasattr(object, '__version__'): version = str(object.__version__) if version[:11] == '$' + 'Revision: ' and version[-1:] == '$': version = strip(version[11:-1]) info.append('version %s' % self.escape(version)) if hasattr(object, '__date__'): info.append(self.escape(str(object.__date__))) if info: head = head + ' (%s)' % join(info, ', ') docloc = self.getdocloc(object) if docloc is not None: docloc = '<br><a href="%(docloc)s">Module Docs</a>' % locals() else: docloc = '' result = self.heading( head, '#ffffff', '#7799ee', '<a href=".">index</a><br>' + filelink + docloc) |
if inspect.isbuiltin(value) or inspect.getmodule(value) is object: | if (all is not None or inspect.isbuiltin(value) or inspect.getmodule(value) is object): | def docmodule(self, object, name=None, mod=None, *ignored): """Produce HTML documentation for a module object.""" name = object.__name__ # ignore the passed-in name try: all = object.__all__ except AttributeError: all = None parts = split(name, '.') links = [] for i in range(len(parts)-1): links.append( '<a href="%s.html"><font color="#ffffff">%s</font></a>' % (join(parts[:i+1], '.'), parts[i])) linkedname = join(links + parts[-1:], '.') head = '<big><big><strong>%s</strong></big></big>' % linkedname try: path = inspect.getabsfile(object) url = path if sys.platform == 'win32': import nturl2path url = nturl2path.pathname2url(path) filelink = '<a href="file:%s">%s</a>' % (url, path) except TypeError: filelink = '(built-in)' info = [] if hasattr(object, '__version__'): version = str(object.__version__) if version[:11] == '$' + 'Revision: ' and version[-1:] == '$': version = strip(version[11:-1]) info.append('version %s' % self.escape(version)) if hasattr(object, '__date__'): info.append(self.escape(str(object.__date__))) if info: head = head + ' (%s)' % join(info, ', ') docloc = self.getdocloc(object) if docloc is not None: docloc = '<br><a href="%(docloc)s">Module Docs</a>' % locals() else: docloc = '' result = self.heading( head, '#ffffff', '#7799ee', '<a href=".">index</a><br>' + filelink + docloc) |
if (inspect.getmodule(value) or object) is object: | if (all is not None or (inspect.getmodule(value) or object) is object): | def docmodule(self, object, name=None, mod=None): """Produce text documentation for a given module object.""" name = object.__name__ # ignore the passed-in name synop, desc = splitdoc(getdoc(object)) result = self.section('NAME', name + (synop and ' - ' + synop)) |
if inspect.isbuiltin(value) or inspect.getmodule(value) is object: | if (all is not None or inspect.isbuiltin(value) or inspect.getmodule(value) is object): | def docmodule(self, object, name=None, mod=None): """Produce text documentation for a given module object.""" name = object.__name__ # ignore the passed-in name synop, desc = splitdoc(getdoc(object)) result = self.section('NAME', name + (synop and ' - ' + synop)) |
self.wfile = StringIO.StringIO(self.packet) | self.wfile = StringIO.StringIO() | def setup(self): import StringIO self.packet, self.socket = self.request self.rfile = StringIO.StringIO(self.packet) self.wfile = StringIO.StringIO(self.packet) |
print 'XX', dst, '->', (head, tail) | def mkdirs(dst): """Make directories leading to 'dst' if they don't exist yet""" if dst == '' or os.path.exists(dst): return head, tail = os.path.split(dst) print 'XX', dst, '->', (head, tail) # XXXX Is this a bug in os.path.split? if not ':' in head: head = head + ':' mkdirs(head) os.mkdir(dst, 0777) |
|
push('<dl><dt><strong>%s</strong></dt>\n' % name) if value.__doc__ is not None: doc = self.markup(value.__doc__, self.preformat, funcs, classes, mdict) push('<dd><tt>%s</tt></dd>\n' % doc) for attr, tag in [('fget', '<em>get</em>'), ('fset', '<em>set</em>'), ('fdel', '<em>delete</em>')]: func = getattr(value, attr) if func is not None: base = self.document(func, tag, mod, funcs, classes, mdict, object) push('<dd>%s</dd>\n' % base) push('</dl>\n') | push(self._docproperty(name, value, mod)) | def spillproperties(msg, attrs, predicate): ok, attrs = _split_list(attrs, predicate) if ok: hr.maybe() push(msg) for name, kind, homecls, value in ok: push('<dl><dt><strong>%s</strong></dt>\n' % name) if value.__doc__ is not None: doc = self.markup(value.__doc__, self.preformat, funcs, classes, mdict) push('<dd><tt>%s</tt></dd>\n' % doc) for attr, tag in [('fget', '<em>get</em>'), ('fset', '<em>set</em>'), ('fdel', '<em>delete</em>')]: func = getattr(value, attr) if func is not None: base = self.document(func, tag, mod, funcs, classes, mdict, object) push('<dd>%s</dd>\n' % base) push('</dl>\n') return attrs |
push(name) need_blank_after_doc = 0 doc = getdoc(value) or '' if doc: push(self.indent(doc)) need_blank_after_doc = 1 for attr, tag in [('fget', '<get>'), ('fset', '<set>'), ('fdel', '<delete>')]: func = getattr(value, attr) if func is not None: if need_blank_after_doc: push('') need_blank_after_doc = 0 base = self.document(func, tag, mod) push(self.indent(base)) | push(self._docproperty(name, value, mod)) | def spillproperties(msg, attrs, predicate): ok, attrs = _split_list(attrs, predicate) if ok: hr.maybe() push(msg) for name, kind, homecls, value in ok: push(name) need_blank_after_doc = 0 doc = getdoc(value) or '' if doc: push(self.indent(doc)) need_blank_after_doc = 1 for attr, tag in [('fget', '<get>'), ('fset', '<set>'), ('fdel', '<delete>')]: func = getattr(value, attr) if func is not None: if need_blank_after_doc: push('') need_blank_after_doc = 0 base = self.document(func, tag, mod) push(self.indent(base)) return attrs |
path = unquote(path) | def ftp_open(self, req): host = req.get_host() if not host: raise IOError, ('ftp error', 'no host given') # XXX handle custom username & password try: host = socket.gethostbyname(host) except socket.error, msg: raise URLError(msg) host, port = splitport(host) if port is None: port = ftplib.FTP_PORT path, attrs = splitattr(req.get_selector()) path = unquote(path) dirs = path.split('/') dirs, file = dirs[:-1], dirs[-1] if dirs and not dirs[0]: dirs = dirs[1:] user = passwd = '' # XXX try: fw = self.connect_ftp(user, passwd, host, port, dirs) type = file and 'I' or 'D' for attr in attrs: attr, value = splitattr(attr) if attr.lower() == 'type' and \ value in ('a', 'A', 'i', 'I', 'd', 'D'): type = value.upper() fp, retrlen = fw.retrfile(file, type) headers = "" mtype = mimetypes.guess_type(req.get_full_url())[0] if mtype: headers += "Content-type: %s\n" % mtype if retrlen is not None and retrlen >= 0: headers += "Content-length: %d\n" % retrlen sf = StringIO(headers) headers = mimetools.Message(sf) return addinfourl(fp, headers, req.get_full_url()) except ftplib.all_errors, msg: raise IOError, ('ftp error', msg), sys.exc_info()[2] |
|
r, w, x = select.select([self.fileno()], [], [], timeout) | elapsed = time() - time_start if elapsed >= timeout: break s_args = ([self.fileno()], [], [], timeout-elapsed) r, w, x = select.select(*s_args) | def expect(self, list, timeout=None): """Read until one from a list of a regular expressions matches. |
(string.capitalize(name), data)) lines.append("%s=%s" % (name, repr(data)[1:-1])) | (string.capitalize(name), escape(data))) lines.append("%s=%s" % (name, escape(data))) | def get_inidata (self): # Return data describing the installation. |
lines.append("info=%s" % repr(info)[1:-1]) | lines.append("info=%s" % escape(info)) | def get_inidata (self): # Return data describing the installation. |
lines.append("title=%s" % repr(title)[1:-1]) | lines.append("title=%s" % escape(title)) | def get_inidata (self): # Return data describing the installation. |
if chunks[0].strip() == '': | if chunks[0].strip() == '' and lines: | def _wrap_chunks(self, chunks): """_wrap_chunks(chunks : [string]) -> [string] |
def _init_posix(): import os import re import string import sys | def _init_posix(): import os import re import string import sys g = globals() version = sys.version[:3] config_dir = os.path.join( sys.exec_prefix, "lib", "python" + version, "config") # load the installed config.h: define_rx = re.compile("#define ([A-Z][A-Z0-9_]+) (.*)\n") undef_rx = re.compile("/[*] #undef ([A-Z][A-Z0-9_]+) [*]/\n") fp = open(os.path.join(config_dir, "config.h")) while 1: line = fp.readline() if not line: break m = define_rx.match(line) if m: n, v = m.group(1, 2) try: v = string.atoi(v) except ValueError: pass g[n] = v else: m = undef_rx.match(line) if m: g[m.group(1)] = 0 # load the installed Makefile.pre.in: variable_rx = re.compile("([a-zA-Z][a-zA-Z0-9_]+)\s*=\s*(.*)\n") done = {} notdone = {} fp = open(os.path.join(config_dir, "Makefile")) while 1: line = fp.readline() if not line: break m = variable_rx.match(line) if m: n, v = m.group(1, 2) v = string.strip(v) if "$" in v: notdone[n] = v else: try: v = string.atoi(v) except ValueError: pass done[n] = v # do variable interpolation here findvar1_rx = re.compile(r"\$\(([A-Za-z][A-Za-z0-9_]*)\)") findvar2_rx = re.compile(r"\${([A-Za-z][A-Za-z0-9_]*)}") while notdone: for name in notdone.keys(): value = notdone[name] m = findvar1_rx.search(value) if not m: m = findvar2_rx.search(value) if m: n = m.group(1) if done.has_key(n): after = value[m.end():] value = value[:m.start()] + done[n] + after if "$" in after: notdone[name] = value else: try: value = string.atoi(value) except ValueError: pass done[name] = string.strip(value) del notdone[name] elif notdone.has_key(n): # get it on a subsequent round pass else: done[n] = "" after = value[m.end():] value = value[:m.start()] + after if "$" in after: notdone[name] = value else: try: value = string.atoi(value) except ValueError: pass done[name] = string.strip(value) del notdone[name] else: # bogus variable reference; just drop it since we can't deal del notdone[name] # save the results in the global dictionary g.update(done) |
|
g = globals() | def get_config_h_filename(): return os.path.join(sys.exec_prefix, "lib", "python" + sys.version[:3], "config", "config.h") | def _init_posix(): import os import re import string import sys g = globals() version = sys.version[:3] config_dir = os.path.join( sys.exec_prefix, "lib", "python" + version, "config") # load the installed config.h: define_rx = re.compile("#define ([A-Z][A-Z0-9_]+) (.*)\n") undef_rx = re.compile("/[*] #undef ([A-Z][A-Z0-9_]+) [*]/\n") fp = open(os.path.join(config_dir, "config.h")) while 1: line = fp.readline() if not line: break m = define_rx.match(line) if m: n, v = m.group(1, 2) try: v = string.atoi(v) except ValueError: pass g[n] = v else: m = undef_rx.match(line) if m: g[m.group(1)] = 0 # load the installed Makefile.pre.in: variable_rx = re.compile("([a-zA-Z][a-zA-Z0-9_]+)\s*=\s*(.*)\n") done = {} notdone = {} fp = open(os.path.join(config_dir, "Makefile")) while 1: line = fp.readline() if not line: break m = variable_rx.match(line) if m: n, v = m.group(1, 2) v = string.strip(v) if "$" in v: notdone[n] = v else: try: v = string.atoi(v) except ValueError: pass done[n] = v # do variable interpolation here findvar1_rx = re.compile(r"\$\(([A-Za-z][A-Za-z0-9_]*)\)") findvar2_rx = re.compile(r"\${([A-Za-z][A-Za-z0-9_]*)}") while notdone: for name in notdone.keys(): value = notdone[name] m = findvar1_rx.search(value) if not m: m = findvar2_rx.search(value) if m: n = m.group(1) if done.has_key(n): after = value[m.end():] value = value[:m.start()] + done[n] + after if "$" in after: notdone[name] = value else: try: value = string.atoi(value) except ValueError: pass done[name] = string.strip(value) del notdone[name] elif notdone.has_key(n): # get it on a subsequent round pass else: done[n] = "" after = value[m.end():] value = value[:m.start()] + after if "$" in after: notdone[name] = value else: try: value = string.atoi(value) except ValueError: pass done[name] = string.strip(value) del notdone[name] else: # bogus variable reference; just drop it since we can't deal del notdone[name] # save the results in the global dictionary g.update(done) |
version = sys.version[:3] config_dir = os.path.join( sys.exec_prefix, "lib", "python" + version, "config") | def get_makefile_filename(): return os.path.join(sys.exec_prefix, "lib", "python" + sys.version[:3], "config", "Makefile") | def _init_posix(): import os import re import string import sys g = globals() version = sys.version[:3] config_dir = os.path.join( sys.exec_prefix, "lib", "python" + version, "config") # load the installed config.h: define_rx = re.compile("#define ([A-Z][A-Z0-9_]+) (.*)\n") undef_rx = re.compile("/[*] #undef ([A-Z][A-Z0-9_]+) [*]/\n") fp = open(os.path.join(config_dir, "config.h")) while 1: line = fp.readline() if not line: break m = define_rx.match(line) if m: n, v = m.group(1, 2) try: v = string.atoi(v) except ValueError: pass g[n] = v else: m = undef_rx.match(line) if m: g[m.group(1)] = 0 # load the installed Makefile.pre.in: variable_rx = re.compile("([a-zA-Z][a-zA-Z0-9_]+)\s*=\s*(.*)\n") done = {} notdone = {} fp = open(os.path.join(config_dir, "Makefile")) while 1: line = fp.readline() if not line: break m = variable_rx.match(line) if m: n, v = m.group(1, 2) v = string.strip(v) if "$" in v: notdone[n] = v else: try: v = string.atoi(v) except ValueError: pass done[n] = v # do variable interpolation here findvar1_rx = re.compile(r"\$\(([A-Za-z][A-Za-z0-9_]*)\)") findvar2_rx = re.compile(r"\${([A-Za-z][A-Za-z0-9_]*)}") while notdone: for name in notdone.keys(): value = notdone[name] m = findvar1_rx.search(value) if not m: m = findvar2_rx.search(value) if m: n = m.group(1) if done.has_key(n): after = value[m.end():] value = value[:m.start()] + done[n] + after if "$" in after: notdone[name] = value else: try: value = string.atoi(value) except ValueError: pass done[name] = string.strip(value) del notdone[name] elif notdone.has_key(n): # get it on a subsequent round pass else: done[n] = "" after = value[m.end():] value = value[:m.start()] + after if "$" in after: notdone[name] = value else: try: value = string.atoi(value) except ValueError: pass done[name] = string.strip(value) del notdone[name] else: # bogus variable reference; just drop it since we can't deal del notdone[name] # save the results in the global dictionary g.update(done) |
def parse_config_h(fp, g=None): if g is None: g = {} | def _init_posix(): import os import re import string import sys g = globals() version = sys.version[:3] config_dir = os.path.join( sys.exec_prefix, "lib", "python" + version, "config") # load the installed config.h: define_rx = re.compile("#define ([A-Z][A-Z0-9_]+) (.*)\n") undef_rx = re.compile("/[*] #undef ([A-Z][A-Z0-9_]+) [*]/\n") fp = open(os.path.join(config_dir, "config.h")) while 1: line = fp.readline() if not line: break m = define_rx.match(line) if m: n, v = m.group(1, 2) try: v = string.atoi(v) except ValueError: pass g[n] = v else: m = undef_rx.match(line) if m: g[m.group(1)] = 0 # load the installed Makefile.pre.in: variable_rx = re.compile("([a-zA-Z][a-zA-Z0-9_]+)\s*=\s*(.*)\n") done = {} notdone = {} fp = open(os.path.join(config_dir, "Makefile")) while 1: line = fp.readline() if not line: break m = variable_rx.match(line) if m: n, v = m.group(1, 2) v = string.strip(v) if "$" in v: notdone[n] = v else: try: v = string.atoi(v) except ValueError: pass done[n] = v # do variable interpolation here findvar1_rx = re.compile(r"\$\(([A-Za-z][A-Za-z0-9_]*)\)") findvar2_rx = re.compile(r"\${([A-Za-z][A-Za-z0-9_]*)}") while notdone: for name in notdone.keys(): value = notdone[name] m = findvar1_rx.search(value) if not m: m = findvar2_rx.search(value) if m: n = m.group(1) if done.has_key(n): after = value[m.end():] value = value[:m.start()] + done[n] + after if "$" in after: notdone[name] = value else: try: value = string.atoi(value) except ValueError: pass done[name] = string.strip(value) del notdone[name] elif notdone.has_key(n): # get it on a subsequent round pass else: done[n] = "" after = value[m.end():] value = value[:m.start()] + after if "$" in after: notdone[name] = value else: try: value = string.atoi(value) except ValueError: pass done[name] = string.strip(value) del notdone[name] else: # bogus variable reference; just drop it since we can't deal del notdone[name] # save the results in the global dictionary g.update(done) |
|
fp = open(os.path.join(config_dir, "config.h")) | undef_rx = re.compile("/[*] #undef ([A-Z][A-Z0-9_]+) [*]/\n") |
|
def parse_makefile(fp, g=None): if g is None: g = {} | undef_rx = re.compile("/[*] #undef ([A-Z][A-Z0-9_]+) [*]/\n") |
|
fp = open(os.path.join(config_dir, "Makefile")) | undef_rx = re.compile("/[*] #undef ([A-Z][A-Z0-9_]+) [*]/\n") |
|
import os exec "_init_%s()" % os.name del os | def _init_posix(): g = globals() parse_config_h(open(get_config_h_filename()), g) parse_makefile(open(get_makefile_filename()), g) try: exec "_init_" + os.name except NameError: pass else: exec "_init_%s()" % os.name | undef_rx = re.compile("/[*] #undef ([A-Z][A-Z0-9_]+) [*]/\n") |
assert "'" not in action cmd = "kfmclient '%s' >/dev/null 2>&1" % action | cmd = "kfmclient %s >/dev/null 2>&1" % action | def _remote(self, action): assert "'" not in action cmd = "kfmclient '%s' >/dev/null 2>&1" % action rc = os.system(cmd) if rc: import time if self.basename == "konqueror": os.system(self.name + " --silent &") else: os.system(self.name + " -d &") time.sleep(PROCESS_CREATION_DELAY) rc = os.system(cmd) return not rc |
if code != 200: | if code not in (200, 206): | def http_response(self, request, response): code, msg, hdrs = response.code, response.msg, response.info() |
if r.status == 200: | if r.status in (200, 206): | def do_open(self, http_class, req): """Return an addinfourl object for the request, using http_class. |
if parent: self.badmodules[fqname][parent.__name__] = None | def import_module(self, partname, fqname, parent): self.msgin(3, "import_module", partname, fqname, parent) try: m = self.modules[fqname] except KeyError: pass else: self.msgout(3, "import_module ->", m) return m if self.badmodules.has_key(fqname): self.msgout(3, "import_module -> None") if parent: self.badmodules[fqname][parent.__name__] = None return None try: fp, pathname, stuff = self.find_module(partname, parent and parent.__path__) except ImportError: self.msgout(3, "import_module ->", None) return None try: m = self.load_module(fqname, fp, pathname, stuff) finally: if fp: fp.close() if parent: setattr(parent, partname, m) self.msgout(3, "import_module ->", m) return m |
|
lastname = None | fromlist = None | def scan_code(self, co, m): code = co.co_code n = len(code) i = 0 lastname = None while i < n: c = code[i] i = i+1 op = ord(c) if op >= dis.HAVE_ARGUMENT: oparg = ord(code[i]) + ord(code[i+1])*256 i = i+2 if op == IMPORT_NAME: name = lastname = co.co_names[oparg] if not self.badmodules.has_key(lastname): try: self.import_hook(name, m) except ImportError, msg: self.msg(2, "ImportError:", str(msg)) if not self.badmodules.has_key(name): self.badmodules[name] = {} self.badmodules[name][m.__name__] = None elif op == IMPORT_FROM: name = co.co_names[oparg] assert lastname is not None if not self.badmodules.has_key(lastname): try: self.import_hook(lastname, m, [name]) except ImportError, msg: self.msg(2, "ImportError:", str(msg)) fullname = lastname + "." + name if not self.badmodules.has_key(fullname): self.badmodules[fullname] = {} self.badmodules[fullname][m.__name__] = None elif op in STORE_OPS: # Skip; each IMPORT_FROM is followed by a STORE_* opcode pass else: lastname = None for c in co.co_consts: if isinstance(c, type(co)): self.scan_code(c, m) |
if op == IMPORT_NAME: name = lastname = co.co_names[oparg] if not self.badmodules.has_key(lastname): try: self.import_hook(name, m) except ImportError, msg: self.msg(2, "ImportError:", str(msg)) if not self.badmodules.has_key(name): self.badmodules[name] = {} self.badmodules[name][m.__name__] = None elif op == IMPORT_FROM: | if op == LOAD_CONST: fromlist = co.co_consts[oparg] elif op == IMPORT_NAME: assert fromlist is None or type(fromlist) is tuple | def scan_code(self, co, m): code = co.co_code n = len(code) i = 0 lastname = None while i < n: c = code[i] i = i+1 op = ord(c) if op >= dis.HAVE_ARGUMENT: oparg = ord(code[i]) + ord(code[i+1])*256 i = i+2 if op == IMPORT_NAME: name = lastname = co.co_names[oparg] if not self.badmodules.has_key(lastname): try: self.import_hook(name, m) except ImportError, msg: self.msg(2, "ImportError:", str(msg)) if not self.badmodules.has_key(name): self.badmodules[name] = {} self.badmodules[name][m.__name__] = None elif op == IMPORT_FROM: name = co.co_names[oparg] assert lastname is not None if not self.badmodules.has_key(lastname): try: self.import_hook(lastname, m, [name]) except ImportError, msg: self.msg(2, "ImportError:", str(msg)) fullname = lastname + "." + name if not self.badmodules.has_key(fullname): self.badmodules[fullname] = {} self.badmodules[fullname][m.__name__] = None elif op in STORE_OPS: # Skip; each IMPORT_FROM is followed by a STORE_* opcode pass else: lastname = None for c in co.co_consts: if isinstance(c, type(co)): self.scan_code(c, m) |
assert lastname is not None if not self.badmodules.has_key(lastname): try: self.import_hook(lastname, m, [name]) except ImportError, msg: self.msg(2, "ImportError:", str(msg)) fullname = lastname + "." + name if not self.badmodules.has_key(fullname): self.badmodules[fullname] = {} self.badmodules[fullname][m.__name__] = None | have_star = 0 if fromlist is not None: if "*" in fromlist: have_star = 1 fromlist = [f for f in fromlist if f != "*"] self._safe_import_hook(name, m, fromlist) if have_star: mm = None if m.__path__: mm = self.modules.get(m.__name__ + "." + name) if mm is None: mm = self.modules.get(name) if mm is not None: m.globalnames.update(mm.globalnames) m.starimports.update(mm.starimports) if mm.__code__ is None: m.starimports[name] = 1 else: m.starimports[name] = 1 | def scan_code(self, co, m): code = co.co_code n = len(code) i = 0 lastname = None while i < n: c = code[i] i = i+1 op = ord(c) if op >= dis.HAVE_ARGUMENT: oparg = ord(code[i]) + ord(code[i+1])*256 i = i+2 if op == IMPORT_NAME: name = lastname = co.co_names[oparg] if not self.badmodules.has_key(lastname): try: self.import_hook(name, m) except ImportError, msg: self.msg(2, "ImportError:", str(msg)) if not self.badmodules.has_key(name): self.badmodules[name] = {} self.badmodules[name][m.__name__] = None elif op == IMPORT_FROM: name = co.co_names[oparg] assert lastname is not None if not self.badmodules.has_key(lastname): try: self.import_hook(lastname, m, [name]) except ImportError, msg: self.msg(2, "ImportError:", str(msg)) fullname = lastname + "." + name if not self.badmodules.has_key(fullname): self.badmodules[fullname] = {} self.badmodules[fullname][m.__name__] = None elif op in STORE_OPS: # Skip; each IMPORT_FROM is followed by a STORE_* opcode pass else: lastname = None for c in co.co_consts: if isinstance(c, type(co)): self.scan_code(c, m) |
pass else: lastname = None | name = co.co_names[oparg] m.globalnames[name] = 1 | def scan_code(self, co, m): code = co.co_code n = len(code) i = 0 lastname = None while i < n: c = code[i] i = i+1 op = ord(c) if op >= dis.HAVE_ARGUMENT: oparg = ord(code[i]) + ord(code[i+1])*256 i = i+2 if op == IMPORT_NAME: name = lastname = co.co_names[oparg] if not self.badmodules.has_key(lastname): try: self.import_hook(name, m) except ImportError, msg: self.msg(2, "ImportError:", str(msg)) if not self.badmodules.has_key(name): self.badmodules[name] = {} self.badmodules[name][m.__name__] = None elif op == IMPORT_FROM: name = co.co_names[oparg] assert lastname is not None if not self.badmodules.has_key(lastname): try: self.import_hook(lastname, m, [name]) except ImportError, msg: self.msg(2, "ImportError:", str(msg)) fullname = lastname + "." + name if not self.badmodules.has_key(fullname): self.badmodules[fullname] = {} self.badmodules[fullname][m.__name__] = None elif op in STORE_OPS: # Skip; each IMPORT_FROM is followed by a STORE_* opcode pass else: lastname = None for c in co.co_consts: if isinstance(c, type(co)): self.scan_code(c, m) |
keys = self.badmodules.keys() keys.sort() for key in keys: if key not in self.excludes: mods = self.badmodules[key].keys() | missing, maybe = self.any_missing_maybe() if missing: print print "Missing modules:" for name in missing: mods = self.badmodules[name].keys() | def report(self): print print " %-25s %s" % ("Name", "File") print " %-25s %s" % ("----", "----") # Print modules found keys = self.modules.keys() keys.sort() for key in keys: m = self.modules[key] if m.__path__: print "P", else: print "m", print "%-25s" % key, m.__file__ or "" |
print "?", key, "from", ', '.join(mods) | print "?", name, "imported from", ', '.join(mods) if maybe: print print "Submodules thay appear to be missing, but could also be", print "global names in the parent package:" for name in maybe: mods = self.badmodules[name].keys() mods.sort() print "?", name, "imported from", ', '.join(mods) | def report(self): print print " %-25s %s" % ("Name", "File") print " %-25s %s" % ("----", "----") # Print modules found keys = self.modules.keys() keys.sort() for key in keys: m = self.modules[key] if m.__path__: print "P", else: print "m", print "%-25s" % key, m.__file__ or "" |
keys = self.badmodules.keys() | missing, maybe = self.any_missing_maybe() return missing + maybe def any_missing_maybe(self): """Return two lists, one with modules that are certainly missing and one with modules that *may* be missing. The latter names could either be submodules *or* just global names in the package. The reason it can't always be determined is that it's impossible to tell which names are imported when "from module import *" is done with an extension module, short of actually importing it. """ | def any_missing(self): keys = self.badmodules.keys() missing = [] for key in keys: if key not in self.excludes: # Missing, and its not supposed to be missing.append(key) return missing |
for key in keys: if key not in self.excludes: missing.append(key) return missing | maybe = [] for name in self.badmodules: if name in self.excludes: continue i = name.rfind(".") if i < 0: missing.append(name) continue subname = name[i+1:] pkgname = name[:i] pkg = self.modules.get(pkgname) if pkg is not None: if pkgname in self.badmodules[name]: missing.append(name) elif subname in pkg.globalnames: pass elif pkg.starimports: maybe.append(name) else: missing.append(name) else: missing.append(name) missing.sort() maybe.sort() return missing, maybe | def any_missing(self): keys = self.badmodules.keys() missing = [] for key in keys: if key not in self.excludes: # Missing, and its not supposed to be missing.append(key) return missing |
test() | mf = test() | def test(): # Parse command line import getopt try: opts, args = getopt.getopt(sys.argv[1:], "dmp:qx:") except getopt.error, msg: print msg return # Process options debug = 1 domods = 0 addpath = [] exclude = [] for o, a in opts: if o == '-d': debug = debug + 1 if o == '-m': domods = 1 if o == '-p': addpath = addpath + a.split(os.pathsep) if o == '-q': debug = 0 if o == '-x': exclude.append(a) # Provide default arguments if not args: script = "hello.py" else: script = args[0] # Set the path based on sys.path and the script directory path = sys.path[:] path[0] = os.path.dirname(script) path = addpath + path if debug > 1: print "path:" for item in path: print " ", `item` # Create the module finder and turn its crank mf = ModuleFinder(path, debug, exclude) for arg in args[1:]: if arg == '-m': domods = 1 continue if domods: if arg[-2:] == '.*': mf.import_hook(arg[:-2], None, ["*"]) else: mf.import_hook(arg) else: mf.load_file(arg) mf.run_script(script) mf.report() |
objects = self.object_filenames(sources, 1, outdir) | objects = self.object_filenames(sources, 0, outdir) | def _setup_compile(self, outdir, macros, incdirs, sources, depends, extra): """Process arguments and decide which source files to compile. |
objects = self.object_filenames(sources, strip_dir=1, | objects = self.object_filenames(sources, strip_dir=0, | def _prep_compile(self, sources, output_dir, depends=None): """Decide which souce files must be recompiled. |
" LettError, Erik van Blokland, for the \n" " Python for Windows graphic.\n" " http://www.letterror.com/\n" "\n" | def add_ui(db): x = y = 50 w = 370 h = 300 title = "[ProductName] Setup" # see "Dialog Style Bits" modal = 3 # visible | modal modeless = 1 # visible track_disk_space = 32 add_data(db, 'ActionText', uisample.ActionText) add_data(db, 'UIText', uisample.UIText) # Bitmaps if not os.path.exists(srcdir+r"\PC\python_icon.exe"): raise "Run icons.mak in PC directory" add_data(db, "Binary", [("PythonWin", msilib.Binary(srcdir+r"\PCbuild\installer.bmp")), # 152x328 pixels ("py.ico",msilib.Binary(srcdir+r"\PC\py.ico")), ]) add_data(db, "Icon", [("python_icon.exe", msilib.Binary(srcdir+r"\PC\python_icon.exe"))]) # Scripts # CheckDir sets TargetExists if TARGETDIR exists. # UpdateEditIDLE sets the REGISTRY.tcl component into # the installed/uninstalled state according to both the # Extensions and TclTk features. if os.system("nmake /nologo /c /f msisupport.mak") != 0: raise "'nmake /f msisupport.mak' failed" add_data(db, "Binary", [("Script", msilib.Binary("msisupport.dll"))]) # See "Custom Action Type 1" if msilib.Win64: CheckDir = "CheckDir" UpdateEditIDLE = "UpdateEditIDLE" else: CheckDir = "_CheckDir@4" UpdateEditIDLE = "_UpdateEditIDLE@4" add_data(db, "CustomAction", [("CheckDir", 1, "Script", CheckDir)]) if have_tcl: add_data(db, "CustomAction", [("UpdateEditIDLE", 1, "Script", UpdateEditIDLE)]) # UI customization properties add_data(db, "Property", # See "DefaultUIFont Property" [("DefaultUIFont", "DlgFont8"), # See "ErrorDialog Style Bit" ("ErrorDialog", "ErrorDlg"), ("Progress1", "Install"), # modified in maintenance type dlg ("Progress2", "installs"), ("MaintenanceForm_Action", "Repair")]) # Fonts, see "TextStyle Table" add_data(db, "TextStyle", [("DlgFont8", "Tahoma", 9, None, 0), ("DlgFontBold8", "Tahoma", 8, None, 1), #bold ("VerdanaBold10", "Verdana", 10, None, 1), ("VerdanaRed9", "Verdana", 9, 255, 0), ]) compileargs = r"-Wi [TARGETDIR]Lib\compileall.py -f -x bad_coding|badsyntax|site-packages [TARGETDIR]Lib" # See "CustomAction Table" add_data(db, "CustomAction", [ # msidbCustomActionTypeFirstSequence + msidbCustomActionTypeTextData + msidbCustomActionTypeProperty # See "Custom Action Type 51", # "Custom Action Execution Scheduling Options" ("InitialTargetDir", 307, "TARGETDIR", "[WindowsVolume]Python%s%s" % (major, minor)), ("SetDLLDirToTarget", 307, "DLLDIR", "[TARGETDIR]"), ("SetDLLDirToSystem32", 307, "DLLDIR", SystemFolderName), # msidbCustomActionTypeExe + msidbCustomActionTypeSourceFile # See "Custom Action Type 18" ("CompilePyc", 18, "python.exe", compileargs), ("CompilePyo", 18, "python.exe", "-O "+compileargs), ]) # UI Sequences, see "InstallUISequence Table", "Using a Sequence Table" # Numbers indicate sequence; see sequence.py for how these action integrate add_data(db, "InstallUISequence", [("PrepareDlg", "Not Privileged or Windows9x or Installed", 140), ("WhichUsersDlg", "Privileged and not Windows9x and not Installed", 141), ("InitialTargetDir", 'TARGETDIR=""', 750), # In the user interface, assume all-users installation if privileged. ("SetDLLDirToSystem32", 'DLLDIR="" and ' + sys32cond, 751), ("SetDLLDirToTarget", 'DLLDIR="" and not ' + sys32cond, 752), ("SelectDirectoryDlg", "Not Installed", 1230), # XXX no support for resume installations yet #("ResumeDlg", "Installed AND (RESUME OR Preselected)", 1240), ("MaintenanceTypeDlg", "Installed AND NOT RESUME AND NOT Preselected", 1250), ("ProgressDlg", None, 1280)]) add_data(db, "AdminUISequence", [("InitialTargetDir", 'TARGETDIR=""', 750), ("SetDLLDirToTarget", 'DLLDIR=""', 751), ]) # Execute Sequences add_data(db, "InstallExecuteSequence", [("InitialTargetDir", 'TARGETDIR=""', 750), ("SetDLLDirToSystem32", 'DLLDIR="" and ' + sys32cond, 751), ("SetDLLDirToTarget", 'DLLDIR="" and not ' + sys32cond, 752), ("UpdateEditIDLE", None, 1050), ("CompilePyc", "COMPILEALL", 6800), ("CompilePyo", "COMPILEALL", 6801), ]) add_data(db, "AdminExecuteSequence", [("InitialTargetDir", 'TARGETDIR=""', 750), ("SetDLLDirToTarget", 'DLLDIR=""', 751), ("CompilePyc", "COMPILEALL", 6800), ("CompilePyo", "COMPILEALL", 6801), ]) ##################################################################### # Standard dialogs: FatalError, UserExit, ExitDialog fatal=PyDialog(db, "FatalError", x, y, w, h, modal, title, "Finish", "Finish", "Finish") fatal.title("[ProductName] Installer ended prematurely") fatal.back("< Back", "Finish", active = 0) fatal.cancel("Cancel", "Back", active = 0) fatal.text("Description1", 135, 70, 220, 80, 0x30003, "[ProductName] setup ended prematurely because of an error. Your system has not been modified. To install this program at a later time, please run the installation again.") fatal.text("Description2", 135, 155, 220, 20, 0x30003, "Click the Finish button to exit the Installer.") c=fatal.next("Finish", "Cancel", name="Finish") # See "ControlEvent Table". Parameters are the event, the parameter # to the action, and optionally the condition for the event, and the order # of events. c.event("EndDialog", "Exit") user_exit=PyDialog(db, "UserExit", x, y, w, h, modal, title, "Finish", "Finish", "Finish") user_exit.title("[ProductName] Installer was interrupted") user_exit.back("< Back", "Finish", active = 0) user_exit.cancel("Cancel", "Back", active = 0) user_exit.text("Description1", 135, 70, 220, 80, 0x30003, "[ProductName] setup was interrupted. Your system has not been modified. " "To install this program at a later time, please run the installation again.") user_exit.text("Description2", 135, 155, 220, 20, 0x30003, "Click the Finish button to exit the Installer.") c = user_exit.next("Finish", "Cancel", name="Finish") c.event("EndDialog", "Exit") exit_dialog = PyDialog(db, "ExitDialog", x, y, w, h, modal, title, "Finish", "Finish", "Finish") exit_dialog.title("Completing the [ProductName] Installer") exit_dialog.back("< Back", "Finish", active = 0) exit_dialog.cancel("Cancel", "Back", active = 0) exit_dialog.text("Acknowledgements", 135, 95, 220, 120, 0x30003, "Special Windows thanks to:\n" " LettError, Erik van Blokland, for the \n" " Python for Windows graphic.\n" " http://www.letterror.com/\n" "\n" " Mark Hammond, without whose years of freely \n" " shared Windows expertise, Python for Windows \n" " would still be Python for DOS.") c = exit_dialog.text("warning", 135, 200, 220, 40, 0x30003, "{\\VerdanaRed9}Warning: Python 2.5.x is the last " "Python release for Windows 9x.") c.condition("Hide", "NOT Version9X") exit_dialog.text("Description", 135, 235, 220, 20, 0x30003, "Click the Finish button to exit the Installer.") c = exit_dialog.next("Finish", "Cancel", name="Finish") c.event("EndDialog", "Return") ##################################################################### # Required dialog: FilesInUse, ErrorDlg inuse = PyDialog(db, "FilesInUse", x, y, w, h, 19, # KeepModeless|Modal|Visible title, "Retry", "Retry", "Retry", bitmap=False) inuse.text("Title", 15, 6, 200, 15, 0x30003, r"{\DlgFontBold8}Files in Use") inuse.text("Description", 20, 23, 280, 20, 0x30003, "Some files that need to be updated are currently in use.") inuse.text("Text", 20, 55, 330, 50, 3, "The following applications are using files that need to be updated by this setup. Close these applications and then click Retry to continue the installation or Cancel to exit it.") inuse.control("List", "ListBox", 20, 107, 330, 130, 7, "FileInUseProcess", None, None, None) c=inuse.back("Exit", "Ignore", name="Exit") c.event("EndDialog", "Exit") c=inuse.next("Ignore", "Retry", name="Ignore") c.event("EndDialog", "Ignore") c=inuse.cancel("Retry", "Exit", name="Retry") c.event("EndDialog","Retry") # See "Error Dialog". See "ICE20" for the required names of the controls. error = Dialog(db, "ErrorDlg", 50, 10, 330, 101, 65543, # Error|Minimize|Modal|Visible title, "ErrorText", None, None) error.text("ErrorText", 50,9,280,48,3, "") error.control("ErrorIcon", "Icon", 15, 9, 24, 24, 5242881, None, "py.ico", None, None) error.pushbutton("N",120,72,81,21,3,"No",None).event("EndDialog","ErrorNo") error.pushbutton("Y",240,72,81,21,3,"Yes",None).event("EndDialog","ErrorYes") error.pushbutton("A",0,72,81,21,3,"Abort",None).event("EndDialog","ErrorAbort") error.pushbutton("C",42,72,81,21,3,"Cancel",None).event("EndDialog","ErrorCancel") error.pushbutton("I",81,72,81,21,3,"Ignore",None).event("EndDialog","ErrorIgnore") error.pushbutton("O",159,72,81,21,3,"Ok",None).event("EndDialog","ErrorOk") error.pushbutton("R",198,72,81,21,3,"Retry",None).event("EndDialog","ErrorRetry") ##################################################################### # Global "Query Cancel" dialog cancel = Dialog(db, "CancelDlg", 50, 10, 260, 85, 3, title, "No", "No", "No") cancel.text("Text", 48, 15, 194, 30, 3, "Are you sure you want to cancel [ProductName] installation?") cancel.control("Icon", "Icon", 15, 15, 24, 24, 5242881, None, "py.ico", None, None) c=cancel.pushbutton("Yes", 72, 57, 56, 17, 3, "Yes", "No") c.event("EndDialog", "Exit") c=cancel.pushbutton("No", 132, 57, 56, 17, 3, "No", "Yes") c.event("EndDialog", "Return") ##################################################################### # Global "Wait for costing" dialog costing = Dialog(db, "WaitForCostingDlg", 50, 10, 260, 85, modal, title, "Return", "Return", "Return") costing.text("Text", 48, 15, 194, 30, 3, "Please wait while the installer finishes determining your disk space requirements.") costing.control("Icon", "Icon", 15, 15, 24, 24, 5242881, None, "py.ico", None, None) c = costing.pushbutton("Return", 102, 57, 56, 17, 3, "Return", None) c.event("EndDialog", "Exit") ##################################################################### # Preparation dialog: no user input except cancellation prep = PyDialog(db, "PrepareDlg", x, y, w, h, modeless, title, "Cancel", "Cancel", "Cancel") prep.text("Description", 135, 70, 220, 40, 0x30003, "Please wait while the Installer prepares to guide you through the installation.") prep.title("Welcome to the [ProductName] Installer") c=prep.text("ActionText", 135, 110, 220, 20, 0x30003, "Pondering...") c.mapping("ActionText", "Text") c=prep.text("ActionData", 135, 135, 220, 30, 0x30003, None) c.mapping("ActionData", "Text") prep.back("Back", None, active=0) prep.next("Next", None, active=0) c=prep.cancel("Cancel", None) c.event("SpawnDialog", "CancelDlg") ##################################################################### # Target directory selection seldlg = PyDialog(db, "SelectDirectoryDlg", x, y, w, h, modal, title, "Next", "Next", "Cancel") seldlg.title("Select Destination Directory") c = seldlg.text("Existing", 135, 25, 235, 30, 0x30003, "{\VerdanaRed9}This update will replace your existing [ProductLine] installation.") c.condition("Hide", 'REMOVEOLDVERSION="" and REMOVEOLDSNAPSHOT=""') seldlg.text("Description", 135, 50, 220, 40, 0x30003, "Please select a directory for the [ProductName] files.") seldlg.back("< Back", None, active=0) c = seldlg.next("Next >", "Cancel") c.event("DoAction", "CheckDir", "TargetExistsOk<>1", order=1) # If the target exists, but we found that we are going to remove old versions, don't bother # confirming that the target directory exists. Strictly speaking, we should determine that # the target directory is indeed the target of the product that we are going to remove, but # I don't know how to do that. c.event("SpawnDialog", "ExistingDirectoryDlg", 'TargetExists=1 and REMOVEOLDVERSION="" and REMOVEOLDSNAPSHOT=""', 2) c.event("SetTargetPath", "TARGETDIR", 'TargetExists=0 or REMOVEOLDVERSION<>"" or REMOVEOLDSNAPSHOT<>""', 3) c.event("SpawnWaitDialog", "WaitForCostingDlg", "CostingComplete=1", 4) c.event("NewDialog", "SelectFeaturesDlg", 'TargetExists=0 or REMOVEOLDVERSION<>"" or REMOVEOLDSNAPSHOT<>""', 5) c = seldlg.cancel("Cancel", "DirectoryCombo") c.event("SpawnDialog", "CancelDlg") seldlg.control("DirectoryCombo", "DirectoryCombo", 135, 70, 172, 80, 393219, "TARGETDIR", None, "DirectoryList", None) seldlg.control("DirectoryList", "DirectoryList", 135, 90, 208, 136, 3, "TARGETDIR", None, "PathEdit", None) seldlg.control("PathEdit", "PathEdit", 135, 230, 206, 16, 3, "TARGETDIR", None, "Next", None) c = seldlg.pushbutton("Up", 306, 70, 18, 18, 3, "Up", None) c.event("DirectoryListUp", "0") c = seldlg.pushbutton("NewDir", 324, 70, 30, 18, 3, "New", None) c.event("DirectoryListNew", "0") ##################################################################### # SelectFeaturesDlg features = PyDialog(db, "SelectFeaturesDlg", x, y, w, h, modal|track_disk_space, title, "Tree", "Next", "Cancel") features.title("Customize [ProductName]") features.text("Description", 135, 35, 220, 15, 0x30003, "Select the way you want features to be installed.") features.text("Text", 135,45,220,30, 3, "Click on the icons in the tree below to change the way features will be installed.") c=features.back("< Back", "Next") c.event("NewDialog", "SelectDirectoryDlg") c=features.next("Next >", "Cancel") c.mapping("SelectionNoItems", "Enabled") c.event("SpawnDialog", "DiskCostDlg", "OutOfDiskSpace=1", order=1) c.event("EndDialog", "Return", "OutOfDiskSpace<>1", order=2) c=features.cancel("Cancel", "Tree") c.event("SpawnDialog", "CancelDlg") # The browse property is not used, since we have only a single target path (selected already) features.control("Tree", "SelectionTree", 135, 75, 220, 95, 7, "_BrowseProperty", "Tree of selections", "Back", None) #c=features.pushbutton("Reset", 42, 243, 56, 17, 3, "Reset", "DiskCost") #c.mapping("SelectionNoItems", "Enabled") #c.event("Reset", "0") features.control("Box", "GroupBox", 135, 170, 225, 90, 1, None, None, None, None) c=features.xbutton("DiskCost", "Disk &Usage", None, 0.10) c.mapping("SelectionNoItems","Enabled") c.event("SpawnDialog", "DiskCostDlg") c=features.xbutton("Advanced", "Advanced", None, 0.30) c.event("SpawnDialog", "AdvancedDlg") c=features.text("ItemDescription", 140, 180, 210, 30, 3, "Multiline description of the currently selected item.") c.mapping("SelectionDescription","Text") c=features.text("ItemSize", 140, 210, 210, 45, 3, "The size of the currently selected item.") c.mapping("SelectionSize", "Text") ##################################################################### # Disk cost cost = PyDialog(db, "DiskCostDlg", x, y, w, h, modal, title, "OK", "OK", "OK", bitmap=False) cost.text("Title", 15, 6, 200, 15, 0x30003, "{\DlgFontBold8}Disk Space Requirements") cost.text("Description", 20, 20, 280, 20, 0x30003, "The disk space required for the installation of the selected features.") cost.text("Text", 20, 53, 330, 60, 3, "The highlighted volumes (if any) do not have enough disk space " "available for the currently selected features. You can either " "remove some files from the highlighted volumes, or choose to " "install less features onto local drive(s), or select different " "destination drive(s).") cost.control("VolumeList", "VolumeCostList", 20, 100, 330, 150, 393223, None, "{120}{70}{70}{70}{70}", None, None) cost.xbutton("OK", "Ok", None, 0.5).event("EndDialog", "Return") ##################################################################### # WhichUsers Dialog. Only available on NT, and for privileged users. # This must be run before FindRelatedProducts, because that will # take into account whether the previous installation was per-user # or per-machine. We currently don't support going back to this # dialog after "Next" was selected; to support this, we would need to # find how to reset the ALLUSERS property, and how to re-run # FindRelatedProducts. # On Windows9x, the ALLUSERS property is ignored on the command line # and in the Property table, but installer fails according to the documentation # if a dialog attempts to set ALLUSERS. whichusers = PyDialog(db, "WhichUsersDlg", x, y, w, h, modal, title, "AdminInstall", "Next", "Cancel") whichusers.title("Select whether to install [ProductName] for all users of this computer.") # A radio group with two options: allusers, justme g = whichusers.radiogroup("AdminInstall", 135, 60, 160, 50, 3, "WhichUsers", "", "Next") g.add("ALL", 0, 5, 150, 20, "Install for all users") g.add("JUSTME", 0, 25, 150, 20, "Install just for me") whichusers.back("Back", None, active=0) c = whichusers.next("Next >", "Cancel") c.event("[ALLUSERS]", "1", 'WhichUsers="ALL"', 1) c.event("EndDialog", "Return", order = 2) c = whichusers.cancel("Cancel", "AdminInstall") c.event("SpawnDialog", "CancelDlg") ##################################################################### # Advanced Dialog. advanced = PyDialog(db, "AdvancedDlg", x, y, w, h, modal, title, "CompilePyc", "Next", "Cancel") advanced.title("Advanced Options for [ProductName]") # A radio group with two options: allusers, justme advanced.checkbox("CompilePyc", 135, 60, 230, 50, 3, "COMPILEALL", "Compile .py files to byte code after installation", "Next") c = advanced.next("Finish", "Cancel") c.event("EndDialog", "Return") c = advanced.cancel("Cancel", "CompilePyc") c.event("SpawnDialog", "CancelDlg") ##################################################################### # Existing Directory dialog dlg = Dialog(db, "ExistingDirectoryDlg", 50, 30, 200, 80, modal, title, "No", "No", "No") dlg.text("Title", 10, 20, 180, 40, 3, "[TARGETDIR] exists. Are you sure you want to overwrite existing files?") c=dlg.pushbutton("Yes", 30, 60, 55, 17, 3, "Yes", "No") c.event("[TargetExists]", "0", order=1) c.event("[TargetExistsOk]", "1", order=2) c.event("EndDialog", "Return", order=3) c=dlg.pushbutton("No", 115, 60, 55, 17, 3, "No", "Yes") c.event("EndDialog", "Return") ##################################################################### # Installation Progress dialog (modeless) progress = PyDialog(db, "ProgressDlg", x, y, w, h, modeless, title, "Cancel", "Cancel", "Cancel", bitmap=False) progress.text("Title", 20, 15, 200, 15, 0x30003, "{\DlgFontBold8}[Progress1] [ProductName]") progress.text("Text", 35, 65, 300, 30, 3, "Please wait while the Installer [Progress2] [ProductName]. " "This may take several minutes.") progress.text("StatusLabel", 35, 100, 35, 20, 3, "Status:") c=progress.text("ActionText", 70, 100, w-70, 20, 3, "Pondering...") c.mapping("ActionText", "Text") #c=progress.text("ActionData", 35, 140, 300, 20, 3, None) #c.mapping("ActionData", "Text") c=progress.control("ProgressBar", "ProgressBar", 35, 120, 300, 10, 65537, None, "Progress done", None, None) c.mapping("SetProgress", "Progress") progress.back("< Back", "Next", active=False) progress.next("Next >", "Cancel", active=False) progress.cancel("Cancel", "Back").event("SpawnDialog", "CancelDlg") # Maintenance type: repair/uninstall maint = PyDialog(db, "MaintenanceTypeDlg", x, y, w, h, modal, title, "Next", "Next", "Cancel") maint.title("Welcome to the [ProductName] Setup Wizard") maint.text("BodyText", 135, 63, 230, 42, 3, "Select whether you want to repair or remove [ProductName].") g=maint.radiogroup("RepairRadioGroup", 135, 108, 230, 60, 3, "MaintenanceForm_Action", "", "Next") g.add("Change", 0, 0, 200, 17, "&Change [ProductName]") g.add("Repair", 0, 18, 200, 17, "&Repair [ProductName]") g.add("Remove", 0, 36, 200, 17, "Re&move [ProductName]") maint.back("< Back", None, active=False) c=maint.next("Finish", "Cancel") # Change installation: Change progress dialog to "Change", then ask # for feature selection c.event("[Progress1]", "Change", 'MaintenanceForm_Action="Change"', 1) c.event("[Progress2]", "changes", 'MaintenanceForm_Action="Change"', 2) # Reinstall: Change progress dialog to "Repair", then invoke reinstall # Also set list of reinstalled features to "ALL" c.event("[REINSTALL]", "ALL", 'MaintenanceForm_Action="Repair"', 5) c.event("[Progress1]", "Repairing", 'MaintenanceForm_Action="Repair"', 6) c.event("[Progress2]", "repairs", 'MaintenanceForm_Action="Repair"', 7) c.event("Reinstall", "ALL", 'MaintenanceForm_Action="Repair"', 8) # Uninstall: Change progress to "Remove", then invoke uninstall # Also set list of removed features to "ALL" c.event("[REMOVE]", "ALL", 'MaintenanceForm_Action="Remove"', 11) c.event("[Progress1]", "Removing", 'MaintenanceForm_Action="Remove"', 12) c.event("[Progress2]", "removes", 'MaintenanceForm_Action="Remove"', 13) c.event("Remove", "ALL", 'MaintenanceForm_Action="Remove"', 14) # Close dialog when maintenance action scheduled c.event("EndDialog", "Return", 'MaintenanceForm_Action<>"Change"', 20) c.event("NewDialog", "SelectFeaturesDlg", 'MaintenanceForm_Action="Change"', 21) maint.cancel("Cancel", "RepairRadioGroup").event("SpawnDialog", "CancelDlg") |
|
folderbox = Listbox(right) | folderbox = Listbox(right, {'exportselection': 0}) | def main(): global root, tk, top, mid, bot global folderbox, foldermenu, scanbox, scanmenu, viewer global folder, seq global mh, mhf # Parse command line options folder = 'inbox' seq = 'all' try: opts, args = getopt.getopt(sys.argv[1:], '') except getopt.error, msg: print msg sys.exit(2) for arg in args: if arg[:1] == '+': folder = arg[1:] else: seq = arg # Initialize MH mh = mhlib.MH() mhf = mh.openfolder(folder) # Build widget hierarchy root = Tk() tk = root.tk top = Frame(root) top.pack({'expand': 1, 'fill': 'both'}) # Build right part: folder list right = Frame(top) right.pack({'fill': 'y', 'side': 'right'}) folderbar = Scrollbar(right, {'relief': 'sunken', 'bd': 2}) folderbar.pack({'fill': 'y', 'side': 'right'}) folderbox = Listbox(right) folderbox.pack({'expand': 1, 'fill': 'both', 'side': 'left'}) foldermenu = Menu(root) foldermenu.add('command', {'label': 'Open Folder', 'command': open_folder}) foldermenu.add('separator') foldermenu.add('command', {'label': 'Quit', 'command': 'exit'}) foldermenu.bind('<ButtonRelease-3>', folder_unpost) folderbox['yscrollcommand'] = (folderbar, 'set') folderbar['command'] = (folderbox, 'yview') folderbox.bind('<Double-1>', open_folder, 1) folderbox.bind('<3>', folder_post) # Build left part: scan list left = Frame(top) left.pack({'expand': 1, 'fill': 'both', 'side': 'left'}) scanbar = Scrollbar(left, {'relief': 'sunken', 'bd': 2}) scanbar.pack({'fill': 'y', 'side': 'right'}) scanbox = Listbox(left, {'font': 'fixed'}) scanbox.pack({'expand': 1, 'fill': 'both', 'side': 'left'}) scanmenu = Menu(root) scanmenu.add('command', {'label': 'Open Message', 'command': open_message}) scanmenu.add('command', {'label': 'Remove Message', 'command': remove_message}) scanmenu.add('command', {'label': 'Refile Message', 'command': refile_message}) scanmenu.add('separator') scanmenu.add('command', {'label': 'Quit', 'command': 'exit'}) scanmenu.bind('<ButtonRelease-3>', scan_unpost) scanbox['yscrollcommand'] = (scanbar, 'set') scanbar['command'] = (scanbox, 'yview') scanbox.bind('<Double-1>', open_message) scanbox.bind('<3>', scan_post) # Separator between middle and bottom part rule2 = Frame(root, {'bg': 'black'}) rule2.pack({'fill': 'x'}) # Build bottom part: current message bot = Frame(root) bot.pack({'expand': 1, 'fill': 'both'}) # viewer = None # Window manager commands root.minsize(800, 1) # Make window resizable # Fill folderbox with text setfolders() # Fill scanbox with text rescan() # Enter mainloop root.mainloop() |
def open_folder(*e): | def open_folder(e=None): | def open_folder(*e): global folder, mhf sel = folderbox.curselection() if len(sel) != 1: if len(sel) > 1: msg = "Please open one folder at a time" else: msg = "Please select a folder to open" dialog(root, "Can't Open Folder", msg, "", 0, "OK") return i = sel[0] folder = folderbox.get(i) mhf = mh.openfolder(folder) rescan() |
def open_message(*e): | def open_message(e=None): | def open_message(*e): global viewer sel = scanbox.curselection() if len(sel) != 1: if len(sel) > 1: msg = "Please open one message at a time" else: msg = "Please select a message to open" dialog(root, "Can't Open Message", msg, "", 0, "OK") return cursor = scanbox['cursor'] scanbox['cursor'] = 'watch' tk.call('update', 'idletasks') i = sel[0] line = scanbox.get(i) if scanparser.match(line) >= 0: num = string.atoi(scanparser.group(1)) m = mhf.openmessage(num) if viewer: viewer.destroy() from MimeViewer import MimeViewer viewer = MimeViewer(bot, '+%s/%d' % (folder, num), m) viewer.pack() viewer.show() scanbox['cursor'] = cursor |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.