rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
if temp <> RPCVERSION:
if temp != RPCVERSION:
def handle(self, call): # Don't use unpack_header but parse the header piecewise # XXX I have no idea if I am using the right error responses! self.unpacker.reset(call) self.packer.reset() xid = self.unpacker.unpack_uint() self.packer.pack_uint(xid) temp = self.unpacker.unpack_enum() if temp <> CALL: return None # Not worthy of a reply self.packer.pack_uint(REPLY) temp = self.unpacker.unpack_uint() if temp <> RPCVERSION: self.packer.pack_uint(MSG_DENIED) self.packer.pack_uint(RPC_MISMATCH) self.packer.pack_uint(RPCVERSION) self.packer.pack_uint(RPCVERSION) return self.packer.get_buf() self.packer.pack_uint(MSG_ACCEPTED) self.packer.pack_auth((AUTH_NULL, make_auth_null())) prog = self.unpacker.unpack_uint() if prog <> self.prog: self.packer.pack_uint(PROG_UNAVAIL) return self.packer.get_buf() vers = self.unpacker.unpack_uint() if vers <> self.vers: self.packer.pack_uint(PROG_MISMATCH) self.packer.pack_uint(self.vers) self.packer.pack_uint(self.vers) return self.packer.get_buf() proc = self.unpacker.unpack_uint() methname = 'handle_' + repr(proc) try: meth = getattr(self, methname) except AttributeError: self.packer.pack_uint(PROC_UNAVAIL) return self.packer.get_buf() cred = self.unpacker.unpack_auth() verf = self.unpacker.unpack_auth() try: meth() # Unpack args, call turn_around(), pack reply except (EOFError, GarbageArgs): # Too few or too many arguments self.packer.reset() self.packer.pack_uint(xid) self.packer.pack_uint(REPLY) self.packer.pack_uint(MSG_ACCEPTED) self.packer.pack_auth((AUTH_NULL, make_auth_null())) self.packer.pack_uint(GARBAGE_ARGS) return self.packer.get_buf()
e6b5917a3f1232d3676928a6fb5ae07cc948f164 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e6b5917a3f1232d3676928a6fb5ae07cc948f164/rpc.py
if prog <> self.prog:
if prog != self.prog:
def handle(self, call): # Don't use unpack_header but parse the header piecewise # XXX I have no idea if I am using the right error responses! self.unpacker.reset(call) self.packer.reset() xid = self.unpacker.unpack_uint() self.packer.pack_uint(xid) temp = self.unpacker.unpack_enum() if temp <> CALL: return None # Not worthy of a reply self.packer.pack_uint(REPLY) temp = self.unpacker.unpack_uint() if temp <> RPCVERSION: self.packer.pack_uint(MSG_DENIED) self.packer.pack_uint(RPC_MISMATCH) self.packer.pack_uint(RPCVERSION) self.packer.pack_uint(RPCVERSION) return self.packer.get_buf() self.packer.pack_uint(MSG_ACCEPTED) self.packer.pack_auth((AUTH_NULL, make_auth_null())) prog = self.unpacker.unpack_uint() if prog <> self.prog: self.packer.pack_uint(PROG_UNAVAIL) return self.packer.get_buf() vers = self.unpacker.unpack_uint() if vers <> self.vers: self.packer.pack_uint(PROG_MISMATCH) self.packer.pack_uint(self.vers) self.packer.pack_uint(self.vers) return self.packer.get_buf() proc = self.unpacker.unpack_uint() methname = 'handle_' + repr(proc) try: meth = getattr(self, methname) except AttributeError: self.packer.pack_uint(PROC_UNAVAIL) return self.packer.get_buf() cred = self.unpacker.unpack_auth() verf = self.unpacker.unpack_auth() try: meth() # Unpack args, call turn_around(), pack reply except (EOFError, GarbageArgs): # Too few or too many arguments self.packer.reset() self.packer.pack_uint(xid) self.packer.pack_uint(REPLY) self.packer.pack_uint(MSG_ACCEPTED) self.packer.pack_auth((AUTH_NULL, make_auth_null())) self.packer.pack_uint(GARBAGE_ARGS) return self.packer.get_buf()
e6b5917a3f1232d3676928a6fb5ae07cc948f164 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e6b5917a3f1232d3676928a6fb5ae07cc948f164/rpc.py
if vers <> self.vers:
if vers != self.vers:
def handle(self, call): # Don't use unpack_header but parse the header piecewise # XXX I have no idea if I am using the right error responses! self.unpacker.reset(call) self.packer.reset() xid = self.unpacker.unpack_uint() self.packer.pack_uint(xid) temp = self.unpacker.unpack_enum() if temp <> CALL: return None # Not worthy of a reply self.packer.pack_uint(REPLY) temp = self.unpacker.unpack_uint() if temp <> RPCVERSION: self.packer.pack_uint(MSG_DENIED) self.packer.pack_uint(RPC_MISMATCH) self.packer.pack_uint(RPCVERSION) self.packer.pack_uint(RPCVERSION) return self.packer.get_buf() self.packer.pack_uint(MSG_ACCEPTED) self.packer.pack_auth((AUTH_NULL, make_auth_null())) prog = self.unpacker.unpack_uint() if prog <> self.prog: self.packer.pack_uint(PROG_UNAVAIL) return self.packer.get_buf() vers = self.unpacker.unpack_uint() if vers <> self.vers: self.packer.pack_uint(PROG_MISMATCH) self.packer.pack_uint(self.vers) self.packer.pack_uint(self.vers) return self.packer.get_buf() proc = self.unpacker.unpack_uint() methname = 'handle_' + repr(proc) try: meth = getattr(self, methname) except AttributeError: self.packer.pack_uint(PROC_UNAVAIL) return self.packer.get_buf() cred = self.unpacker.unpack_auth() verf = self.unpacker.unpack_auth() try: meth() # Unpack args, call turn_around(), pack reply except (EOFError, GarbageArgs): # Too few or too many arguments self.packer.reset() self.packer.pack_uint(xid) self.packer.pack_uint(REPLY) self.packer.pack_uint(MSG_ACCEPTED) self.packer.pack_auth((AUTH_NULL, make_auth_null())) self.packer.pack_uint(GARBAGE_ARGS) return self.packer.get_buf()
e6b5917a3f1232d3676928a6fb5ae07cc948f164 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e6b5917a3f1232d3676928a6fb5ae07cc948f164/rpc.py
if reply <> None:
if reply != None:
def session(self): call, host_port = self.sock.recvfrom(8192) reply = self.handle(call) if reply <> None: self.sock.sendto(reply, host_port)
e6b5917a3f1232d3676928a6fb5ae07cc948f164 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e6b5917a3f1232d3676928a6fb5ae07cc948f164/rpc.py
self._bounds = Qd.OffsetRect(self._possize(width, height), pl, pt)
self._bounds = Qd.OffsetRect(_intRect(self._possize(width, height)), pl, pt)
def _calcbounds(self): # calculate absolute bounds relative to the window origin from our # abstract _possize attribute, which is either a 4-tuple or a callable object oldbounds = self._bounds pl, pt, pr, pb = self._parent._bounds if callable(self._possize): # _possize is callable, let it figure it out by itself: it should return # the bounds relative to our parent widget. width = pr - pl height = pb - pt self._bounds = Qd.OffsetRect(self._possize(width, height), pl, pt) else: # _possize must be a 4-tuple. This is where the algorithm by Peter Kriens and # Petr van Blokland kicks in. (*** Parts of this algorithm are applied for # patents by Ericsson, Sweden ***) l, t, r, b = self._possize # depending on the values of l(eft), t(op), r(right) and b(ottom), # they mean different things: if l < -1: # l is less than -1, this mean it measures from the *right* of it's parent l = pr + l else: # l is -1 or greater, this mean it measures from the *left* of it's parent l = pl + l if t < -1: # t is less than -1, this mean it measures from the *bottom* of it's parent t = pb + t else: # t is -1 or greater, this mean it measures from the *top* of it's parent t = pt + t if r > 1: # r is greater than 1, this means r is the *width* of the widget r = l + r else: # r is less than 1, this means it measures from the *right* of it's parent r = pr + r if b > 1: # b is greater than 1, this means b is the *height* of the widget b = t + b else: # b is less than 1, this means it measures from the *bottom* of it's parent b = pb + b self._bounds = (l, t, r, b) if oldbounds and oldbounds <> self._bounds: self.adjust(oldbounds) for w in self._widgets: w._calcbounds()
ce49f5ae9ff4391f934f3da3457782aebe54c4d0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ce49f5ae9ff4391f934f3da3457782aebe54c4d0/Wbase.py
Qd.PaintRect(rect)
Qd.PaintRect(_intRect(rect))
def click(self, point, modifiers): # what a mess... orgmouse = point[self._direction] halfgutter = self._gutter / 2 l, t, r, b = self._bounds if self._direction: begin, end = t, b else: begin, end = l, r i = self.findgutter(orgmouse, begin, end) if i is None: return pos = orgpos = begin + (end - begin) * self._gutters[i] # init pos too, for fast click on border, bug done by Petr minpos = self._panesizes[i][0] maxpos = self._panesizes[i+1][1] minpos = begin + (end - begin) * minpos + 64 maxpos = begin + (end - begin) * maxpos - 64 if minpos > orgpos and maxpos < orgpos: return #SetCursor("fist") self.SetPort() if self._direction: rect = l, orgpos - 1, r, orgpos else: rect = orgpos - 1, t, orgpos, b # track mouse --- XXX move to separate method? Qd.PenMode(QuickDraw.srcXor) Qd.PenPat(Qd.GetQDGlobalsGray()) Qd.PaintRect(rect) lastpos = None while Evt.Button(): pos = orgpos - orgmouse + Evt.GetMouse()[self._direction] pos = max(pos, minpos) pos = min(pos, maxpos) if pos == lastpos: continue Qd.PenPat(Qd.GetQDGlobalsGray()) Qd.PaintRect(rect) if self._direction: rect = l, pos - 1, r, pos else: rect = pos - 1, t, pos, b Qd.PenPat(Qd.GetQDGlobalsGray()) Qd.PaintRect(rect) lastpos = pos self._parentwindow.wid.GetWindowPort().QDFlushPortBuffer(None) Evt.WaitNextEvent(0, 3) Qd.PaintRect(rect) Qd.PenNormal() SetCursor("watch") newpos = (pos - begin) / float(end - begin) self._gutters[i] = newpos self._panesizes[i] = self._panesizes[i][0], newpos self._panesizes[i+1] = newpos, self._panesizes[i+1][1] self.makepanebounds() self.installbounds() self._calcbounds()
ce49f5ae9ff4391f934f3da3457782aebe54c4d0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ce49f5ae9ff4391f934f3da3457782aebe54c4d0/Wbase.py
Qd.PaintRect(rect)
Qd.PaintRect(_intRect(rect))
def click(self, point, modifiers): # what a mess... orgmouse = point[self._direction] halfgutter = self._gutter / 2 l, t, r, b = self._bounds if self._direction: begin, end = t, b else: begin, end = l, r i = self.findgutter(orgmouse, begin, end) if i is None: return pos = orgpos = begin + (end - begin) * self._gutters[i] # init pos too, for fast click on border, bug done by Petr minpos = self._panesizes[i][0] maxpos = self._panesizes[i+1][1] minpos = begin + (end - begin) * minpos + 64 maxpos = begin + (end - begin) * maxpos - 64 if minpos > orgpos and maxpos < orgpos: return #SetCursor("fist") self.SetPort() if self._direction: rect = l, orgpos - 1, r, orgpos else: rect = orgpos - 1, t, orgpos, b # track mouse --- XXX move to separate method? Qd.PenMode(QuickDraw.srcXor) Qd.PenPat(Qd.GetQDGlobalsGray()) Qd.PaintRect(rect) lastpos = None while Evt.Button(): pos = orgpos - orgmouse + Evt.GetMouse()[self._direction] pos = max(pos, minpos) pos = min(pos, maxpos) if pos == lastpos: continue Qd.PenPat(Qd.GetQDGlobalsGray()) Qd.PaintRect(rect) if self._direction: rect = l, pos - 1, r, pos else: rect = pos - 1, t, pos, b Qd.PenPat(Qd.GetQDGlobalsGray()) Qd.PaintRect(rect) lastpos = pos self._parentwindow.wid.GetWindowPort().QDFlushPortBuffer(None) Evt.WaitNextEvent(0, 3) Qd.PaintRect(rect) Qd.PenNormal() SetCursor("watch") newpos = (pos - begin) / float(end - begin) self._gutters[i] = newpos self._panesizes[i] = self._panesizes[i][0], newpos self._panesizes[i+1] = newpos, self._panesizes[i+1][1] self.makepanebounds() self.installbounds() self._calcbounds()
ce49f5ae9ff4391f934f3da3457782aebe54c4d0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ce49f5ae9ff4391f934f3da3457782aebe54c4d0/Wbase.py
Qd.PaintRect(rect)
Qd.PaintRect(_intRect(rect))
def click(self, point, modifiers): # what a mess... orgmouse = point[self._direction] halfgutter = self._gutter / 2 l, t, r, b = self._bounds if self._direction: begin, end = t, b else: begin, end = l, r i = self.findgutter(orgmouse, begin, end) if i is None: return pos = orgpos = begin + (end - begin) * self._gutters[i] # init pos too, for fast click on border, bug done by Petr minpos = self._panesizes[i][0] maxpos = self._panesizes[i+1][1] minpos = begin + (end - begin) * minpos + 64 maxpos = begin + (end - begin) * maxpos - 64 if minpos > orgpos and maxpos < orgpos: return #SetCursor("fist") self.SetPort() if self._direction: rect = l, orgpos - 1, r, orgpos else: rect = orgpos - 1, t, orgpos, b # track mouse --- XXX move to separate method? Qd.PenMode(QuickDraw.srcXor) Qd.PenPat(Qd.GetQDGlobalsGray()) Qd.PaintRect(rect) lastpos = None while Evt.Button(): pos = orgpos - orgmouse + Evt.GetMouse()[self._direction] pos = max(pos, minpos) pos = min(pos, maxpos) if pos == lastpos: continue Qd.PenPat(Qd.GetQDGlobalsGray()) Qd.PaintRect(rect) if self._direction: rect = l, pos - 1, r, pos else: rect = pos - 1, t, pos, b Qd.PenPat(Qd.GetQDGlobalsGray()) Qd.PaintRect(rect) lastpos = pos self._parentwindow.wid.GetWindowPort().QDFlushPortBuffer(None) Evt.WaitNextEvent(0, 3) Qd.PaintRect(rect) Qd.PenNormal() SetCursor("watch") newpos = (pos - begin) / float(end - begin) self._gutters[i] = newpos self._panesizes[i] = self._panesizes[i][0], newpos self._panesizes[i+1] = newpos, self._panesizes[i+1][1] self.makepanebounds() self.installbounds() self._calcbounds()
ce49f5ae9ff4391f934f3da3457782aebe54c4d0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ce49f5ae9ff4391f934f3da3457782aebe54c4d0/Wbase.py
Qd.PaintRect(rect)
Qd.PaintRect(_intRect(rect))
def click(self, point, modifiers): # what a mess... orgmouse = point[self._direction] halfgutter = self._gutter / 2 l, t, r, b = self._bounds if self._direction: begin, end = t, b else: begin, end = l, r i = self.findgutter(orgmouse, begin, end) if i is None: return pos = orgpos = begin + (end - begin) * self._gutters[i] # init pos too, for fast click on border, bug done by Petr minpos = self._panesizes[i][0] maxpos = self._panesizes[i+1][1] minpos = begin + (end - begin) * minpos + 64 maxpos = begin + (end - begin) * maxpos - 64 if minpos > orgpos and maxpos < orgpos: return #SetCursor("fist") self.SetPort() if self._direction: rect = l, orgpos - 1, r, orgpos else: rect = orgpos - 1, t, orgpos, b # track mouse --- XXX move to separate method? Qd.PenMode(QuickDraw.srcXor) Qd.PenPat(Qd.GetQDGlobalsGray()) Qd.PaintRect(rect) lastpos = None while Evt.Button(): pos = orgpos - orgmouse + Evt.GetMouse()[self._direction] pos = max(pos, minpos) pos = min(pos, maxpos) if pos == lastpos: continue Qd.PenPat(Qd.GetQDGlobalsGray()) Qd.PaintRect(rect) if self._direction: rect = l, pos - 1, r, pos else: rect = pos - 1, t, pos, b Qd.PenPat(Qd.GetQDGlobalsGray()) Qd.PaintRect(rect) lastpos = pos self._parentwindow.wid.GetWindowPort().QDFlushPortBuffer(None) Evt.WaitNextEvent(0, 3) Qd.PaintRect(rect) Qd.PenNormal() SetCursor("watch") newpos = (pos - begin) / float(end - begin) self._gutters[i] = newpos self._panesizes[i] = self._panesizes[i][0], newpos self._panesizes[i+1] = newpos, self._panesizes[i+1][1] self.makepanebounds() self.installbounds() self._calcbounds()
ce49f5ae9ff4391f934f3da3457782aebe54c4d0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ce49f5ae9ff4391f934f3da3457782aebe54c4d0/Wbase.py
_8bit = re.compile(r"[\200-\377]") def escape8bit(s): if _8bit.search(s) is not None: out = [] for c in s: o = ord(c) if o >= 128: out.append("\\" + hex(o)[1:]) else: out.append(c) s = "".join(out) return s
def initpatterns(self): Scanner.initpatterns(self) self.head_pat = "^EXTERN_API(_C)?" self.type_pat = "EXTERN_API(_C)?" + \ "[ \t\n]*\([ \t\n]*" + \ "(?P<type>[a-zA-Z0-9_* \t]*[a-zA-Z0-9_*])" + \ "[ \t\n]*\)[ \t\n]*" self.whole_pat = self.type_pat + self.name_pat + self.args_pat self.sym_pat = "^[ \t]*(?P<name>[a-zA-Z0-9_]+)[ \t]*=" + \ "[ \t]*(?P<defn>[-0-9_a-zA-Z'\"\(][^\t\n,;}]*),?"
4038dfb56a8412f4013a01c8620c6d8410a8ac52 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4038dfb56a8412f4013a01c8620c6d8410a8ac52/scantools.py
fss = alias.Resolve()[0] pathname = fss.as_pathname()
fsr = alias.FSResolveAlias(None)[0] pathname = fsr.as_pathname()
def open_file(self, _object=None, **args): for alias in _object: fss = alias.Resolve()[0] pathname = fss.as_pathname() sys.argv.append(pathname) self._quit()
c23e1d2c8b96fd1376f76f5269815691b0ff7394 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c23e1d2c8b96fd1376f76f5269815691b0ff7394/argvemulator.py
return section in self.sections()
return section in self.__sections
def has_section(self, section): """Indicate whether the named section is present in the configuration.
490cbf56868a5118b635128d808b569527adaab6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/490cbf56868a5118b635128d808b569527adaab6/ConfigParser.py
sectdict = self.__sections[section].copy()
d.update(self.__sections[section])
def get(self, section, option, raw=0, vars=None): """Get an option value for a given section.
490cbf56868a5118b635128d808b569527adaab6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/490cbf56868a5118b635128d808b569527adaab6/ConfigParser.py
if section == DEFAULTSECT: sectdict = {} else:
if section != DEFAULTSECT:
def get(self, section, option, raw=0, vars=None): """Get an option value for a given section.
490cbf56868a5118b635128d808b569527adaab6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/490cbf56868a5118b635128d808b569527adaab6/ConfigParser.py
d = self.__defaults.copy() d.update(sectdict)
def get(self, section, option, raw=0, vars=None): """Get an option value for a given section.
490cbf56868a5118b635128d808b569527adaab6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/490cbf56868a5118b635128d808b569527adaab6/ConfigParser.py
rawval = d[option]
value = d[option]
def get(self, section, option, raw=0, vars=None): """Get an option value for a given section.
490cbf56868a5118b635128d808b569527adaab6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/490cbf56868a5118b635128d808b569527adaab6/ConfigParser.py
return rawval
return value return self._interpolate(section, option, value, d) def _interpolate(self, section, option, rawval, vars):
def get(self, section, option, raw=0, vars=None): """Get an option value for a given section.
490cbf56868a5118b635128d808b569527adaab6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/490cbf56868a5118b635128d808b569527adaab6/ConfigParser.py
value = rawval depth = 0 while depth < 10: depth = depth + 1 if value.find("%(") >= 0:
value = rawval depth = MAX_INTERPOLATION_DEPTH while depth: depth -= 1 if value.find("%(") != -1:
def get(self, section, option, raw=0, vars=None): """Get an option value for a given section.
490cbf56868a5118b635128d808b569527adaab6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/490cbf56868a5118b635128d808b569527adaab6/ConfigParser.py
value = value % d
value = value % vars
def get(self, section, option, raw=0, vars=None): """Get an option value for a given section.
490cbf56868a5118b635128d808b569527adaab6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/490cbf56868a5118b635128d808b569527adaab6/ConfigParser.py
if value.find("%(") >= 0:
if value.find("%(") != -1:
def get(self, section, option, raw=0, vars=None): """Get an option value for a given section.
490cbf56868a5118b635128d808b569527adaab6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/490cbf56868a5118b635128d808b569527adaab6/ConfigParser.py
states = {'1': 1, 'yes': 1, 'true': 1, 'on': 1, '0': 0, 'no': 0, 'false': 0, 'off': 0}
def getboolean(self, section, option): states = {'1': 1, 'yes': 1, 'true': 1, 'on': 1, '0': 0, 'no': 0, 'false': 0, 'off': 0} v = self.get(section, option) if not v.lower() in states: raise ValueError, 'Not a boolean: %s' % v return states[v.lower()]
490cbf56868a5118b635128d808b569527adaab6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/490cbf56868a5118b635128d808b569527adaab6/ConfigParser.py
if not v.lower() in states:
if v.lower() not in self._boolean_states:
def getboolean(self, section, option): states = {'1': 1, 'yes': 1, 'true': 1, 'on': 1, '0': 0, 'no': 0, 'false': 0, 'off': 0} v = self.get(section, option) if not v.lower() in states: raise ValueError, 'Not a boolean: %s' % v return states[v.lower()]
490cbf56868a5118b635128d808b569527adaab6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/490cbf56868a5118b635128d808b569527adaab6/ConfigParser.py
return states[v.lower()]
return self._boolean_states[v.lower()]
def getboolean(self, section, option): states = {'1': 1, 'yes': 1, 'true': 1, 'on': 1, '0': 0, 'no': 0, 'false': 0, 'off': 0} v = self.get(section, option) if not v.lower() in states: raise ValueError, 'Not a boolean: %s' % v return states[v.lower()]
490cbf56868a5118b635128d808b569527adaab6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/490cbf56868a5118b635128d808b569527adaab6/ConfigParser.py
if not section or section == "DEFAULT":
if not section or section == DEFAULTSECT: option = self.optionxform(option)
def has_option(self, section, option): """Check for the existence of a given option in a given section.""" if not section or section == "DEFAULT": return option in self.__defaults elif not self.has_section(section): return 0 else: option = self.optionxform(option) return option in self.__sections[section]
490cbf56868a5118b635128d808b569527adaab6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/490cbf56868a5118b635128d808b569527adaab6/ConfigParser.py
elif not self.has_section(section):
elif section not in self.__sections:
def has_option(self, section, option): """Check for the existence of a given option in a given section.""" if not section or section == "DEFAULT": return option in self.__defaults elif not self.has_section(section): return 0 else: option = self.optionxform(option) return option in self.__sections[section]
490cbf56868a5118b635128d808b569527adaab6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/490cbf56868a5118b635128d808b569527adaab6/ConfigParser.py
return option in self.__sections[section]
return (option in self.__sections[section] or option in self.__defaults)
def has_option(self, section, option): """Check for the existence of a given option in a given section.""" if not section or section == "DEFAULT": return option in self.__defaults elif not self.has_section(section): return 0 else: option = self.optionxform(option) return option in self.__sections[section]
490cbf56868a5118b635128d808b569527adaab6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/490cbf56868a5118b635128d808b569527adaab6/ConfigParser.py
if not section or section == "DEFAULT":
if not section or section == DEFAULTSECT:
def set(self, section, option, value): """Set an option.""" if not section or section == "DEFAULT": sectdict = self.__defaults else: try: sectdict = self.__sections[section] except KeyError: raise NoSectionError(section) option = self.optionxform(option) sectdict[option] = value
490cbf56868a5118b635128d808b569527adaab6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/490cbf56868a5118b635128d808b569527adaab6/ConfigParser.py
option = self.optionxform(option) sectdict[option] = value
sectdict[self.optionxform(option)] = value
def set(self, section, option, value): """Set an option.""" if not section or section == "DEFAULT": sectdict = self.__defaults else: try: sectdict = self.__sections[section] except KeyError: raise NoSectionError(section) option = self.optionxform(option) sectdict[option] = value
490cbf56868a5118b635128d808b569527adaab6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/490cbf56868a5118b635128d808b569527adaab6/ConfigParser.py
fp.write("[DEFAULT]\n")
fp.write("[%s]\n" % DEFAULTSECT)
def write(self, fp): """Write an .ini-format representation of the configuration state.""" if self.__defaults: fp.write("[DEFAULT]\n") for (key, value) in self.__defaults.items(): fp.write("%s = %s\n" % (key, str(value).replace('\n', '\n\t'))) fp.write("\n") for section in self.sections(): fp.write("[" + section + "]\n") sectdict = self.__sections[section] for (key, value) in sectdict.items(): if key == "__name__": continue fp.write("%s = %s\n" % (key, str(value).replace('\n', '\n\t'))) fp.write("\n")
490cbf56868a5118b635128d808b569527adaab6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/490cbf56868a5118b635128d808b569527adaab6/ConfigParser.py
for section in self.sections(): fp.write("[" + section + "]\n") sectdict = self.__sections[section] for (key, value) in sectdict.items(): if key == "__name__": continue fp.write("%s = %s\n" % (key, str(value).replace('\n', '\n\t')))
for section in self.__sections: fp.write("[%s]\n" % section) for (key, value) in self.__sections[section].items(): if key != "__name__": fp.write("%s = %s\n" % (key, str(value).replace('\n', '\n\t')))
def write(self, fp): """Write an .ini-format representation of the configuration state.""" if self.__defaults: fp.write("[DEFAULT]\n") for (key, value) in self.__defaults.items(): fp.write("%s = %s\n" % (key, str(value).replace('\n', '\n\t'))) fp.write("\n") for section in self.sections(): fp.write("[" + section + "]\n") sectdict = self.__sections[section] for (key, value) in sectdict.items(): if key == "__name__": continue fp.write("%s = %s\n" % (key, str(value).replace('\n', '\n\t'))) fp.write("\n")
490cbf56868a5118b635128d808b569527adaab6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/490cbf56868a5118b635128d808b569527adaab6/ConfigParser.py
if not section or section == "DEFAULT":
if not section or section == DEFAULTSECT:
def remove_option(self, section, option): """Remove an option.""" if not section or section == "DEFAULT": sectdict = self.__defaults else: try: sectdict = self.__sections[section] except KeyError: raise NoSectionError(section) option = self.optionxform(option) existed = option in sectdict if existed: del sectdict[option] return existed
490cbf56868a5118b635128d808b569527adaab6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/490cbf56868a5118b635128d808b569527adaab6/ConfigParser.py
if section in self.__sections:
existed = section in self.__sections if existed:
def remove_section(self, section): """Remove a file section.""" if section in self.__sections: del self.__sections[section] return True else: return False
490cbf56868a5118b635128d808b569527adaab6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/490cbf56868a5118b635128d808b569527adaab6/ConfigParser.py
return True else: return False
return existed
def remove_section(self, section): """Remove a file section.""" if section in self.__sections: del self.__sections[section] return True else: return False
490cbf56868a5118b635128d808b569527adaab6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/490cbf56868a5118b635128d808b569527adaab6/ConfigParser.py
def remove_section(self, section): """Remove a file section.""" if section in self.__sections: del self.__sections[section] return True else: return False
490cbf56868a5118b635128d808b569527adaab6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/490cbf56868a5118b635128d808b569527adaab6/ConfigParser.py
r'(?P<option>[]\-[\w_.*,(){}]+)' r'[ \t]*(?P<vi>[:=])[ \t]*'
r'(?P<option>[^:=\s]+)' r'\s*(?P<vi>[:=])\s*'
def remove_section(self, section): """Remove a file section.""" if section in self.__sections: del self.__sections[section] return True else: return False
490cbf56868a5118b635128d808b569527adaab6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/490cbf56868a5118b635128d808b569527adaab6/ConfigParser.py
if line.split()[0].lower() == 'rem' \ and line[0] in "rR":
if line.split(None, 1)[0].lower() == 'rem' and line[0] in "rR":
def __read(self, fp, fpname): """Parse a sectioned setup file.
490cbf56868a5118b635128d808b569527adaab6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/490cbf56868a5118b635128d808b569527adaab6/ConfigParser.py
if line[0] in ' \t' and cursect is not None and optname:
if line[0].isspace() and cursect is not None and optname:
def __read(self, fp, fpname): """Parse a sectioned setup file.
490cbf56868a5118b635128d808b569527adaab6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/490cbf56868a5118b635128d808b569527adaab6/ConfigParser.py
k = self.optionxform(optname) cursect[k] = "%s\n%s" % (cursect[k], value)
cursect[optname] = "%s\n%s" % (cursect[optname], value)
def __read(self, fp, fpname): """Parse a sectioned setup file.
490cbf56868a5118b635128d808b569527adaab6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/490cbf56868a5118b635128d808b569527adaab6/ConfigParser.py
if pos and optval[pos-1].isspace():
if pos != -1 and optval[pos-1].isspace():
def __read(self, fp, fpname): """Parse a sectioned setup file.
490cbf56868a5118b635128d808b569527adaab6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/490cbf56868a5118b635128d808b569527adaab6/ConfigParser.py
cursect[self.optionxform(optname)] = optval
optname = self.optionxform(optname) cursect[optname] = optval
def __read(self, fp, fpname): """Parse a sectioned setup file.
490cbf56868a5118b635128d808b569527adaab6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/490cbf56868a5118b635128d808b569527adaab6/ConfigParser.py
"verify we can open a file known to be a hash v2 file"
def test_open_existing_hash(self): "verify we can open a file known to be a hash v2 file" db = bsddb185.hashopen(findfile("185test.db")) self.assertEqual(db["1"], "1") db.close()
7e8ed7e15c8d9c07c8d2dd8319185f3c595200f0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/7e8ed7e15c8d9c07c8d2dd8319185f3c595200f0/test_bsddb185.py
"verify that whichdb correctly sniffs the known hash v2 file"
def test_whichdb(self): "verify that whichdb correctly sniffs the known hash v2 file" self.assertEqual(whichdb.whichdb(findfile("185test.db")), "bsddb185")
7e8ed7e15c8d9c07c8d2dd8319185f3c595200f0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/7e8ed7e15c8d9c07c8d2dd8319185f3c595200f0/test_bsddb185.py
"verify that anydbm.open does *not* create a bsddb185 file"
def test_anydbm_create(self): "verify that anydbm.open does *not* create a bsddb185 file" tmpdir = tempfile.mkdtemp() try: try: dbfile = os.path.join(tmpdir, "foo.db") anydbm.open(dbfile, "c").close() ftype = whichdb.whichdb(findfile("foo.db")) self.assertNotEqual(ftype, "bsddb185") finally: os.unlink(dbfile) finally: os.rmdir(tmpdir)
7e8ed7e15c8d9c07c8d2dd8319185f3c595200f0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/7e8ed7e15c8d9c07c8d2dd8319185f3c595200f0/test_bsddb185.py
anydbm.open(dbfile, "c").close() ftype = whichdb.whichdb(findfile("foo.db"))
anydbm.open(os.path.splitext(dbfile)[0], "c").close() ftype = whichdb.whichdb(dbfile)
def test_anydbm_create(self): "verify that anydbm.open does *not* create a bsddb185 file" tmpdir = tempfile.mkdtemp() try: try: dbfile = os.path.join(tmpdir, "foo.db") anydbm.open(dbfile, "c").close() ftype = whichdb.whichdb(findfile("foo.db")) self.assertNotEqual(ftype, "bsddb185") finally: os.unlink(dbfile) finally: os.rmdir(tmpdir)
7e8ed7e15c8d9c07c8d2dd8319185f3c595200f0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/7e8ed7e15c8d9c07c8d2dd8319185f3c595200f0/test_bsddb185.py
"""execv(file, args, env)
"""execvpe(file, args, env)
def execvpe(file, args, env): """execv(file, args, env) Execute the executable file (which is searched for along $PATH) with argument list args and environment env , replacing the current process. args may be a list or tuple of strings. """ _execvpe(file, args, env)
666f87104e2eb5b0c2ff6da2a68352c2e97de8e4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/666f87104e2eb5b0c2ff6da2a68352c2e97de8e4/os.py
except error, (errno, msg): if errno != ENOENT and errno != ENOTDIR: raise raise error, (errno, msg)
except error, e: tb = sys.exc_info()[2] if (e.errno != ENOENT and e.errno != ENOTDIR and saved_exc is None): saved_exc = e saved_tb = tb if saved_exc: raise error, saved_exc, saved_tb raise error, e, tb
def _execvpe(file, args, env=None): from errno import ENOENT, ENOTDIR if env is not None: func = execve argrest = (args, env) else: func = execv argrest = (args,) env = environ head, tail = path.split(file) if head: apply(func, (file,) + argrest) return if 'PATH' in env: envpath = env['PATH'] else: envpath = defpath PATH = envpath.split(pathsep) for dir in PATH: fullname = path.join(dir, file) try: apply(func, (fullname,) + argrest) except error, (errno, msg): if errno != ENOENT and errno != ENOTDIR: raise raise error, (errno, msg)
666f87104e2eb5b0c2ff6da2a68352c2e97de8e4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/666f87104e2eb5b0c2ff6da2a68352c2e97de8e4/os.py
return eval("self.%s" % attr.lower())
return getattr(self, attr.lower())
def __getattr__(self, attr): # Allow UPPERCASE variants of IMAP4 command methods. if Commands.has_key(attr): return eval("self.%s" % attr.lower()) raise AttributeError("Unknown IMAP4 command: '%s'" % attr)
bd2f753da8c4902fda79f5a41d749758bc9be20a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/bd2f753da8c4902fda79f5a41d749758bc9be20a/imaplib.py
def __getattr__(self, attr): # Allow UPPERCASE variants of IMAP4 command methods. if Commands.has_key(attr): return eval("self.%s" % attr.lower()) raise AttributeError("Unknown IMAP4 command: '%s'" % attr)
bd2f753da8c4902fda79f5a41d749758bc9be20a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/bd2f753da8c4902fda79f5a41d749758bc9be20a/imaplib.py
"""Setup 'self.sock' and 'self.file'."""
"""Setup connection to remote server on "host:port". This connection will be used by the routines: read, readline, send, shutdown. """
def open(self, host, port): """Setup 'self.sock' and 'self.file'.""" self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.sock.connect((self.host, self.port)) self.file = self.sock.makefile('r')
bd2f753da8c4902fda79f5a41d749758bc9be20a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/bd2f753da8c4902fda79f5a41d749758bc9be20a/imaplib.py
def socket(self): """Return socket instance used to connect to IMAP4 server. socket = <instance>.socket() """ return self.sock
def response(self, code): """Return data for response 'code' if received, or None.
bd2f753da8c4902fda79f5a41d749758bc9be20a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/bd2f753da8c4902fda79f5a41d749758bc9be20a/imaplib.py
self.file.close() self.sock.close()
self.shutdown()
def logout(self): """Shutdown connection to server.
bd2f753da8c4902fda79f5a41d749758bc9be20a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/bd2f753da8c4902fda79f5a41d749758bc9be20a/imaplib.py
charset = 'CHARSET ' + charset typ, dat = apply(self._simple_command, (name, charset) + criteria)
typ, dat = apply(self._simple_command, (name, 'CHARSET', charset) + criteria) else: typ, dat = apply(self._simple_command, (name,) + criteria)
def search(self, charset, *criteria): """Search mailbox for matching messages.
bd2f753da8c4902fda79f5a41d749758bc9be20a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/bd2f753da8c4902fda79f5a41d749758bc9be20a/imaplib.py
if self.PROTOCOL_VERSION == 'IMAP4': raise self.error('%s unimplemented in IMAP4 (obtain IMAP4rev1 server, or re-code)' % name)
def status(self, mailbox, names): """Request named status conditions for mailbox.
bd2f753da8c4902fda79f5a41d749758bc9be20a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/bd2f753da8c4902fda79f5a41d749758bc9be20a/imaplib.py
if command == 'SEARCH': name = 'SEARCH'
if command in ('SEARCH', 'SORT'): name = command
def uid(self, command, *args): """Execute "command arg ..." with messages identified by UID, rather than message number.
bd2f753da8c4902fda79f5a41d749758bc9be20a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/bd2f753da8c4902fda79f5a41d749758bc9be20a/imaplib.py
""" if name[0] != 'X' or not name in self.capabilities: raise self.error('unknown extension command: %s' % name)
Returns response appropriate to extension command `name'. """ name = name.upper() if not Commands.has_key(name): Commands[name] = (self.state,)
def xatom(self, name, *args): """Allow simple extension commands notified by server in CAPABILITY response.
bd2f753da8c4902fda79f5a41d749758bc9be20a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/bd2f753da8c4902fda79f5a41d749758bc9be20a/imaplib.py
def namespace(self): """ Returns IMAP namespaces ala rfc2342 """ name = 'NAMESPACE' typ, dat = self._simple_command(name) return self._untagged_response(typ, dat, name)
def namespace(self): """ Returns IMAP namespaces ala rfc2342 """ name = 'NAMESPACE' typ, dat = self._simple_command(name) return self._untagged_response(typ, dat, name)
bd2f753da8c4902fda79f5a41d749758bc9be20a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/bd2f753da8c4902fda79f5a41d749758bc9be20a/imaplib.py
self.sock.send('%s%s' % (data, CRLF)) except socket.error, val:
self.send('%s%s' % (data, CRLF)) except (socket.error, OSError), val:
def _command(self, name, *args):
bd2f753da8c4902fda79f5a41d749758bc9be20a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/bd2f753da8c4902fda79f5a41d749758bc9be20a/imaplib.py
self.sock.send(literal) self.sock.send(CRLF) except socket.error, val:
self.send(literal) self.send(CRLF) except (socket.error, OSError), val:
def _command(self, name, *args):
bd2f753da8c4902fda79f5a41d749758bc9be20a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/bd2f753da8c4902fda79f5a41d749758bc9be20a/imaplib.py
data = self.file.read(size)
data = self.read(size)
def _get_response(self):
bd2f753da8c4902fda79f5a41d749758bc9be20a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/bd2f753da8c4902fda79f5a41d749758bc9be20a/imaplib.py
line = self.file.readline()
line = self.readline()
def _get_line(self):
bd2f753da8c4902fda79f5a41d749758bc9be20a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/bd2f753da8c4902fda79f5a41d749758bc9be20a/imaplib.py
PASSWD = getpass.getpass("IMAP password for %s on %s:" % (USER, host or "localhost"))
PASSWD = getpass.getpass("IMAP password for %s on %s: " % (USER, host or "localhost"))
def print_log(): _mesg('last %d IMAP4 interactions:' % len(_cmd_log)) for secs,line in _cmd_log: _mesg(line, secs)
bd2f753da8c4902fda79f5a41d749758bc9be20a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/bd2f753da8c4902fda79f5a41d749758bc9be20a/imaplib.py
typ, dat = apply(eval('M.%s' % cmd), args)
typ, dat = apply(getattr(M, cmd), args)
def run(cmd, args): _mesg('%s %s' % (cmd, args)) typ, dat = apply(eval('M.%s' % cmd), args) _mesg('%s => %s %s' % (cmd, typ, dat)) return dat
bd2f753da8c4902fda79f5a41d749758bc9be20a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/bd2f753da8c4902fda79f5a41d749758bc9be20a/imaplib.py
]
]
def show_compilers (): from distutils.ccompiler import show_compilers show_compilers()
4af195eaba7e2658f3d6590c72fdaa3d40432e7f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4af195eaba7e2658f3d6590c72fdaa3d40432e7f/build_ext.py
ext.export_symbol_file = build_info.get('def_file')
if build_info.has_key('def_file'): self.warn("'def_file' element of build info dict " "no longer supported")
def check_extensions_list (self, extensions): """Ensure that the list of extensions (presumably provided as a command option 'extensions') is valid, i.e. it is a list of Extension objects. We also support the old-style list of 2-tuples, where the tuples are (ext_name, build_info), which are converted to Extension instances here.
4af195eaba7e2658f3d6590c72fdaa3d40432e7f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4af195eaba7e2658f3d6590c72fdaa3d40432e7f/build_ext.py
if self.compiler.compiler_type == 'msvc': self.msvc_prelink_hack(sources, ext, extra_args)
def build_extensions (self):
4af195eaba7e2658f3d6590c72fdaa3d40432e7f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4af195eaba7e2658f3d6590c72fdaa3d40432e7f/build_ext.py
libraries=ext.libraries,
libraries=self.get_libraries(ext),
def build_extensions (self):
4af195eaba7e2658f3d6590c72fdaa3d40432e7f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4af195eaba7e2658f3d6590c72fdaa3d40432e7f/build_ext.py
def msvc_prelink_hack (self, sources, ext, extra_args): def_file = ext.export_symbol_file if def_file is not None: extra_args.append ('/DEF:' + def_file) else: modname = string.split (ext.name, '.')[-1] extra_args.append('/export:init%s' % modname) implib_file = os.path.join ( self.implib_dir, self.get_ext_libname (ext.name)) extra_args.append ('/IMPLIB:' + implib_file) self.mkpath (os.path.dirname (implib_file))
def find_swig (self): """Return the name of the SWIG executable. On Unix, this is just "swig" -- it should be in the PATH. Tries a bit harder on Windows. """
4af195eaba7e2658f3d6590c72fdaa3d40432e7f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4af195eaba7e2658f3d6590c72fdaa3d40432e7f/build_ext.py
"""Lock file f using lockf, flock, and dot locking."""
"""Lock file f using lockf and dot locking."""
def _lock_file(f, dotlock=True): """Lock file f using lockf, flock, and dot locking.""" dotlock_done = False try: if fcntl: try: fcntl.lockf(f, fcntl.LOCK_EX | fcntl.LOCK_NB) except IOError, e: if e.errno == errno.EAGAIN: raise ExternalClashError('lockf: lock unavailable: %s' % f.name) else: raise try: fcntl.flock(f, fcntl.LOCK_EX | fcntl.LOCK_NB) except IOError, e: if e.errno == errno.EWOULDBLOCK: raise ExternalClashError('flock: lock unavailable: %s' % f.name) else: raise if dotlock: try: pre_lock = _create_temporary(f.name + '.lock') pre_lock.close() except IOError, e: if e.errno == errno.EACCES: return # Without write access, just skip dotlocking. else: raise try: if hasattr(os, 'link'): os.link(pre_lock.name, f.name + '.lock') dotlock_done = True os.unlink(pre_lock.name) else: os.rename(pre_lock.name, f.name + '.lock') dotlock_done = True except OSError, e: if e.errno == errno.EEXIST: os.remove(pre_lock.name) raise ExternalClashError('dot lock unavailable: %s' % f.name) else: raise except: if fcntl: fcntl.lockf(f, fcntl.LOCK_UN) fcntl.flock(f, fcntl.LOCK_UN) if dotlock_done: os.remove(f.name + '.lock') raise
cdd66d049dffcee94b9dc9b17bea510e323d079a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/cdd66d049dffcee94b9dc9b17bea510e323d079a/mailbox.py
f.name) else: raise try: fcntl.flock(f, fcntl.LOCK_EX | fcntl.LOCK_NB) except IOError, e: if e.errno == errno.EWOULDBLOCK: raise ExternalClashError('flock: lock unavailable: %s' %
def _lock_file(f, dotlock=True): """Lock file f using lockf, flock, and dot locking.""" dotlock_done = False try: if fcntl: try: fcntl.lockf(f, fcntl.LOCK_EX | fcntl.LOCK_NB) except IOError, e: if e.errno == errno.EAGAIN: raise ExternalClashError('lockf: lock unavailable: %s' % f.name) else: raise try: fcntl.flock(f, fcntl.LOCK_EX | fcntl.LOCK_NB) except IOError, e: if e.errno == errno.EWOULDBLOCK: raise ExternalClashError('flock: lock unavailable: %s' % f.name) else: raise if dotlock: try: pre_lock = _create_temporary(f.name + '.lock') pre_lock.close() except IOError, e: if e.errno == errno.EACCES: return # Without write access, just skip dotlocking. else: raise try: if hasattr(os, 'link'): os.link(pre_lock.name, f.name + '.lock') dotlock_done = True os.unlink(pre_lock.name) else: os.rename(pre_lock.name, f.name + '.lock') dotlock_done = True except OSError, e: if e.errno == errno.EEXIST: os.remove(pre_lock.name) raise ExternalClashError('dot lock unavailable: %s' % f.name) else: raise except: if fcntl: fcntl.lockf(f, fcntl.LOCK_UN) fcntl.flock(f, fcntl.LOCK_UN) if dotlock_done: os.remove(f.name + '.lock') raise
cdd66d049dffcee94b9dc9b17bea510e323d079a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/cdd66d049dffcee94b9dc9b17bea510e323d079a/mailbox.py
fcntl.flock(f, fcntl.LOCK_UN)
def _lock_file(f, dotlock=True): """Lock file f using lockf, flock, and dot locking.""" dotlock_done = False try: if fcntl: try: fcntl.lockf(f, fcntl.LOCK_EX | fcntl.LOCK_NB) except IOError, e: if e.errno == errno.EAGAIN: raise ExternalClashError('lockf: lock unavailable: %s' % f.name) else: raise try: fcntl.flock(f, fcntl.LOCK_EX | fcntl.LOCK_NB) except IOError, e: if e.errno == errno.EWOULDBLOCK: raise ExternalClashError('flock: lock unavailable: %s' % f.name) else: raise if dotlock: try: pre_lock = _create_temporary(f.name + '.lock') pre_lock.close() except IOError, e: if e.errno == errno.EACCES: return # Without write access, just skip dotlocking. else: raise try: if hasattr(os, 'link'): os.link(pre_lock.name, f.name + '.lock') dotlock_done = True os.unlink(pre_lock.name) else: os.rename(pre_lock.name, f.name + '.lock') dotlock_done = True except OSError, e: if e.errno == errno.EEXIST: os.remove(pre_lock.name) raise ExternalClashError('dot lock unavailable: %s' % f.name) else: raise except: if fcntl: fcntl.lockf(f, fcntl.LOCK_UN) fcntl.flock(f, fcntl.LOCK_UN) if dotlock_done: os.remove(f.name + '.lock') raise
cdd66d049dffcee94b9dc9b17bea510e323d079a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/cdd66d049dffcee94b9dc9b17bea510e323d079a/mailbox.py
"""Unlock file f using lockf, flock, and dot locking."""
"""Unlock file f using lockf and dot locking."""
def _unlock_file(f): """Unlock file f using lockf, flock, and dot locking.""" if fcntl: fcntl.lockf(f, fcntl.LOCK_UN) fcntl.flock(f, fcntl.LOCK_UN) if os.path.exists(f.name + '.lock'): os.remove(f.name + '.lock')
cdd66d049dffcee94b9dc9b17bea510e323d079a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/cdd66d049dffcee94b9dc9b17bea510e323d079a/mailbox.py
fcntl.flock(f, fcntl.LOCK_UN)
def _unlock_file(f): """Unlock file f using lockf, flock, and dot locking.""" if fcntl: fcntl.lockf(f, fcntl.LOCK_UN) fcntl.flock(f, fcntl.LOCK_UN) if os.path.exists(f.name + '.lock'): os.remove(f.name + '.lock')
cdd66d049dffcee94b9dc9b17bea510e323d079a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/cdd66d049dffcee94b9dc9b17bea510e323d079a/mailbox.py
return map(self._nametowidget, self.tk.splitlist(self.tk.call( 'winfo', 'children', self._w)))
result = [] for child in self.tk.splitlist( self.tk.call('winfo', 'children', self._w)): try: result.append(self._nametowidget(child)) except KeyError: pass return result
def winfo_children(self): """Return a list of all widgets which are children of this widget.""" return map(self._nametowidget, self.tk.splitlist(self.tk.call( 'winfo', 'children', self._w)))
92d57aa45af85950b47f2dc73087db4a94d47ece /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/92d57aa45af85950b47f2dc73087db4a94d47ece/Tkinter.py
print "proxy via http:", host, selector
def open_http(self, url, data=None): import httplib if type(url) is type(""): host, selector = splithost(url) user_passwd, host = splituser(host) else: host, selector = url urltype, rest = splittype(selector) if string.lower(urltype) == 'http': realhost, rest = splithost(rest) user_passwd, realhost = splituser(realhost) if user_passwd: selector = "%s://%s%s" % (urltype, realhost, rest) print "proxy via http:", host, selector if not host: raise IOError, ('http error', 'no host given') if user_passwd: import base64 auth = string.strip(base64.encodestring(user_passwd)) else: auth = None h = httplib.HTTP(host) if data is not None: h.putrequest('POST', selector) h.putheader('Content-type', 'application/x-www-form-urlencoded') h.putheader('Content-length', '%d' % len(data)) else: h.putrequest('GET', selector) if auth: h.putheader('Authorization', 'Basic %s' % auth) for args in self.addheaders: apply(h.putheader, args) h.endheaders() if data is not None: h.send(data + '\r\n') errcode, errmsg, headers = h.getreply() fp = h.getfile() if errcode == 200: return addinfourl(fp, headers, self.openedurl) else: return self.http_error(url, fp, errcode, errmsg, headers)
7d3e238d6a8ccef99b1eae4f49347029203b6872 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/7d3e238d6a8ccef99b1eae4f49347029203b6872/urllib.py
req_host, erhn = eff_request_host(request) strict_non_domain = ( self._policy.strict_ns_domain & self._policy.DomainStrictNonDomain)
def add_cookie_header(self, request): """Add correct Cookie: header to request (urllib2.Request object).
939a91959c5ac36cf4f9cde64d89d4823755957e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/939a91959c5ac36cf4f9cde64d89d4823755957e/cookielib.py
pid, sts = os.wait(G.busy, options)
pid, sts = os.waitpid(G.busy, options)
def waitchild(options): pid, sts = os.wait(G.busy, options) if pid == G.busy: G.busy = 0 G.stop.enable(0)
c71766a6557e1e7ca17cb2565aa203225eedbd76 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c71766a6557e1e7ca17cb2565aa203225eedbd76/jukebox.py
r = (40, 40, 400, 300)
r = windowbounds(400, 400)
def open(self, path, name, data): self.path = path self.name = name r = (40, 40, 400, 300) w = Win.NewWindow(r, name, 1, 0, -1, 1, 0x55555555) self.wid = w r2 = (0, 0, 345, 245) Qd.SetPort(w) Qd.TextFont(4) Qd.TextSize(9) self.ted = TE.TENew(r2, r2) self.ted.TEAutoView(1) self.ted.TESetText(data) w.DrawGrowIcon() self.scrollbars() self.changed = 0 self.do_postopen() self.do_activate(1, None)
4437a29584fcc71a6340b3b94ab56503e9937ff4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4437a29584fcc71a6340b3b94ab56503e9937ff4/ped.py
r2 = (0, 0, 345, 245)
vr = 0, 0, r[2]-r[0]-15, r[3]-r[1]-15 dr = (0, 0, vr[2], 0)
def open(self, path, name, data): self.path = path self.name = name r = (40, 40, 400, 300) w = Win.NewWindow(r, name, 1, 0, -1, 1, 0x55555555) self.wid = w r2 = (0, 0, 345, 245) Qd.SetPort(w) Qd.TextFont(4) Qd.TextSize(9) self.ted = TE.TENew(r2, r2) self.ted.TEAutoView(1) self.ted.TESetText(data) w.DrawGrowIcon() self.scrollbars() self.changed = 0 self.do_postopen() self.do_activate(1, None)
4437a29584fcc71a6340b3b94ab56503e9937ff4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4437a29584fcc71a6340b3b94ab56503e9937ff4/ped.py
self.ted = TE.TENew(r2, r2)
self.ted = TE.TENew(dr, vr)
def open(self, path, name, data): self.path = path self.name = name r = (40, 40, 400, 300) w = Win.NewWindow(r, name, 1, 0, -1, 1, 0x55555555) self.wid = w r2 = (0, 0, 345, 245) Qd.SetPort(w) Qd.TextFont(4) Qd.TextSize(9) self.ted = TE.TENew(r2, r2) self.ted.TEAutoView(1) self.ted.TESetText(data) w.DrawGrowIcon() self.scrollbars() self.changed = 0 self.do_postopen() self.do_activate(1, None)
4437a29584fcc71a6340b3b94ab56503e9937ff4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4437a29584fcc71a6340b3b94ab56503e9937ff4/ped.py
return vx, vy
return None, vy
def getscrollbarvalues(self): dr = self.ted.destRect vr = self.ted.viewRect height = self.ted.nLines * self.ted.lineHeight vx = self.scalebarvalue(dr[0], dr[2]-dr[0], vr[0], vr[2]) vy = self.scalebarvalue(dr[1], dr[1]+height, vr[1], vr[3]) print dr, vr, height, vx, vy return vx, vy
4437a29584fcc71a6340b3b94ab56503e9937ff4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4437a29584fcc71a6340b3b94ab56503e9937ff4/ped.py
if what == 'set': return if what == '-': delta = self.ted.viewRect[2]/10 elif what == '--': delta = self.ted.viewRect[2]/2 elif what == '+': delta = +self.ted.viewRect[2]/10 elif what == '++': delta = +self.ted.viewRect[2]/2 self.ted.TEPinScroll(delta, 0)
pass
def scrollbar_callback(self, which, what, value): if which == 'y': if what == 'set': height = self.ted.nLines * self.ted.lineHeight cur = self.getscrollbarvalues()[1] delta = (cur-value)*height/32767 if what == '-': delta = self.ted.lineHeight elif what == '--': delta = (self.ted.viewRect[3]-self.ted.lineHeight) if delta <= 0: delta = self.ted.lineHeight elif what == '+': delta = -self.ted.lineHeight elif what == '++': delta = -(self.ted.viewRect[3]-self.ted.lineHeight) if delta >= 0: delta = -self.ted.lineHeight self.ted.TEPinScroll(0, delta) print 'SCROLL Y', delta else: if what == 'set': return # XXXX if what == '-': delta = self.ted.viewRect[2]/10 elif what == '--': delta = self.ted.viewRect[2]/2 elif what == '+': delta = +self.ted.viewRect[2]/10 elif what == '++': delta = +self.ted.viewRect[2]/2 self.ted.TEPinScroll(delta, 0)
4437a29584fcc71a6340b3b94ab56503e9937ff4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4437a29584fcc71a6340b3b94ab56503e9937ff4/ped.py
for l in self._windows.values(): l.do_idle()
if self.active: self.active.do_idle()
def idle(self, *args): for l in self._windows.values(): l.do_idle()
4437a29584fcc71a6340b3b94ab56503e9937ff4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4437a29584fcc71a6340b3b94ab56503e9937ff4/ped.py
def spam(self): return 42
b1b7e702cae6f65e6d146f8881c14f933fe52efd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b1b7e702cae6f65e6d146f8881c14f933fe52efd/test_descr.py
dict["__dynamic__"] = 1
assert dict.get("__dynamic__", 1)
def __new__(metaclass, name, bases, dict): # XXX Should check that name isn't already a base class name dict["__dynamic__"] = 1 cls = super(autosuper, metaclass).__new__(metaclass, name, bases, dict) # Name mangling for __super removes leading underscores while name[:1] == "_": name = name[1:] if name: name = "_%s__super" % name else: name = "__super" setattr(cls, name, super(cls)) return cls
b1b7e702cae6f65e6d146f8881c14f933fe52efd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b1b7e702cae6f65e6d146f8881c14f933fe52efd/test_descr.py
__dynamic__ = 1
__dynamic__ = 1
def mysetattr(self, name, value): if name == "spam": raise AttributeError return object.__setattr__(self, name, value)
b1b7e702cae6f65e6d146f8881c14f933fe52efd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b1b7e702cae6f65e6d146f8881c14f933fe52efd/test_descr.py
__dynamic__ = 1
__dynamic__ = 1
def mysetattr(self, name, value): if name == "spam": raise AttributeError return object.__setattr__(self, name, value)
b1b7e702cae6f65e6d146f8881c14f933fe52efd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b1b7e702cae6f65e6d146f8881c14f933fe52efd/test_descr.py
__dynamic__ = 1
__dynamic__ = 1
def mysetattr(self, name, value): if name == "spam": raise AttributeError return object.__setattr__(self, name, value)
b1b7e702cae6f65e6d146f8881c14f933fe52efd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b1b7e702cae6f65e6d146f8881c14f933fe52efd/test_descr.py
__dynamic__ = 1
__dynamic__ = 1
def __getitem__(self, i): if 0 <= i < 10: return i raise IndexError
b1b7e702cae6f65e6d146f8881c14f933fe52efd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b1b7e702cae6f65e6d146f8881c14f933fe52efd/test_descr.py
__dynamic__ = 0
__dynamic__ = 0
def __repr__(self): return "%.*g" % (self.prec, self)
b1b7e702cae6f65e6d146f8881c14f933fe52efd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b1b7e702cae6f65e6d146f8881c14f933fe52efd/test_descr.py
verify(base.__class__ is complex)
veris(base.__class__, complex)
def __repr__(self): return "%.17gj%+.17g" % (self.imag, self.real)
b1b7e702cae6f65e6d146f8881c14f933fe52efd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b1b7e702cae6f65e6d146f8881c14f933fe52efd/test_descr.py
verify(complex(a).__class__ is complex)
veris(complex(a).__class__, complex)
def __repr__(self): return "%.17gj%+.17g" % (self.imag, self.real)
b1b7e702cae6f65e6d146f8881c14f933fe52efd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b1b7e702cae6f65e6d146f8881c14f933fe52efd/test_descr.py
verify(complex(a).__class__ is complex)
veris(complex(a).__class__, complex)
def __repr__(self): return "%.17gj%+.17g" % (self.imag, self.real)
b1b7e702cae6f65e6d146f8881c14f933fe52efd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b1b7e702cae6f65e6d146f8881c14f933fe52efd/test_descr.py
verify((+a).__class__ is complex) verify((a + 0).__class__ is complex)
veris((+a).__class__, complex) veris((a + 0).__class__, complex)
def __repr__(self): return "%.17gj%+.17g" % (self.imag, self.real)
b1b7e702cae6f65e6d146f8881c14f933fe52efd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b1b7e702cae6f65e6d146f8881c14f933fe52efd/test_descr.py
verify((a - 0).__class__ is complex)
veris((a - 0).__class__, complex)
def __repr__(self): return "%.17gj%+.17g" % (self.imag, self.real)
b1b7e702cae6f65e6d146f8881c14f933fe52efd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b1b7e702cae6f65e6d146f8881c14f933fe52efd/test_descr.py
verify((a * 1).__class__ is complex)
veris((a * 1).__class__, complex)
def __repr__(self): return "%.17gj%+.17g" % (self.imag, self.real)
b1b7e702cae6f65e6d146f8881c14f933fe52efd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b1b7e702cae6f65e6d146f8881c14f933fe52efd/test_descr.py
verify((a / 1).__class__ is complex)
veris((a / 1).__class__, complex)
def __repr__(self): return "%.17gj%+.17g" % (self.imag, self.real)
b1b7e702cae6f65e6d146f8881c14f933fe52efd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b1b7e702cae6f65e6d146f8881c14f933fe52efd/test_descr.py
- port: port to connect to (default the standard NNTP port)"""
- port: port to connect to (default the standard NNTP port) - user: username to authenticate with - password: password to use with username - readermode: if true, send 'mode reader' command after connecting. readermode is sometimes necessary if you are connecting to an NNTP server on the local machine and intend to call reader-specific comamnds, such as `group'. If you get unexpected NNTPPermanentErrors, you might need to set readermode. """
def __init__(self, host, port = NNTP_PORT, user=None, password=None): """Initialize an instance. Arguments: - host: hostname to connect to - port: port to connect to (default the standard NNTP port)"""
6e5a5b653cf6d01e04eb75ed5d23ba576162ee46 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/6e5a5b653cf6d01e04eb75ed5d23ba576162ee46/nntplib.py
raise error_reply, resp
raise NNTPReplyError(resp)
def __init__(self, host, port = NNTP_PORT, user=None, password=None): """Initialize an instance. Arguments: - host: hostname to connect to - port: port to connect to (default the standard NNTP port)"""
6e5a5b653cf6d01e04eb75ed5d23ba576162ee46 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/6e5a5b653cf6d01e04eb75ed5d23ba576162ee46/nntplib.py
raise error_perm, resp
raise NNTPPermanentError(resp)
def __init__(self, host, port = NNTP_PORT, user=None, password=None): """Initialize an instance. Arguments: - host: hostname to connect to - port: port to connect to (default the standard NNTP port)"""
6e5a5b653cf6d01e04eb75ed5d23ba576162ee46 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/6e5a5b653cf6d01e04eb75ed5d23ba576162ee46/nntplib.py
raise error_temp, resp
raise NNTPTemporaryError(resp)
def getresp(self): """Internal: get a response from the server. Raise various errors if the response indicates an error.""" resp = self.getline() if self.debugging: print '*resp*', `resp` c = resp[:1] if c == '4': raise error_temp, resp if c == '5': raise error_perm, resp if c not in '123': raise error_proto, resp return resp
6e5a5b653cf6d01e04eb75ed5d23ba576162ee46 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/6e5a5b653cf6d01e04eb75ed5d23ba576162ee46/nntplib.py