rem
stringlengths 1
322k
| add
stringlengths 0
2.05M
| context
stringlengths 4
228k
| meta
stringlengths 156
215
|
---|---|---|---|
":PlugIns:macspeechmodule.ppc.", | ":PlugIns:macspeech.ppc.", | def buildapplet(top, dummy, list): """Create a PPC python applet""" template = mkapplet.findtemplate() for src in list: if src[-3:] != '.py': raise 'Should end in .py', src base = os.path.basename(src) dst = os.path.join(top, base)[:-3] src = os.path.join(top, src) try: os.unlink(dst) except os.error: pass print 'Building applet', dst mkapplet.process(template, src, dst) | 057971528d37cbb45d80d7d16fdfe890e3bd356e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/057971528d37cbb45d80d7d16fdfe890e3bd356e/fullbuild.py |
":PlugIns:wastemodule.ppc.", ":PlugIns:_tkintermodule.ppc.", | ":PlugIns:qtmodules.ppc.", ":PlugIns:waste.ppc.", ":PlugIns:_tkinter.ppc.", | def buildapplet(top, dummy, list): """Create a PPC python applet""" template = mkapplet.findtemplate() for src in list: if src[-3:] != '.py': raise 'Should end in .py', src base = os.path.basename(src) dst = os.path.join(top, base)[:-3] src = os.path.join(top, src) try: os.unlink(dst) except os.error: pass print 'Building applet', dst mkapplet.process(template, src, dst) | 057971528d37cbb45d80d7d16fdfe890e3bd356e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/057971528d37cbb45d80d7d16fdfe890e3bd356e/fullbuild.py |
":PlugIns:ctbmodule.CFM68K.", | ":PlugIns:ctb.CFM68K.", ":PlugIns:imgmodules.ppc.", | def buildapplet(top, dummy, list): """Create a PPC python applet""" template = mkapplet.findtemplate() for src in list: if src[-3:] != '.py': raise 'Should end in .py', src base = os.path.basename(src) dst = os.path.join(top, base)[:-3] src = os.path.join(top, src) try: os.unlink(dst) except os.error: pass print 'Building applet', dst mkapplet.process(template, src, dst) | 057971528d37cbb45d80d7d16fdfe890e3bd356e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/057971528d37cbb45d80d7d16fdfe890e3bd356e/fullbuild.py |
":PlugIns:wastemodule.CFM68K.", ":PlugIns:_tkintermodule.CFM68K.", | ":PlugIns:qtmodules.CFM68K.", ":PlugIns:waste.CFM68K.", ":PlugIns:_tkinter.CFM68K.", | def buildapplet(top, dummy, list): """Create a PPC python applet""" template = mkapplet.findtemplate() for src in list: if src[-3:] != '.py': raise 'Should end in .py', src base = os.path.basename(src) dst = os.path.join(top, base)[:-3] src = os.path.join(top, src) try: os.unlink(dst) except os.error: pass print 'Building applet', dst mkapplet.process(template, src, dst) | 057971528d37cbb45d80d7d16fdfe890e3bd356e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/057971528d37cbb45d80d7d16fdfe890e3bd356e/fullbuild.py |
replacement repl""" | replacement repl. repl can be either a string or a callable; if a callable, it's passed the match object and must return a replacement string to be used.""" | def sub(pattern, repl, string, count=0): """Return the string obtained by replacing the leftmost non-overlapping occurrences of the pattern in string by the replacement repl""" return _compile(pattern, 0).sub(repl, string, count) | 43ab0cd174c330d5338c395c1f1aae8a0aaffa2d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/43ab0cd174c330d5338c395c1f1aae8a0aaffa2d/sre.py |
substitutions that were made.""" | substitutions that were made. repl can be either a string or a callable; if a callable, it's passed the match object and must return a replacement string to be used.""" | def subn(pattern, repl, string, count=0): """Return a 2-tuple containing (new_string, number). new_string is the string obtained by replacing the leftmost non-overlapping occurrences of the pattern in the source string by the replacement repl. number is the number of substitutions that were made.""" return _compile(pattern, 0).subn(repl, string, count) | 43ab0cd174c330d5338c395c1f1aae8a0aaffa2d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/43ab0cd174c330d5338c395c1f1aae8a0aaffa2d/sre.py |
contents = doc and doc + '\n' methods = allmethods(object).items() methods.sort() for key, value in methods: contents = contents + '\n' + self.document(value, key, mod, object) if not contents: return title + '\n' | contents = doc and [doc + '\n'] or [] push = contents.append def spill(msg, attrs, predicate): ok, attrs = _split_class_attrs(attrs, predicate) if ok: push(msg) for name, kind, homecls, value in ok: push(self.document(getattr(object, name), name, mod, object)) return attrs def spillproperties(msg, attrs): ok, attrs = _split_class_attrs(attrs, lambda t: t[1] == 'property') if ok: push(msg) for name, kind, homecls, value in ok: push(name + '\n') return attrs def spilldata(msg, attrs): ok, attrs = _split_class_attrs(attrs, lambda t: t[1] == 'data') if ok: push(msg) for name, kind, homecls, value in ok: doc = getattr(value, "__doc__", None) push(self.docother(getattr(object, name), name, mod, 70, doc) + '\n') return attrs attrs = inspect.classify_class_attrs(object) attrs, inherited = _split_class_attrs(attrs, lambda t: t[2] is object) inherited.sort(lambda t1, t2: cmp(t1[2].__name__, t2[2].__name__)) thisclass = object while attrs or inherited: if thisclass is object: tag = "defined here" else: tag = "inherited from class %s" % classname(thisclass, object.__module__) attrs.sort(lambda t1, t2: cmp(t1[0], t2[0])) attrs = spill("Methods %s:\n" % tag, attrs, lambda t: t[1] == 'method') attrs = spill("Class methods %s:\n" % tag, attrs, lambda t: t[1] == 'class method') attrs = spill("Static methods %s:\n" % tag, attrs, lambda t: t[1] == 'static method') attrs = spillproperties("Properties %s:\n" % tag, attrs) attrs = spilldata("Data %s:\n" % tag, attrs) assert attrs == [] if inherited: attrs = inherited thisclass = attrs[0][2] attrs, inherited = _split_class_attrs(attrs, lambda t: t[2] is thisclass) contents = '\n'.join(contents) if not contents: return title + '\n' | def makename(c, m=object.__module__): return classname(c, m) | 28355496c1dbd56dd3038b614e507462d7ca8ecc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/28355496c1dbd56dd3038b614e507462d7ca8ecc/pydoc.py |
def docother(self, object, name=None, mod=None, maxlen=None): | def docother(self, object, name=None, mod=None, maxlen=None, doc=None): | def docother(self, object, name=None, mod=None, maxlen=None): """Produce text documentation for a data object.""" repr = self.repr(object) if maxlen: line = (name and name + ' = ' or '') + repr chop = maxlen - len(line) if chop < 0: repr = repr[:chop] + '...' line = (name and self.bold(name) + ' = ' or '') + repr return line | 28355496c1dbd56dd3038b614e507462d7ca8ecc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/28355496c1dbd56dd3038b614e507462d7ca8ecc/pydoc.py |
sf = open(slave, 'rb') | sf = open(slave, 'r') | def compare(slave, master): try: sf = open(slave, 'rb') except IOError: sf = None try: mf = open(master, 'rb') except IOError: mf = None if not sf: if not mf: print "Not updating missing master", master return print "Creating missing slave", slave copy(master, slave, answer=create_files) return if sf and mf: if identical(sf, mf): return sft = mtime(sf) mft = mtime(mf) if mft > sft: # Master is newer -- copy master to slave sf.close() mf.close() print "Master ", master print "is newer than slave", slave copy(master, slave, answer=write_slave) return # Slave is newer -- copy slave to master # But first check what to do about CRLF mf.seek(0) fun = funnychars(mf) mf.close() sf.close() if fun: print "***UPDATING MASTER (BINARY COPY)***" copy(slave, master, "rb", answer=write_master) else: print "***UPDATING MASTER***" copy(slave, master, "r", answer=write_master) | 79b2038aa40a7532e7aa3dc9c3bfbc3fd1228630 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/79b2038aa40a7532e7aa3dc9c3bfbc3fd1228630/treesync.py |
print "Not updating missing master", master | print "Neither master nor slave exists", master | def compare(slave, master): try: sf = open(slave, 'rb') except IOError: sf = None try: mf = open(master, 'rb') except IOError: mf = None if not sf: if not mf: print "Not updating missing master", master return print "Creating missing slave", slave copy(master, slave, answer=create_files) return if sf and mf: if identical(sf, mf): return sft = mtime(sf) mft = mtime(mf) if mft > sft: # Master is newer -- copy master to slave sf.close() mf.close() print "Master ", master print "is newer than slave", slave copy(master, slave, answer=write_slave) return # Slave is newer -- copy slave to master # But first check what to do about CRLF mf.seek(0) fun = funnychars(mf) mf.close() sf.close() if fun: print "***UPDATING MASTER (BINARY COPY)***" copy(slave, master, "rb", answer=write_master) else: print "***UPDATING MASTER***" copy(slave, master, "r", answer=write_master) | 79b2038aa40a7532e7aa3dc9c3bfbc3fd1228630 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/79b2038aa40a7532e7aa3dc9c3bfbc3fd1228630/treesync.py |
def make_gui(self): pyshell = self.pyshell self.flist = pyshell.flist self.root = root = pyshell.root self.top = top =ListedToplevel(root) self.top.wm_title("Debug Control") self.top.wm_iconname("Debug") top.wm_protocol("WM_DELETE_WINDOW", self.close) self.top.bind("<Escape>", self.close) # self.bframe = bframe = Frame(top) self.bframe.pack(anchor="w") self.buttons = bl = [] # self.bcont = b = Button(bframe, text="Go", command=self.cont) bl.append(b) self.bstep = b = Button(bframe, text="Step", command=self.step) bl.append(b) self.bnext = b = Button(bframe, text="Over", command=self.next) bl.append(b) self.bret = b = Button(bframe, text="Out", command=self.ret) bl.append(b) self.bret = b = Button(bframe, text="Quit", command=self.quit) bl.append(b) # for b in bl: b.configure(state="disabled") b.pack(side="left") # self.cframe = cframe = Frame(bframe) self.cframe.pack(side="left") # if not self.vstack: self.__class__.vstack = BooleanVar(top) self.vstack.set(1) self.bstack = Checkbutton(cframe, text="Stack", command=self.show_stack, variable=self.vstack) self.bstack.grid(row=0, column=0) if not self.vsource: self.__class__.vsource = BooleanVar(top) ##self.vsource.set(1) self.bsource = Checkbutton(cframe, text="Source", command=self.show_source, variable=self.vsource) self.bsource.grid(row=0, column=1) if not self.vlocals: self.__class__.vlocals = BooleanVar(top) self.vlocals.set(1) self.blocals = Checkbutton(cframe, text="Locals", command=self.show_locals, variable=self.vlocals) self.blocals.grid(row=1, column=0) if not self.vglobals: self.__class__.vglobals = BooleanVar(top) ##self.vglobals.set(1) self.bglobals = Checkbutton(cframe, text="Globals", command=self.show_globals, variable=self.vglobals) self.bglobals.grid(row=1, column=1) # self.status = Label(top, anchor="w") self.status.pack(anchor="w") self.error = Label(top, anchor="w") self.error.pack(anchor="w", fill="x") self.errorbg = self.error.cget("background") # self.fstack = Frame(top, height=1) self.fstack.pack(expand=1, fill="both") self.flocals = Frame(top) self.flocals.pack(expand=1, fill="both") self.fglobals = Frame(top, height=1) self.fglobals.pack(expand=1, fill="both") # if self.vstack.get(): self.show_stack() if self.vlocals.get(): self.show_locals() if self.vglobals.get(): self.show_globals() | 491427dfe1403506e522d7a61a71020be2c3e6e1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/491427dfe1403506e522d7a61a71020be2c3e6e1/Debugger.py |
||
def make_gui(self): pyshell = self.pyshell self.flist = pyshell.flist self.root = root = pyshell.root self.top = top =ListedToplevel(root) self.top.wm_title("Debug Control") self.top.wm_iconname("Debug") top.wm_protocol("WM_DELETE_WINDOW", self.close) self.top.bind("<Escape>", self.close) # self.bframe = bframe = Frame(top) self.bframe.pack(anchor="w") self.buttons = bl = [] # self.bcont = b = Button(bframe, text="Go", command=self.cont) bl.append(b) self.bstep = b = Button(bframe, text="Step", command=self.step) bl.append(b) self.bnext = b = Button(bframe, text="Over", command=self.next) bl.append(b) self.bret = b = Button(bframe, text="Out", command=self.ret) bl.append(b) self.bret = b = Button(bframe, text="Quit", command=self.quit) bl.append(b) # for b in bl: b.configure(state="disabled") b.pack(side="left") # self.cframe = cframe = Frame(bframe) self.cframe.pack(side="left") # if not self.vstack: self.__class__.vstack = BooleanVar(top) self.vstack.set(1) self.bstack = Checkbutton(cframe, text="Stack", command=self.show_stack, variable=self.vstack) self.bstack.grid(row=0, column=0) if not self.vsource: self.__class__.vsource = BooleanVar(top) ##self.vsource.set(1) self.bsource = Checkbutton(cframe, text="Source", command=self.show_source, variable=self.vsource) self.bsource.grid(row=0, column=1) if not self.vlocals: self.__class__.vlocals = BooleanVar(top) self.vlocals.set(1) self.blocals = Checkbutton(cframe, text="Locals", command=self.show_locals, variable=self.vlocals) self.blocals.grid(row=1, column=0) if not self.vglobals: self.__class__.vglobals = BooleanVar(top) ##self.vglobals.set(1) self.bglobals = Checkbutton(cframe, text="Globals", command=self.show_globals, variable=self.vglobals) self.bglobals.grid(row=1, column=1) # self.status = Label(top, anchor="w") self.status.pack(anchor="w") self.error = Label(top, anchor="w") self.error.pack(anchor="w", fill="x") self.errorbg = self.error.cget("background") # self.fstack = Frame(top, height=1) self.fstack.pack(expand=1, fill="both") self.flocals = Frame(top) self.flocals.pack(expand=1, fill="both") self.fglobals = Frame(top, height=1) self.fglobals.pack(expand=1, fill="both") # if self.vstack.get(): self.show_stack() if self.vlocals.get(): self.show_locals() if self.vglobals.get(): self.show_globals() | 491427dfe1403506e522d7a61a71020be2c3e6e1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/491427dfe1403506e522d7a61a71020be2c3e6e1/Debugger.py |
||
msg = self.idb.set_break(filename, lineno) if msg: text.bell() return | self.idb.set_break(filename, lineno) | def set_breakpoint_here(self, filename, lineno): msg = self.idb.set_break(filename, lineno) if msg: text.bell() return | 491427dfe1403506e522d7a61a71020be2c3e6e1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/491427dfe1403506e522d7a61a71020be2c3e6e1/Debugger.py |
msg = self.idb.clear_break(filename, lineno) if msg: text.bell() return | self.idb.clear_break(filename, lineno) | def clear_breakpoint_here(self, filename, lineno): msg = self.idb.clear_break(filename, lineno) if msg: text.bell() return | 491427dfe1403506e522d7a61a71020be2c3e6e1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/491427dfe1403506e522d7a61a71020be2c3e6e1/Debugger.py |
msg = self.idb.clear_all_file_breaks(filename) if msg: text.bell() return | self.idb.clear_all_file_breaks(filename) | def clear_file_breaks(self, filename): msg = self.idb.clear_all_file_breaks(filename) if msg: text.bell() return | 491427dfe1403506e522d7a61a71020be2c3e6e1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/491427dfe1403506e522d7a61a71020be2c3e6e1/Debugger.py |
def load_dict(self, dict, force=0, rpc_client=None): if dict is self.dict and not force: return subframe = self.subframe frame = self.frame for c in subframe.children.values(): c.destroy() self.dict = None if not dict: l = Label(subframe, text="None") l.grid(row=0, column=0) else: names = dict.keys() names.sort() row = 0 for name in names: value = dict[name] svalue = self.repr.repr(value) # repr(value) # Strip extra quotes caused by calling repr on the (already) # repr'd value sent across the RPC interface: if rpc_client: svalue = svalue[1:-1] l = Label(subframe, text=name) l.grid(row=row, column=0, sticky="nw") | 491427dfe1403506e522d7a61a71020be2c3e6e1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/491427dfe1403506e522d7a61a71020be2c3e6e1/Debugger.py |
||
def load_dict(self, dict, force=0, rpc_client=None): if dict is self.dict and not force: return subframe = self.subframe frame = self.frame for c in subframe.children.values(): c.destroy() self.dict = None if not dict: l = Label(subframe, text="None") l.grid(row=0, column=0) else: names = dict.keys() names.sort() row = 0 for name in names: value = dict[name] svalue = self.repr.repr(value) # repr(value) # Strip extra quotes caused by calling repr on the (already) # repr'd value sent across the RPC interface: if rpc_client: svalue = svalue[1:-1] l = Label(subframe, text=name) l.grid(row=row, column=0, sticky="nw") | 491427dfe1403506e522d7a61a71020be2c3e6e1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/491427dfe1403506e522d7a61a71020be2c3e6e1/Debugger.py |
||
spec_file.append('Source0: %{name}-%{version}.tar.bz2') | spec_file.append('Source0: %{name}-%{unmangled_version}.tar.bz2') | def _make_spec_file(self): """Generate the text of an RPM spec file and return it as a list of strings (one per line). """ # definitions and headers spec_file = [ '%define name ' + self.distribution.get_name(), '%define version ' + self.distribution.get_version().replace('-','_'), '%define release ' + self.release.replace('-','_'), '', 'Summary: ' + self.distribution.get_description(), ] | 45cd4ff95d46f7a52e8717c80a47fbdece865775 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/45cd4ff95d46f7a52e8717c80a47fbdece865775/bdist_rpm.py |
spec_file.append('Source0: %{name}-%{version}.tar.gz') | spec_file.append('Source0: %{name}-%{unmangled_version}.tar.gz') | def _make_spec_file(self): """Generate the text of an RPM spec file and return it as a list of strings (one per line). """ # definitions and headers spec_file = [ '%define name ' + self.distribution.get_name(), '%define version ' + self.distribution.get_version().replace('-','_'), '%define release ' + self.release.replace('-','_'), '', 'Summary: ' + self.distribution.get_description(), ] | 45cd4ff95d46f7a52e8717c80a47fbdece865775 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/45cd4ff95d46f7a52e8717c80a47fbdece865775/bdist_rpm.py |
('prep', 'prep_script', "%setup"), | ('prep', 'prep_script', "%setup -n %{name}-%{unmangled_version}"), | def _make_spec_file(self): """Generate the text of an RPM spec file and return it as a list of strings (one per line). """ # definitions and headers spec_file = [ '%define name ' + self.distribution.get_name(), '%define version ' + self.distribution.get_version().replace('-','_'), '%define release ' + self.release.replace('-','_'), '', 'Summary: ' + self.distribution.get_description(), ] | 45cd4ff95d46f7a52e8717c80a47fbdece865775 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/45cd4ff95d46f7a52e8717c80a47fbdece865775/bdist_rpm.py |
exts.append( Extension('cPickle', ['cPickle.c']) ) | def detect_modules(self): # Ensure that /usr/local is always used add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') add_dir_to_list(self.compiler.include_dirs, '/usr/local/include') | 512ab9f8d34e450d5ee35e264dc29004b08d7b73 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/512ab9f8d34e450d5ee35e264dc29004b08d7b73/setup.py |
|
def __init__(self, file): | def __init__(self, file, mode): self._mode = mode | def __init__(self, file): self._dirfile = file + _os.extsep + 'dir' self._datfile = file + _os.extsep + 'dat' self._bakfile = file + _os.extsep + 'bak' # Mod by Jack: create data file if needed try: f = _open(self._datfile, 'r') except IOError: f = _open(self._datfile, 'w') f.close() self._update() | 2c8373bc234039fff699df9c28d2cb74efd6a37c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/2c8373bc234039fff699df9c28d2cb74efd6a37c/dumbdbm.py |
f = _open(self._datfile, 'w') | f = _open(self._datfile, 'w', self._mode) | def __init__(self, file): self._dirfile = file + _os.extsep + 'dir' self._datfile = file + _os.extsep + 'dat' self._bakfile = file + _os.extsep + 'bak' # Mod by Jack: create data file if needed try: f = _open(self._datfile, 'r') except IOError: f = _open(self._datfile, 'w') f.close() self._update() | 2c8373bc234039fff699df9c28d2cb74efd6a37c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/2c8373bc234039fff699df9c28d2cb74efd6a37c/dumbdbm.py |
f = _open(self._dirfile, 'w') | f = _open(self._dirfile, 'w', self._mode) | def _commit(self): try: _os.unlink(self._bakfile) except _os.error: pass try: _os.rename(self._dirfile, self._bakfile) except _os.error: pass f = _open(self._dirfile, 'w') for key, (pos, siz) in self._index.items(): f.write("%s, (%s, %s)\n" % (`key`, `pos`, `siz`)) f.close() | 2c8373bc234039fff699df9c28d2cb74efd6a37c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/2c8373bc234039fff699df9c28d2cb74efd6a37c/dumbdbm.py |
f = _open(self._dirfile, 'a') | f = _open(self._dirfile, 'a', self._mode) | def _addkey(self, key, (pos, siz)): self._index[key] = (pos, siz) f = _open(self._dirfile, 'a') f.write("%s, (%s, %s)\n" % (`key`, `pos`, `siz`)) f.close() | 2c8373bc234039fff699df9c28d2cb74efd6a37c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/2c8373bc234039fff699df9c28d2cb74efd6a37c/dumbdbm.py |
print 'ratecv' state = (-8000, ((256, 512),)) if audioop.ratecv(data[0], 1, 1, 8000, 16000, state) != \ ('\001\000\000\001\001\002', state): return 0 | print 'ratecv' state = None d1, state = audioop.ratecv(data[0], 1, 1, 8000, 16000, state) d2, state = audioop.ratecv(data[0], 1, 1, 8000, 16000, state) if d1 + d2 != '\000\000\001\001\002\001\000\000\001\001\002': return 0 | def testratecv(data): if verbose: print 'ratecv' state = (-8000, ((256, 512),)) if audioop.ratecv(data[0], 1, 1, 8000, 16000, state) != \ ('\001\000\000\001\001\002', state): return 0 return 1 | 05ba2ab720dff2a2966a481329a4f90bea5eea85 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/05ba2ab720dff2a2966a481329a4f90bea5eea85/test_audioop.py |
'%define version ' + self.distribution.get_version(), '%define release ' + self.release, | '%define version ' + self.distribution.get_version().replace('-','_'), '%define release ' + self.release.replace('-','_'), | def _make_spec_file(self): """Generate the text of an RPM spec file and return it as a list of strings (one per line). """ # definitions and headers spec_file = [ '%define name ' + self.distribution.get_name(), '%define version ' + self.distribution.get_version(), '%define release ' + self.release, '', 'Summary: ' + self.distribution.get_description(), ] | cae9e673d601a815c06d2755371cfcf89d314239 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/cae9e673d601a815c06d2755371cfcf89d314239/bdist_rpm.py |
'lib.' + self.plat) | 'lib-' + plat_specifier) | def finalize_options (self): | 42900941b8699be5119e2eb1f0bebd5f21222801 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/42900941b8699be5119e2eb1f0bebd5f21222801/build.py |
'temp.' + self.plat) | 'temp-' + plat_specifier) | def finalize_options (self): | 42900941b8699be5119e2eb1f0bebd5f21222801 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/42900941b8699be5119e2eb1f0bebd5f21222801/build.py |
def runctx(statement, globals, locals, filename=None): """Run statement under profiler, supplying your own globals and locals, optionally saving results in filename. statement and filename have the same semantics as profile.run """ prof = Profile() try: prof = prof.runctx(statement, globals, locals) except SystemExit: pass if filename is not None: prof.dump_stats(filename) else: return prof.print_stats() | c0b194a77082f2db4b5689a27e73f07fa046fa79 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c0b194a77082f2db4b5689a27e73f07fa046fa79/profile.py |
||
for dirname in sys.path: fullname = os.path.join(dirname, 'profile.doc') if os.path.exists(fullname): sts = os.system('${PAGER-more} ' + fullname) if sts: print '*** Pager exit status:', sts break else: print 'Sorry, can\'t find the help file "profile.doc"', print 'along the Python search path.' | print "Documentation for the profile module can be found " print "in the Python Library Reference, section 'The Python Profiler'." | def help(): for dirname in sys.path: fullname = os.path.join(dirname, 'profile.doc') if os.path.exists(fullname): sts = os.system('${PAGER-more} ' + fullname) if sts: print '*** Pager exit status:', sts break else: print 'Sorry, can\'t find the help file "profile.doc"', print 'along the Python search path.' | c0b194a77082f2db4b5689a27e73f07fa046fa79 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c0b194a77082f2db4b5689a27e73f07fa046fa79/profile.py |
if auth: h.putheader('Authorization', 'Basic %s' % auth) | if proxy_auth: h.putheader('Proxy-Authorization: Basic %s' % proxy_auth) if auth: h.putheader('Authorization: Basic %s' % auth) | def open_https(self, url, data=None): """Use HTTPS protocol.""" import httplib user_passwd = None if isinstance(url, str): host, selector = splithost(url) if host: user_passwd, host = splituser(host) host = unquote(host) realhost = host else: host, selector = url urltype, rest = splittype(selector) url = rest user_passwd = None if urltype.lower() != 'https': realhost = None else: realhost, rest = splithost(rest) if realhost: user_passwd, realhost = splituser(realhost) if user_passwd: selector = "%s://%s%s" % (urltype, realhost, rest) #print "proxy via https:", host, selector if not host: raise IOError, ('https error', 'no host given') if user_passwd: import base64 auth = base64.encodestring(user_passwd).strip() else: auth = None h = httplib.HTTPS(host, 0, key_file=self.key_file, cert_file=self.cert_file) 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) if realhost: h.putheader('Host', realhost) for args in self.addheaders: h.putheader(*args) h.endheaders() if data is not None: h.send(data) errcode, errmsg, headers = h.getreply() fp = h.getfile() if errcode == 200: return addinfourl(fp, headers, "https:" + url) else: if data is None: return self.http_error(url, fp, errcode, errmsg, headers) else: return self.http_error(url, fp, errcode, errmsg, headers, data) | 3e86595280a9714354372f91108be4d184da8a5f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3e86595280a9714354372f91108be4d184da8a5f/urllib.py |
See this URL for a description of the basic authentication scheme: http://www.ics.uci.edu/pub/ietf/http/draft-ietf-http-v10-spec-00.txt""" | This function supports Basic authentication only.""" | def http_error_401(self, url, fp, errcode, errmsg, headers, data=None): """Error 401 -- authentication required. See this URL for a description of the basic authentication scheme: http://www.ics.uci.edu/pub/ietf/http/draft-ietf-http-v10-spec-00.txt""" if not 'www-authenticate' in headers: URLopener.http_error_default(self, url, fp, errcode, errmsg, headers) stuff = headers['www-authenticate'] import re match = re.match('[ \t]*([^ \t]+)[ \t]+realm="([^"]*)"', stuff) if not match: URLopener.http_error_default(self, url, fp, errcode, errmsg, headers) scheme, realm = match.groups() if scheme.lower() != 'basic': URLopener.http_error_default(self, url, fp, errcode, errmsg, headers) name = 'retry_' + self.type + '_basic_auth' if data is None: return getattr(self,name)(url, realm) else: return getattr(self,name)(url, realm, data) | 3e86595280a9714354372f91108be4d184da8a5f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3e86595280a9714354372f91108be4d184da8a5f/urllib.py |
def http_error_407(self, url, fp, errcode, errmsg, headers, data=None): """Error 407 -- proxy authentication required. This function supports Basic authentication only.""" if not 'proxy-authenticate' in headers: URLopener.http_error_default(self, url, fp, errcode, errmsg, headers) stuff = headers['proxy-authenticate'] import re match = re.match('[ \t]*([^ \t]+)[ \t]+realm="([^"]*)"', stuff) if not match: URLopener.http_error_default(self, url, fp, errcode, errmsg, headers) scheme, realm = match.groups() if scheme.lower() != 'basic': URLopener.http_error_default(self, url, fp, errcode, errmsg, headers) name = 'retry_proxy_' + self.type + '_basic_auth' if data is None: return getattr(self,name)(url, realm) else: return getattr(self,name)(url, realm, data) def retry_proxy_http_basic_auth(self, url, realm, data=None): host, selector = splithost(url) newurl = 'http://' + host + selector proxy = self.proxies['http'] urltype, proxyhost = splittype(proxy) proxyhost, proxyselector = splithost(proxyhost) i = proxyhost.find('@') + 1 proxyhost = proxyhost[i:] user, passwd = self.get_user_passwd(proxyhost, realm, i) if not (user or passwd): return None proxyhost = quote(user, safe='') + ':' + quote(passwd, safe='') + '@' + proxyhost self.proxies['http'] = 'http://' + proxyhost + proxyselector if data is None: return self.open(newurl) else: return self.open(newurl, data) def retry_proxy_https_basic_auth(self, url, realm, data=None): host, selector = splithost(url) newurl = 'https://' + host + selector proxy = self.proxies['https'] urltype, proxyhost = splittype(proxy) proxyhost, proxyselector = splithost(proxyhost) i = proxyhost.find('@') + 1 proxyhost = proxyhost[i:] user, passwd = self.get_user_passwd(proxyhost, realm, i) if not (user or passwd): return None proxyhost = quote(user, safe='') + ':' + quote(passwd, safe='') + '@' + proxyhost self.proxies['https'] = 'https://' + proxyhost + proxyselector if data is None: return self.open(newurl) else: return self.open(newurl, data) | def http_error_401(self, url, fp, errcode, errmsg, headers, data=None): """Error 401 -- authentication required. See this URL for a description of the basic authentication scheme: http://www.ics.uci.edu/pub/ietf/http/draft-ietf-http-v10-spec-00.txt""" if not 'www-authenticate' in headers: URLopener.http_error_default(self, url, fp, errcode, errmsg, headers) stuff = headers['www-authenticate'] import re match = re.match('[ \t]*([^ \t]+)[ \t]+realm="([^"]*)"', stuff) if not match: URLopener.http_error_default(self, url, fp, errcode, errmsg, headers) scheme, realm = match.groups() if scheme.lower() != 'basic': URLopener.http_error_default(self, url, fp, errcode, errmsg, headers) name = 'retry_' + self.type + '_basic_auth' if data is None: return getattr(self,name)(url, realm) else: return getattr(self,name)(url, realm, data) | 3e86595280a9714354372f91108be4d184da8a5f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3e86595280a9714354372f91108be4d184da8a5f/urllib.py |
|
newurl = '//' + host + selector return self.open_https(newurl, data) | newurl = 'https://' + host + selector if data is None: return self.open(newurl) else: return self.open(newurl, data) | def retry_https_basic_auth(self, url, realm, data=None): host, selector = splithost(url) i = host.find('@') + 1 host = host[i:] user, passwd = self.get_user_passwd(host, realm, i) if not (user or passwd): return None host = quote(user, safe='') + ':' + quote(passwd, safe='') + '@' + host newurl = '//' + host + selector return self.open_https(newurl, data) | 3e86595280a9714354372f91108be4d184da8a5f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3e86595280a9714354372f91108be4d184da8a5f/urllib.py |
print >> sys.stderr, """\ WARNING: an attempt to connect to %r timed out, in test_timeout. That may be legitimate, but is not the outcome we hoped for. If this message is seen often, test_timeout should be changed to use a more reliable address.""" % (ADDR,) | error_msg('timed out') | def test_timeout(): test_support.requires('network') if test_support.verbose: print "test_timeout ..." # A service which issues a welcome banner (without need to write # anything). # XXX ("gmail.org", 995) has been unreliable so far, from time to time # XXX non-responsive for hours on end (& across all buildbot slaves, # XXX so that's not just a local thing). ADDR = "gmail.org", 995 s = socket.socket() s.settimeout(30.0) try: s.connect(ADDR) except socket.timeout: print >> sys.stderr, """\ WARNING: an attempt to connect to %r timed out, in test_timeout. That may be legitimate, but is not the outcome we hoped for. If this message is seen often, test_timeout should be changed to use a more reliable address.""" % (ADDR,) return except socket.error, exc: # In case connection is refused. if exc.args[0] == errno.ECONNREFUSED: print "Connection refused when connecting to", ADDR return else: raise ss = socket.ssl(s) # Read part of return welcome banner twice. ss.read(1) ss.read(1) s.close() | 877fdb01fed44e00863f09150b449aa838a3d3dc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/877fdb01fed44e00863f09150b449aa838a3d3dc/test_socket_ssl.py |
print "Connection refused when connecting to", ADDR | error_msg('was refused') | def test_timeout(): test_support.requires('network') if test_support.verbose: print "test_timeout ..." # A service which issues a welcome banner (without need to write # anything). # XXX ("gmail.org", 995) has been unreliable so far, from time to time # XXX non-responsive for hours on end (& across all buildbot slaves, # XXX so that's not just a local thing). ADDR = "gmail.org", 995 s = socket.socket() s.settimeout(30.0) try: s.connect(ADDR) except socket.timeout: print >> sys.stderr, """\ WARNING: an attempt to connect to %r timed out, in test_timeout. That may be legitimate, but is not the outcome we hoped for. If this message is seen often, test_timeout should be changed to use a more reliable address.""" % (ADDR,) return except socket.error, exc: # In case connection is refused. if exc.args[0] == errno.ECONNREFUSED: print "Connection refused when connecting to", ADDR return else: raise ss = socket.ssl(s) # Read part of return welcome banner twice. ss.read(1) ss.read(1) s.close() | 877fdb01fed44e00863f09150b449aa838a3d3dc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/877fdb01fed44e00863f09150b449aa838a3d3dc/test_socket_ssl.py |
if __name__ == "__main__": import __main__ sys.modules['warnings'] = __main__ _test() else: _processoptions(sys.warnoptions) simplefilter("ignore", category=OverflowWarning, append=1) simplefilter("ignore", category=PendingDeprecationWarning, append=1) | _processoptions(sys.warnoptions) simplefilter("ignore", category=OverflowWarning, append=1) simplefilter("ignore", category=PendingDeprecationWarning, append=1) | def _getcategory(category): import re if not category: return Warning if re.match("^[a-zA-Z0-9_]+$", category): try: cat = eval(category) except NameError: raise _OptionError("unknown warning category: %r" % (category,)) else: i = category.rfind(".") module = category[:i] klass = category[i+1:] try: m = __import__(module, None, None, [klass]) except ImportError: raise _OptionError("invalid module name: %r" % (module,)) try: cat = getattr(m, klass) except AttributeError: raise _OptionError("unknown warning category: %r" % (category,)) if (not isinstance(cat, types.ClassType) or not issubclass(cat, Warning)): raise _OptionError("invalid warning category: %r" % (category,)) return cat | 660252047347d1effbe00162ff990fc7a57d4d2a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/660252047347d1effbe00162ff990fc7a57d4d2a/warnings.py |
print f(2)(5) | class TestFuture(unittest.TestCase): def test_floor_div_operator(self): self.assertEqual(7 // 2, 3) def test_true_div_as_default(self): self.assertAlmostEqual(7 / 2, 3.5) def test_nested_scopes(self): self.assertEqual(nester(), 3) def test_main(): test_support.run_unittest(TestFuture) if __name__ == "__main__": test_main() | def g(y): return y // x | 158af581ae68bd858eae1319845554cfdb742cc4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/158af581ae68bd858eae1319845554cfdb742cc4/test_future3.py |
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) | dcfdceb9a21881b58f0278dda92a7cdce6782614 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/dcfdceb9a21881b58f0278dda92a7cdce6782614/test_hexoct.py |
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) | dcfdceb9a21881b58f0278dda92a7cdce6782614 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/dcfdceb9a21881b58f0278dda92a7cdce6782614/test_hexoct.py |
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) | dcfdceb9a21881b58f0278dda92a7cdce6782614 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/dcfdceb9a21881b58f0278dda92a7cdce6782614/test_hexoct.py |
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""" | dcfdceb9a21881b58f0278dda92a7cdce6782614 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/dcfdceb9a21881b58f0278dda92a7cdce6782614/test_hexoct.py |
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) | dcfdceb9a21881b58f0278dda92a7cdce6782614 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/dcfdceb9a21881b58f0278dda92a7cdce6782614/test_hexoct.py |
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) | dcfdceb9a21881b58f0278dda92a7cdce6782614 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/dcfdceb9a21881b58f0278dda92a7cdce6782614/test_hexoct.py |
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) | dcfdceb9a21881b58f0278dda92a7cdce6782614 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/dcfdceb9a21881b58f0278dda92a7cdce6782614/test_hexoct.py |
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""" | dcfdceb9a21881b58f0278dda92a7cdce6782614 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/dcfdceb9a21881b58f0278dda92a7cdce6782614/test_hexoct.py |
self.tk.call('destroy', self._w) | def destroy(self): """Destroy this and all descendants widgets.""" for c in self.children.values(): c.destroy() if self.master.children.has_key(self._name): del self.master.children[self._name] self.tk.call('destroy', self._w) Misc.destroy(self) | 92733be85e89ac0d7c1c3a4d57eff0373d9f4b5f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/92733be85e89ac0d7c1c3a4d57eff0373d9f4b5f/Tkinter.py |
|
badargs = 10, 10L, 34.5, "abc", {}, [], () for badarg in badargs: | for badarg in OTHERSTUFF: | def test_compare(self): t1 = timedelta(2, 3, 4) t2 = timedelta(2, 3, 4) self.failUnless(t1 == t2) self.failUnless(t1 <= t2) self.failUnless(t1 >= t2) self.failUnless(not t1 != t2) self.failUnless(not t1 < t2) self.failUnless(not t1 > t2) self.assertEqual(cmp(t1, t2), 0) self.assertEqual(cmp(t2, t1), 0) | 68124bb771697104add6c850139684729e2e6777 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/68124bb771697104add6c850139684729e2e6777/test_datetime.py |
for badarg in badargs: | def test_compare(self): t1 = timedelta(2, 3, 4) t2 = timedelta(2, 3, 4) self.failUnless(t1 == t2) self.failUnless(t1 <= t2) self.failUnless(t1 >= t2) self.failUnless(not t1 != t2) self.failUnless(not t1 < t2) self.failUnless(not t1 > t2) self.assertEqual(cmp(t1, t2), 0) self.assertEqual(cmp(t2, t1), 0) | 68124bb771697104add6c850139684729e2e6777 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/68124bb771697104add6c850139684729e2e6777/test_datetime.py |
|
badargs = 10, 10L, 34.5, "abc", {}, [], () for badarg in badargs: | for badarg in OTHERSTUFF: | def test_compare(self): t1 = self.theclass(2, 3, 4) t2 = self.theclass(2, 3, 4) self.failUnless(t1 == t2) self.failUnless(t1 <= t2) self.failUnless(t1 >= t2) self.failUnless(not t1 != t2) self.failUnless(not t1 < t2) self.failUnless(not t1 > t2) self.assertEqual(cmp(t1, t2), 0) self.assertEqual(cmp(t2, t1), 0) | 68124bb771697104add6c850139684729e2e6777 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/68124bb771697104add6c850139684729e2e6777/test_datetime.py |
for badarg in badargs: | def test_compare(self): t1 = self.theclass(2, 3, 4) t2 = self.theclass(2, 3, 4) self.failUnless(t1 == t2) self.failUnless(t1 <= t2) self.failUnless(t1 >= t2) self.failUnless(not t1 != t2) self.failUnless(not t1 < t2) self.failUnless(not t1 > t2) self.assertEqual(cmp(t1, t2), 0) self.assertEqual(cmp(t2, t1), 0) | 68124bb771697104add6c850139684729e2e6777 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/68124bb771697104add6c850139684729e2e6777/test_datetime.py |
|
badargs = (10, 10L, 34.5, "abc", {}, [], ()) if CMP_BUG_FIXED: badargs += (date(1, 1, 1), datetime(1, 1, 1, 1, 1), timedelta(9)) for badarg in badargs: | for badarg in OTHERSTUFF: | def test_comparing(self): args = [1, 2, 3, 4] t1 = self.theclass(*args) t2 = self.theclass(*args) self.failUnless(t1 == t2) self.failUnless(t1 <= t2) self.failUnless(t1 >= t2) self.failUnless(not t1 != t2) self.failUnless(not t1 < t2) self.failUnless(not t1 > t2) self.assertEqual(cmp(t1, t2), 0) self.assertEqual(cmp(t2, t1), 0) | 68124bb771697104add6c850139684729e2e6777 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/68124bb771697104add6c850139684729e2e6777/test_datetime.py |
for badarg in badargs: | def test_comparing(self): args = [1, 2, 3, 4] t1 = self.theclass(*args) t2 = self.theclass(*args) self.failUnless(t1 == t2) self.failUnless(t1 <= t2) self.failUnless(t1 >= t2) self.failUnless(not t1 != t2) self.failUnless(not t1 < t2) self.failUnless(not t1 > t2) self.assertEqual(cmp(t1, t2), 0) self.assertEqual(cmp(t2, t1), 0) | 68124bb771697104add6c850139684729e2e6777 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/68124bb771697104add6c850139684729e2e6777/test_datetime.py |
|
if CMP_BUG_FIXED: t2 = t2.replace(tzinfo=FixedOffset(0, "")) self.assertRaises(TypeError, lambda: t1 == t2) | t2 = t2.replace(tzinfo=FixedOffset(0, "")) self.assertRaises(TypeError, lambda: t1 == t2) | def test_mixed_compare(self): t1 = time(1, 2, 3) t2 = time(1, 2, 3) self.assertEqual(t1, t2) t2 = t2.replace(tzinfo=None) self.assertEqual(t1, t2) t2 = t2.replace(tzinfo=FixedOffset(None, "")) self.assertEqual(t1, t2) if CMP_BUG_FIXED: t2 = t2.replace(tzinfo=FixedOffset(0, "")) self.assertRaises(TypeError, lambda: t1 == t2) | 68124bb771697104add6c850139684729e2e6777 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/68124bb771697104add6c850139684729e2e6777/test_datetime.py |
if CMP_BUG_FIXED: t2 = t2.replace(tzinfo=FixedOffset(0, "")) self.assertRaises(TypeError, lambda: t1 == t2) | t2 = t2.replace(tzinfo=FixedOffset(0, "")) self.assertRaises(TypeError, lambda: t1 == t2) | def test_mixed_compare(self): t1 = datetime(1, 2, 3, 4, 5, 6, 7) t2 = datetime(1, 2, 3, 4, 5, 6, 7) self.assertEqual(t1, t2) t2 = t2.replace(tzinfo=None) self.assertEqual(t1, t2) t2 = t2.replace(tzinfo=FixedOffset(None, "")) self.assertEqual(t1, t2) if CMP_BUG_FIXED: t2 = t2.replace(tzinfo=FixedOffset(0, "")) self.assertRaises(TypeError, lambda: t1 == t2) | 68124bb771697104add6c850139684729e2e6777 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/68124bb771697104add6c850139684729e2e6777/test_datetime.py |
(Defaults to 1) clamp - If 1, change exponents if too high (Default 0) | _clamp - If 1, change exponents if too high (Default 0) | def __deepcopy__(self, memo): if type(self) == Decimal: return self # My components are also immutable return self.__class__(str(self)) | e0f1581babe682552d7eadc4e54636b1c2775f0b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e0f1581babe682552d7eadc4e54636b1c2775f0b/decimal.py |
capitals=1, _clamp=0, | capitals=None, _clamp=0, | def __init__(self, prec=None, rounding=None, trap_enablers=None, flags=None, _rounding_decision=None, Emin=None, Emax=None, capitals=1, _clamp=0, _ignored_flags=[]): if flags is None: flags = dict.fromkeys(Signals, 0) self.DefaultLock.acquire() for name, val in locals().items(): if val is None: setattr(self, name, copy.copy(getattr(DefaultContext, name))) else: setattr(self, name, val) self.DefaultLock.release() del self.self | e0f1581babe682552d7eadc4e54636b1c2775f0b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e0f1581babe682552d7eadc4e54636b1c2775f0b/decimal.py |
"""Returns maximum exponent (= Emin - prec + 1)""" | """Returns maximum exponent (= Emax - prec + 1)""" | def Etop(self): """Returns maximum exponent (= Emin - prec + 1)""" return int(self.Emax - self.prec + 1) | e0f1581babe682552d7eadc4e54636b1c2775f0b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e0f1581babe682552d7eadc4e54636b1c2775f0b/decimal.py |
"""normalize reduces its operand to its simplest form. | """normalize reduces an operand to its simplest form. | def normalize(self, a): """normalize reduces its operand to its simplest form. | e0f1581babe682552d7eadc4e54636b1c2775f0b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e0f1581babe682552d7eadc4e54636b1c2775f0b/decimal.py |
Emin=DEFAULT_MIN_EXPONENT | Emin=DEFAULT_MIN_EXPONENT, capitals=1 | def _isnan(num): """Determines whether a string or float is NaN (1, sign, diagnostic info as string) => NaN (2, sign, diagnostic info as string) => sNaN 0 => not a NaN """ num = str(num).lower() if not num: return 0 #get the sign, get rid of trailing [+-] sign = 0 if num[0] == '+': num = num[1:] elif num[0] == '-': #elif avoids '+-nan' num = num[1:] sign = 1 if num.startswith('nan'): if len(num) > 3 and not num[3:].isdigit(): #diagnostic info return 0 return (1, sign, num[3:].lstrip('0')) if num.startswith('snan'): if len(num) > 4 and not num[4:].isdigit(): return 0 return (2, sign, num[4:].lstrip('0')) return 0 | e0f1581babe682552d7eadc4e54636b1c2775f0b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e0f1581babe682552d7eadc4e54636b1c2775f0b/decimal.py |
created_dirs = [] | def mkpath (name, mode=0777, verbose=0, dry_run=0): """Create a directory and any missing ancestor directories. If the directory already exists, return silently. Raise DistutilsFileError if unable to create some directory along the way (eg. some sub-path exists, but is a file rather than a directory). If 'verbose' is true, print a one-line summary of each mkdir to stdout.""" global PATH_CREATED # XXX what's the better way to handle verbosity? print as we create # each directory in the path (the current behaviour), or only announce # the creation of the whole path? (quite easy to do the latter since # we're not using a recursive algorithm) name = os.path.normpath (name) if os.path.isdir (name) or name == '': return if PATH_CREATED.get (name): return (head, tail) = os.path.split (name) tails = [tail] # stack of lone dirs to create while head and tail and not os.path.isdir (head): #print "splitting '%s': " % head, (head, tail) = os.path.split (head) #print "to ('%s','%s')" % (head, tail) tails.insert (0, tail) # push next higher dir onto stack #print "stack of tails:", tails # now 'head' contains the deepest directory that already exists # (that is, the child of 'head' in 'name' is the highest directory # that does *not* exist) for d in tails: #print "head = %s, d = %s: " % (head, d), head = os.path.join (head, d) if PATH_CREATED.get (head): continue if verbose: print "creating", head if not dry_run: try: os.mkdir (head) except os.error, (errno, errstr): raise DistutilsFileError, \ "could not create '%s': %s" % (head, errstr) PATH_CREATED[head] = 1 | da4d1aef4e8f9589956ea7a1e8cf2bbb249cb0eb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/da4d1aef4e8f9589956ea7a1e8cf2bbb249cb0eb/util.py |
|
return | return created_dirs | def mkpath (name, mode=0777, verbose=0, dry_run=0): """Create a directory and any missing ancestor directories. If the directory already exists, return silently. Raise DistutilsFileError if unable to create some directory along the way (eg. some sub-path exists, but is a file rather than a directory). If 'verbose' is true, print a one-line summary of each mkdir to stdout.""" global PATH_CREATED # XXX what's the better way to handle verbosity? print as we create # each directory in the path (the current behaviour), or only announce # the creation of the whole path? (quite easy to do the latter since # we're not using a recursive algorithm) name = os.path.normpath (name) if os.path.isdir (name) or name == '': return if PATH_CREATED.get (name): return (head, tail) = os.path.split (name) tails = [tail] # stack of lone dirs to create while head and tail and not os.path.isdir (head): #print "splitting '%s': " % head, (head, tail) = os.path.split (head) #print "to ('%s','%s')" % (head, tail) tails.insert (0, tail) # push next higher dir onto stack #print "stack of tails:", tails # now 'head' contains the deepest directory that already exists # (that is, the child of 'head' in 'name' is the highest directory # that does *not* exist) for d in tails: #print "head = %s, d = %s: " % (head, d), head = os.path.join (head, d) if PATH_CREATED.get (head): continue if verbose: print "creating", head if not dry_run: try: os.mkdir (head) except os.error, (errno, errstr): raise DistutilsFileError, \ "could not create '%s': %s" % (head, errstr) PATH_CREATED[head] = 1 | da4d1aef4e8f9589956ea7a1e8cf2bbb249cb0eb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/da4d1aef4e8f9589956ea7a1e8cf2bbb249cb0eb/util.py |
return | return created_dirs | def mkpath (name, mode=0777, verbose=0, dry_run=0): """Create a directory and any missing ancestor directories. If the directory already exists, return silently. Raise DistutilsFileError if unable to create some directory along the way (eg. some sub-path exists, but is a file rather than a directory). If 'verbose' is true, print a one-line summary of each mkdir to stdout.""" global PATH_CREATED # XXX what's the better way to handle verbosity? print as we create # each directory in the path (the current behaviour), or only announce # the creation of the whole path? (quite easy to do the latter since # we're not using a recursive algorithm) name = os.path.normpath (name) if os.path.isdir (name) or name == '': return if PATH_CREATED.get (name): return (head, tail) = os.path.split (name) tails = [tail] # stack of lone dirs to create while head and tail and not os.path.isdir (head): #print "splitting '%s': " % head, (head, tail) = os.path.split (head) #print "to ('%s','%s')" % (head, tail) tails.insert (0, tail) # push next higher dir onto stack #print "stack of tails:", tails # now 'head' contains the deepest directory that already exists # (that is, the child of 'head' in 'name' is the highest directory # that does *not* exist) for d in tails: #print "head = %s, d = %s: " % (head, d), head = os.path.join (head, d) if PATH_CREATED.get (head): continue if verbose: print "creating", head if not dry_run: try: os.mkdir (head) except os.error, (errno, errstr): raise DistutilsFileError, \ "could not create '%s': %s" % (head, errstr) PATH_CREATED[head] = 1 | da4d1aef4e8f9589956ea7a1e8cf2bbb249cb0eb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/da4d1aef4e8f9589956ea7a1e8cf2bbb249cb0eb/util.py |
self._policy._now = self._now = int(time.time()) cookies = self._cookies_for_request(request) attrs = self._cookie_attrs(cookies) if attrs: if not request.has_header("Cookie"): request.add_unredirected_header( "Cookie", "; ".join(attrs)) if (self._policy.rfc2965 and not self._policy.hide_cookie2 and not request.has_header("Cookie2")): for cookie in cookies: if cookie.version != 1: request.add_unredirected_header("Cookie2", '$Version="1"') break self._cookies_lock.release() | try: self._policy._now = self._now = int(time.time()) cookies = self._cookies_for_request(request) attrs = self._cookie_attrs(cookies) if attrs: if not request.has_header("Cookie"): request.add_unredirected_header( "Cookie", "; ".join(attrs)) if (self._policy.rfc2965 and not self._policy.hide_cookie2 and not request.has_header("Cookie2")): for cookie in cookies: if cookie.version != 1: request.add_unredirected_header("Cookie2", '$Version="1"') break finally: self._cookies_lock.release() | def add_cookie_header(self, request): """Add correct Cookie: header to request (urllib2.Request object). | 29ff461c832c6677f89aa644893e4ff679393b61 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/29ff461c832c6677f89aa644893e4ff679393b61/cookielib.py |
self._policy._now = self._now = int(time.time()) if self._policy.set_ok(cookie, request): self.set_cookie(cookie) self._cookies_lock.release() | try: self._policy._now = self._now = int(time.time()) if self._policy.set_ok(cookie, request): self.set_cookie(cookie) finally: self._cookies_lock.release() | def set_cookie_if_ok(self, cookie, request): """Set a cookie if policy says it's OK to do so.""" self._cookies_lock.acquire() self._policy._now = self._now = int(time.time()) | 29ff461c832c6677f89aa644893e4ff679393b61 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/29ff461c832c6677f89aa644893e4ff679393b61/cookielib.py |
self._policy._now = self._now = int(time.time()) for cookie in self.make_cookies(response, request): if self._policy.set_ok(cookie, request): _debug(" setting cookie: %s", cookie) self.set_cookie(cookie) self._cookies_lock.release() | try: self._policy._now = self._now = int(time.time()) for cookie in self.make_cookies(response, request): if self._policy.set_ok(cookie, request): _debug(" setting cookie: %s", cookie) self.set_cookie(cookie) finally: self._cookies_lock.release() | def extract_cookies(self, response, request): """Extract cookies from response, where allowable given the request.""" _debug("extract_cookies: %s", response.info()) self._cookies_lock.acquire() self._policy._now = self._now = int(time.time()) | 29ff461c832c6677f89aa644893e4ff679393b61 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/29ff461c832c6677f89aa644893e4ff679393b61/cookielib.py |
for cookie in self: if cookie.discard: self.clear(cookie.domain, cookie.path, cookie.name) self._cookies_lock.release() | try: for cookie in self: if cookie.discard: self.clear(cookie.domain, cookie.path, cookie.name) finally: self._cookies_lock.release() | def clear_session_cookies(self): """Discard all session cookies. | 29ff461c832c6677f89aa644893e4ff679393b61 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/29ff461c832c6677f89aa644893e4ff679393b61/cookielib.py |
now = time.time() for cookie in self: if cookie.is_expired(now): self.clear(cookie.domain, cookie.path, cookie.name) self._cookies_lock.release() | try: now = time.time() for cookie in self: if cookie.is_expired(now): self.clear(cookie.domain, cookie.path, cookie.name) finally: self._cookies_lock.release() | def clear_expired_cookies(self): """Discard all expired cookies. | 29ff461c832c6677f89aa644893e4ff679393b61 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/29ff461c832c6677f89aa644893e4ff679393b61/cookielib.py |
old_state = copy.deepcopy(self._cookies) self._cookies = {} | def revert(self, filename=None, ignore_discard=False, ignore_expires=False): """Clear all cookies and reload cookies from a saved file. | 29ff461c832c6677f89aa644893e4ff679393b61 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/29ff461c832c6677f89aa644893e4ff679393b61/cookielib.py |
|
self.load(filename, ignore_discard, ignore_expires) except (LoadError, IOError): self._cookies = old_state raise self._cookies_lock.release() | old_state = copy.deepcopy(self._cookies) self._cookies = {} try: self.load(filename, ignore_discard, ignore_expires) except (LoadError, IOError): self._cookies = old_state raise finally: self._cookies_lock.release() | def revert(self, filename=None, ignore_discard=False, ignore_expires=False): """Clear all cookies and reload cookies from a saved file. | 29ff461c832c6677f89aa644893e4ff679393b61 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/29ff461c832c6677f89aa644893e4ff679393b61/cookielib.py |
interp_path = os.path.join(sys.exec_prefix, "bin", "python") | interp_path = os.path.join(sys.exec_prefix, "Resources", "Python.app", "Contents", "MacOS", "Python") if not os.path.exists(interp_path): interp_path = os.path.join(sys.exec_prefix, "bin", "python") | def _run_with_cl_interpreter(self): import Terminal interp_path = os.path.join(sys.exec_prefix, "bin", "python") file_path = self.path if not os.path.exists(interp_path): # This "can happen" if we are running IDE under MacPython-OS9. raise W.AlertError, "Can't find command-line Python" cmd = '"%s" "%s" ; exit' % (interp_path, file_path) t = Terminal.Terminal() t.do_script(with_command=cmd) | 30184f3611d867124f7030dfcb182ab89245f47a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/30184f3611d867124f7030dfcb182ab89245f47a/PyEdit.py |
t.do_script(with_command=cmd) | t.do_script(cmd) | def _run_with_cl_interpreter(self): import Terminal interp_path = os.path.join(sys.exec_prefix, "bin", "python") file_path = self.path if not os.path.exists(interp_path): # This "can happen" if we are running IDE under MacPython-OS9. raise W.AlertError, "Can't find command-line Python" cmd = '"%s" "%s" ; exit' % (interp_path, file_path) t = Terminal.Terminal() t.do_script(with_command=cmd) | 30184f3611d867124f7030dfcb182ab89245f47a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/30184f3611d867124f7030dfcb182ab89245f47a/PyEdit.py |
([("Point", "indent", "OutMode")], [("Point_ptr", "indent", "InMode")]), | def makerepairinstructions(self): return [ ([('ListBounds_ptr', '*', 'InMode')], [('Rect_ptr', '*', 'InMode')]), | cced0aa3e002fe92f75360eea010e25830a7ecdc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/cced0aa3e002fe92f75360eea010e25830a7ecdc/listscan.py |
|
self.assertEqual(lines, ['Test']) | self.assertEqual(xlines, ['Test']) | def testBug1191043(self): # readlines() for files containing no newline data = 'BZh91AY&SY\xd9b\x89]\x00\x00\x00\x03\x80\x04\x00\x02\x00\x0c\x00 \x00!\x9ah3M\x13<]\xc9\x14\xe1BCe\x8a%t' f = open(self.filename, "wb") f.write(data) f.close() bz2f = BZ2File(self.filename) lines = bz2f.readlines() bz2f.close() self.assertEqual(lines, ['Test']) bz2f = BZ2File(self.filename) xlines = list(bz2f.xreadlines()) bz2f.close() self.assertEqual(lines, ['Test']) | 9908d1656c5ee845f3039eb5eaef59582df1666d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9908d1656c5ee845f3039eb5eaef59582df1666d/test_bz2.py |
def testMultiply(self); | def testMultiply(self): | def testMultiply(self); self.assertEquals((0 * 10), 0) self.assertEquals((5 * 8), 40) | 7b0657027f04ac0367908ee0474f6d762366e4bb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7b0657027f04ac0367908ee0474f6d762366e4bb/unittest.py |
contain tuples of (testcase, exceptioninfo), where exceptioninfo is a tuple of values as returned by sys.exc_info(). | contain tuples of (testcase, exceptioninfo), where exceptioninfo is the formatted traceback of the error that occurred | def testMultiply(self); self.assertEquals((0 * 10), 0) self.assertEquals((5 * 8), 40) | 7b0657027f04ac0367908ee0474f6d762366e4bb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7b0657027f04ac0367908ee0474f6d762366e4bb/unittest.py |
"Called when an error has occurred" self.errors.append((test, err)) | """Called when an error has occurred. 'err' is a tuple of values as returned by sys.exc_info(). """ self.errors.append((test, self._exc_info_to_string(err))) | def addError(self, test, err): "Called when an error has occurred" self.errors.append((test, err)) | 7b0657027f04ac0367908ee0474f6d762366e4bb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7b0657027f04ac0367908ee0474f6d762366e4bb/unittest.py |
"Called when a failure has occurred" self.failures.append((test, err)) | """Called when an error has occurred. 'err' is a tuple of values as returned by sys.exc_info().""" self.failures.append((test, self._exc_info_to_string(err))) | def addFailure(self, test, err): "Called when a failure has occurred" self.failures.append((test, err)) | 7b0657027f04ac0367908ee0474f6d762366e4bb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7b0657027f04ac0367908ee0474f6d762366e4bb/unittest.py |
for line in apply(traceback.format_exception, err): for l in string.split(line,"\n")[:-1]: self.stream.writeln("%s" % l) | self.stream.writeln("%s" % err) | def printErrorList(self, flavour, errors): for test, err in errors: self.stream.writeln(self.separator1) self.stream.writeln("%s: %s" % (flavour,self.getDescription(test))) self.stream.writeln(self.separator2) for line in apply(traceback.format_exception, err): for l in string.split(line,"\n")[:-1]: self.stream.writeln("%s" % l) | 7b0657027f04ac0367908ee0474f6d762366e4bb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7b0657027f04ac0367908ee0474f6d762366e4bb/unittest.py |
self.__current_realm = None | def __init__(self, password_mgr=None): if password_mgr is None: password_mgr = HTTPPasswordMgr() self.passwd = password_mgr self.add_password = self.passwd.add_password self.__current_realm = None # if __current_realm is not None, then the server must have # refused our name/password and is asking for authorization # again. must be careful to set it to None on successful # return. | 52a17becbcc8bba8d4750926c58f6ac6e41464b7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/52a17becbcc8bba8d4750926c58f6ac6e41464b7/urllib2.py |
|
if self.__current_realm is None: self.__current_realm = realm else: self.__current_realm = realm return None | def retry_http_basic_auth(self, host, req, realm): if self.__current_realm is None: self.__current_realm = realm else: self.__current_realm = realm return None user,pw = self.passwd.find_user_password(realm, host) if pw: raw = "%s:%s" % (user, pw) auth = base64.encodestring(raw).strip() req.add_header(self.header, 'Basic %s' % auth) resp = self.parent.open(req) self.__current_realm = None return resp else: self.__current_realm = None return None | 52a17becbcc8bba8d4750926c58f6ac6e41464b7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/52a17becbcc8bba8d4750926c58f6ac6e41464b7/urllib2.py |
|
auth = base64.encodestring(raw).strip() req.add_header(self.header, 'Basic %s' % auth) resp = self.parent.open(req) self.__current_realm = None return resp else: self.__current_realm = None | auth = 'Basic %s' % base64.encodestring(raw).strip() if req.headers.get(self.auth_header, None) == auth: return None req.add_header(self.auth_header, auth) return self.parent.open(req) else: | def retry_http_basic_auth(self, host, req, realm): if self.__current_realm is None: self.__current_realm = realm else: self.__current_realm = realm return None user,pw = self.passwd.find_user_password(realm, host) if pw: raw = "%s:%s" % (user, pw) auth = base64.encodestring(raw).strip() req.add_header(self.header, 'Basic %s' % auth) resp = self.parent.open(req) self.__current_realm = None return resp else: self.__current_realm = None return None | 52a17becbcc8bba8d4750926c58f6ac6e41464b7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/52a17becbcc8bba8d4750926c58f6ac6e41464b7/urllib2.py |
header = 'Authorization' | auth_header = 'Authorization' | def retry_http_basic_auth(self, host, req, realm): if self.__current_realm is None: self.__current_realm = realm else: self.__current_realm = realm return None user,pw = self.passwd.find_user_password(realm, host) if pw: raw = "%s:%s" % (user, pw) auth = base64.encodestring(raw).strip() req.add_header(self.header, 'Basic %s' % auth) resp = self.parent.open(req) self.__current_realm = None return resp else: self.__current_realm = None return None | 52a17becbcc8bba8d4750926c58f6ac6e41464b7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/52a17becbcc8bba8d4750926c58f6ac6e41464b7/urllib2.py |
header = 'Proxy-Authorization' | auth_header = 'Proxy-Authorization' | def http_error_401(self, req, fp, code, msg, headers): host = urlparse.urlparse(req.get_full_url())[1] return self.http_error_auth_reqed('www-authenticate', host, req, headers) | 52a17becbcc8bba8d4750926c58f6ac6e41464b7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/52a17becbcc8bba8d4750926c58f6ac6e41464b7/urllib2.py |
self.__current_realm = None | def __init__(self, passwd=None): if passwd is None: passwd = HTTPPasswordMgr() self.passwd = passwd self.add_password = self.passwd.add_password self.__current_realm = None | 52a17becbcc8bba8d4750926c58f6ac6e41464b7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/52a17becbcc8bba8d4750926c58f6ac6e41464b7/urllib2.py |
|
authreq = headers.get(self.header, None) | authreq = headers.get(self.auth_header, None) | def http_error_auth_reqed(self, authreq, host, req, headers): authreq = headers.get(self.header, None) if authreq: kind = authreq.split()[0] if kind == 'Digest': return self.retry_http_digest_auth(req, authreq) | 52a17becbcc8bba8d4750926c58f6ac6e41464b7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/52a17becbcc8bba8d4750926c58f6ac6e41464b7/urllib2.py |
req.add_header(self.header, 'Digest %s' % auth) | auth_val = 'Digest %s' % auth if req.headers.get(self.auth_header, None) == auth_val: return None req.add_header(self.auth_header, auth_val) | def retry_http_digest_auth(self, req, auth): token, challenge = auth.split(' ', 1) chal = parse_keqv_list(parse_http_list(challenge)) auth = self.get_authorization(req, chal) if auth: req.add_header(self.header, 'Digest %s' % auth) resp = self.parent.open(req) self.__current_realm = None return resp | 52a17becbcc8bba8d4750926c58f6ac6e41464b7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/52a17becbcc8bba8d4750926c58f6ac6e41464b7/urllib2.py |
self.__current_realm = None | def retry_http_digest_auth(self, req, auth): token, challenge = auth.split(' ', 1) chal = parse_keqv_list(parse_http_list(challenge)) auth = self.get_authorization(req, chal) if auth: req.add_header(self.header, 'Digest %s' % auth) resp = self.parent.open(req) self.__current_realm = None return resp | 52a17becbcc8bba8d4750926c58f6ac6e41464b7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/52a17becbcc8bba8d4750926c58f6ac6e41464b7/urllib2.py |
|
return None if self.__current_realm is None: self.__current_realm = realm else: self.__current_realm = realm | def get_authorization(self, req, chal): try: realm = chal['realm'] nonce = chal['nonce'] algorithm = chal.get('algorithm', 'MD5') # mod_digest doesn't send an opaque, even though it isn't # supposed to be optional opaque = chal.get('opaque', None) except KeyError: return None | 52a17becbcc8bba8d4750926c58f6ac6e41464b7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/52a17becbcc8bba8d4750926c58f6ac6e41464b7/urllib2.py |
|
longopts.sort() | def getopt(args, shortopts, longopts = []): """getopt(args, options[, long_options]) -> opts, args Parses command line options and parameter list. args is the argument list to be parsed, without the leading reference to the running program. Typically, this means "sys.argv[1:]". shortopts is the string of option letters that the script wants to recognize, with options that require an argument followed by a colon (i.e., the same format that Unix getopt() uses). If specified, longopts is a list of strings with the names of the long options which should be supported. The leading '--' characters should not be included in the option name. Options which require an argument should be followed by an equal sign ('='). The return value consists of two elements: the first is a list of (option, value) pairs; the second is the list of program arguments left after the option list was stripped (this is a trailing slice of the first argument). Each option-and-value pair returned has the option as its first element, prefixed with a hyphen (e.g., '-x'), and the option argument as its second element, or an empty string if the option has no argument. The options occur in the list in the same order in which they were found, thus allowing multiple occurrences. Long and short options may be mixed. """ opts = [] if type(longopts) == type(""): longopts = [longopts] else: longopts = list(longopts) longopts.sort() while args and args[0].startswith('-') and args[0] != '-': if args[0] == '--': args = args[1:] break if args[0][:2] == '--': opts, args = do_longs(opts, args[0][2:], longopts, args[1:]) else: opts, args = do_shorts(opts, args[0][1:], shortopts, args[1:]) return opts, args | d31b6328e180af4b10e2c942a1437d5b8cb2c2e6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d31b6328e180af4b10e2c942a1437d5b8cb2c2e6/getopt.py |
|
def do_longs(opts, opt, longopts, args): try: i = opt.index('=') except ValueError: optarg = None else: opt, optarg = opt[:i], opt[i+1:] has_arg, opt = long_has_args(opt, longopts) if has_arg: if optarg is None: if not args: raise GetoptError('option --%s requires argument' % opt, opt) optarg, args = args[0], args[1:] elif optarg: raise GetoptError('option --%s must not have an argument' % opt, opt) opts.append(('--' + opt, optarg or '')) return opts, args | d31b6328e180af4b10e2c942a1437d5b8cb2c2e6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d31b6328e180af4b10e2c942a1437d5b8cb2c2e6/getopt.py |
||
for i in range(len(longopts)): if longopts[i].startswith(opt): break else: | possibilities = [o for o in longopts if o.startswith(opt)] if not possibilities: | def long_has_args(opt, longopts): for i in range(len(longopts)): if longopts[i].startswith(opt): break else: raise GetoptError('option --%s not recognized' % opt, opt) # opt is a prefix of longopts[i]; find j s.t. opt is a prefix of # each possibility in longopts[i:j] j = i+1 while j < len(longopts) and longopts[j].startswith(opt): j += 1 possibilities = longopts[i:j] # Is there an exact match? if opt in possibilities: return 0, opt elif opt + '=' in possibilities: return 1, opt # No exact match, so better be unique. if len(possibilities) > 1: # XXX since possibilities contains all valid continuations, might be # nice to work them into the error msg raise GetoptError('option --%s not a unique prefix' % opt, opt) assert len(possibilities) == 1 unique_match = possibilities[0] has_arg = unique_match.endswith('=') if has_arg: unique_match = unique_match[:-1] return has_arg, unique_match | d31b6328e180af4b10e2c942a1437d5b8cb2c2e6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d31b6328e180af4b10e2c942a1437d5b8cb2c2e6/getopt.py |
j = i+1 while j < len(longopts) and longopts[j].startswith(opt): j += 1 possibilities = longopts[i:j] | def long_has_args(opt, longopts): for i in range(len(longopts)): if longopts[i].startswith(opt): break else: raise GetoptError('option --%s not recognized' % opt, opt) # opt is a prefix of longopts[i]; find j s.t. opt is a prefix of # each possibility in longopts[i:j] j = i+1 while j < len(longopts) and longopts[j].startswith(opt): j += 1 possibilities = longopts[i:j] # Is there an exact match? if opt in possibilities: return 0, opt elif opt + '=' in possibilities: return 1, opt # No exact match, so better be unique. if len(possibilities) > 1: # XXX since possibilities contains all valid continuations, might be # nice to work them into the error msg raise GetoptError('option --%s not a unique prefix' % opt, opt) assert len(possibilities) == 1 unique_match = possibilities[0] has_arg = unique_match.endswith('=') if has_arg: unique_match = unique_match[:-1] return has_arg, unique_match | d31b6328e180af4b10e2c942a1437d5b8cb2c2e6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d31b6328e180af4b10e2c942a1437d5b8cb2c2e6/getopt.py |
|
server_version = "Python-urllib/%s" % __version__ self.addheaders = [('User-agent', server_version)] | client_version = "Python-urllib/%s" % __version__ self.addheaders = [('User-agent', client_version)] | def __init__(self): server_version = "Python-urllib/%s" % __version__ self.addheaders = [('User-agent', server_version)] # manage the individual handlers self.handlers = [] self.handle_open = {} self.handle_error = {} self.process_response = {} self.process_request = {} | 8d457c78b4bdaab7aab18ae91e8bc5f5e7484ba4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8d457c78b4bdaab7aab18ae91e8bc5f5e7484ba4/urllib2.py |
while 1: | rv = "(unknown file)", 0, "(unknown function)" while hasattr(f, "f_code"): | def findCaller(self): """ Find the stack frame of the caller so that we can note the source file name, line number and function name. """ f = currentframe().f_back while 1: co = f.f_code filename = os.path.normcase(co.co_filename) if filename == _srcfile: f = f.f_back continue return filename, f.f_lineno, co.co_name | a2173a189a679cd6babf85a0369b1969f173dfb3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a2173a189a679cd6babf85a0369b1969f173dfb3/__init__.py |
return filename, f.f_lineno, co.co_name | rv = (filename, f.f_lineno, co.co_name) break return rv | def findCaller(self): """ Find the stack frame of the caller so that we can note the source file name, line number and function name. """ f = currentframe().f_back while 1: co = f.f_code filename = os.path.normcase(co.co_filename) if filename == _srcfile: f = f.f_back continue return filename, f.f_lineno, co.co_name | a2173a189a679cd6babf85a0369b1969f173dfb3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a2173a189a679cd6babf85a0369b1969f173dfb3/__init__.py |
def clear(self): self.fill(0) canvas = self._canvas items = self._items self._items = [] for item in items: canvas.delete(item) self._delete_turtle() self._draw_turtle() | fd2ede2aa84e77dac30e297a04fc49dd3bb61c68 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/fd2ede2aa84e77dac30e297a04fc49dd3bb61c68/turtle.py |
||
def _set_color(self,color): self._color = color self._draw_turtle() | fd2ede2aa84e77dac30e297a04fc49dd3bb61c68 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/fd2ede2aa84e77dac30e297a04fc49dd3bb61c68/turtle.py |
||
Return a list of all keywords, built-in functions and names currently defines in __main__ that match. | Return a list of all keywords, built-in functions and names currently defined in self.namespace that match. | def global_matches(self, text): """Compute matches when text is a simple name. | dbab3e3178d8819a839ad08571f995376edcba00 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/dbab3e3178d8819a839ad08571f995376edcba00/rlcompleter.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.