rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
f.write("\0" * 8)
f.write(MAGIC) f.write("\0" * 4)
def writePyc(code, path): f = open(path, "wb") f.write("\0" * 8) # don't bother about a time stamp marshal.dump(code, f) f.seek(0, 0) f.write(MAGIC) f.close()
109ecbf7a52786df6114cfb678bd19e19102e076 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/109ecbf7a52786df6114cfb678bd19e19102e076/bundlebuilder.py
f.seek(0, 0) f.write(MAGIC)
def writePyc(code, path): f = open(path, "wb") f.write("\0" * 8) # don't bother about a time stamp marshal.dump(code, f) f.seek(0, 0) f.write(MAGIC) f.close()
109ecbf7a52786df6114cfb678bd19e19102e076 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/109ecbf7a52786df6114cfb678bd19e19102e076/bundlebuilder.py
again = meth(ts, tzinfo=off42)
again = meth(ts, tz=off42)
def test_tzinfo_fromtimestamp(self): import time meth = self.theclass.fromtimestamp ts = time.time() # Ensure it doesn't require tzinfo (i.e., that this doesn't blow up). base = meth(ts) # Try with and without naming the keyword. off42 = FixedOffset(42, "42") another = meth(ts, off42) again = meth(ts, tzinfo=off42) self.failUnless(another.tzinfo is again.tzinfo) self.assertEqual(another.utcoffset(), timedelta(minutes=42)) # Bad argument with and w/o naming the keyword. self.assertRaises(TypeError, meth, ts, 16) self.assertRaises(TypeError, meth, ts, tzinfo=16) # Bad keyword name. self.assertRaises(TypeError, meth, ts, tinfo=off42) # Too many args. self.assertRaises(TypeError, meth, ts, off42, off42) # Too few args. self.assertRaises(TypeError, meth)
2a44a8d3320ee7bcf5d718b5bdac550c6d34db4c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/2a44a8d3320ee7bcf5d718b5bdac550c6d34db4c/test_datetime.py
install.select_scheme ('nt') for key in ('purelib', 'platlib', 'headers', 'scripts', 'data'): attrname = 'install_' + key attr = getattr (install, attrname) if attr: attr = string.replace (attr, '\\', os.sep) setattr (install, attrname, attr)
install.prefix = "Python" install.select_scheme('nt')
def run (self): if (sys.platform != "win32" and (self.distribution.has_ext_modules() or self.distribution.has_c_libraries())): raise DistutilsPlatformError \ ("distribution contains extensions and/or C libraries; " "must be compiled on a Windows 32 platform")
ab7983939b2b9f3f1cce5d7b859e97d94052bad6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ab7983939b2b9f3f1cce5d7b859e97d94052bad6/bdist_wininst.py
EventHandlerUPP event;
# def outputFreeIt(self, name):
c3baa0eff75baec3f4d8d82f2f9994d376cf5e3d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c3baa0eff75baec3f4d8d82f2f9994d376cf5e3d/CarbonEvtsupport.py
event = NewEventHandlerUPP(CarbonEvents_HandleCommand); _err = InstallEventHandler(_self->ob_itself, event, 1, &inSpec, (void *)callback, &outRef);
_err = InstallEventHandler(_self->ob_itself, gEventHandlerUPP, 1, &inSpec, (void *)callback, &outRef);
# def outputFreeIt(self, name):
c3baa0eff75baec3f4d8d82f2f9994d376cf5e3d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c3baa0eff75baec3f4d8d82f2f9994d376cf5e3d/CarbonEvtsupport.py
return Py_BuildValue("l", outRef); """
return Py_BuildValue("O&", EventHandlerRef_New, outRef);"""
# def outputFreeIt(self, name):
c3baa0eff75baec3f4d8d82f2f9994d376cf5e3d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c3baa0eff75baec3f4d8d82f2f9994d376cf5e3d/CarbonEvtsupport.py
printf("lock failure\n");
printf("lock failure\\n");
# def outputFreeIt(self, name):
c3baa0eff75baec3f4d8d82f2f9994d376cf5e3d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c3baa0eff75baec3f4d8d82f2f9994d376cf5e3d/CarbonEvtsupport.py
SetOutputFileName('_CarbonEvt.c')
SetOutputFileName('_CarbonEvtmodule.c')
# def outputFreeIt(self, name):
c3baa0eff75baec3f4d8d82f2f9994d376cf5e3d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c3baa0eff75baec3f4d8d82f2f9994d376cf5e3d/CarbonEvtsupport.py
if row:
if row is not None:
def grid_slaves(self, row=None, column=None): args = () if row: args = args + ('-row', row) if column: args = args + ('-column', column) return map(self._nametowidget, self.tk.splitlist(self.tk.call( ('grid', 'slaves', self._w) + args)))
eb354b31e5cd5bcd1aa1350799966b20778d9592 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/eb354b31e5cd5bcd1aa1350799966b20778d9592/Tkinter.py
if column:
if column is not None:
def grid_slaves(self, row=None, column=None): args = () if row: args = args + ('-row', row) if column: args = args + ('-column', column) return map(self._nametowidget, self.tk.splitlist(self.tk.call( ('grid', 'slaves', self._w) + args)))
eb354b31e5cd5bcd1aa1350799966b20778d9592 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/eb354b31e5cd5bcd1aa1350799966b20778d9592/Tkinter.py
return self._bind((self._w, 'bind', tagOrId), sequence, func, add)
res = self._bind((self._w, 'bind', tagOrId), sequence, func, add) if sequence and func and res: if self._tagcommands is None: self._tagcommands = {} list = self._tagcommands.get(tagOrId) or [] self._tagcommands[tagOrId] = list list.append(res) return res
def tag_bind(self, tagOrId, sequence=None, func=None, add=None): return self._bind((self._w, 'bind', tagOrId), sequence, func, add)
eb354b31e5cd5bcd1aa1350799966b20778d9592 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/eb354b31e5cd5bcd1aa1350799966b20778d9592/Tkinter.py
if remote_background:
if self.remote_background:
def _remote(self, url, action, autoraise): autoraise = int(bool(autoraise)) # always 0/1 raise_opt = self.raise_opts and self.raise_opts[autoraise] or '' cmd = "%s %s %s '%s' >/dev/null 2>&1" % (self.name, raise_opt, self.remote_cmd, action) if remote_background: cmd += ' &' rc = os.system(cmd) if rc: # bad return status, try again with simpler command rc = os.system("%s %s" % (self.name, url)) return not rc
196f733d935bd51f8674c9761420ce990694f33a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/196f733d935bd51f8674c9761420ce990694f33a/webbrowser.py
if os.environ.get("DISPLAY"):
def register_X_browsers():
def open(self, url, new=0, autoraise=1): if new: ok = self._remote("LOADNEW " + url) else: ok = self._remote("LOAD " + url) return ok
196f733d935bd51f8674c9761420ce990694f33a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/196f733d935bd51f8674c9761420ce990694f33a/webbrowser.py
raises(TypeError, "MRO conflict among bases ",
raises(TypeError, mro_err_msg,
def raises(exc, expected, callable, *args): try: callable(*args) except exc, msg: if not str(msg).startswith(expected): raise TestFailed, "Message %r, expected %r" % (str(msg), expected) else: raise TestFailed, "Expected %s" % exc
83245b58280a7679da0fe7216f36353e44ddf859 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/83245b58280a7679da0fe7216f36353e44ddf859/test_descr.py
raises(TypeError, "MRO conflict among bases ",
raises(TypeError, mro_err_msg,
def raises(exc, expected, callable, *args): try: callable(*args) except exc, msg: if not str(msg).startswith(expected): raise TestFailed, "Message %r, expected %r" % (str(msg), expected) else: raise TestFailed, "Expected %s" % exc
83245b58280a7679da0fe7216f36353e44ddf859 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/83245b58280a7679da0fe7216f36353e44ddf859/test_descr.py
raises(TypeError, "MRO conflict among bases ",
raises(TypeError, mro_err_msg,
def raises(exc, expected, callable, *args): try: callable(*args) except exc, msg: if not str(msg).startswith(expected): raise TestFailed, "Message %r, expected %r" % (str(msg), expected) else: raise TestFailed, "Expected %s" % exc
83245b58280a7679da0fe7216f36353e44ddf859 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/83245b58280a7679da0fe7216f36353e44ddf859/test_descr.py
self.__frame.grid(row=3, column=1, sticky='NS')
self.__frame.grid(row=3, column=1, sticky='NSEW')
def __init__(self, switchboard, master=None): # non-gui ivars self.__sb = switchboard optiondb = switchboard.optiondb() self.__hexp = BooleanVar() self.__hexp.set(optiondb.get('HEXTYPE', 0)) self.__uwtyping = BooleanVar() self.__uwtyping.set(optiondb.get('UPWHILETYPE', 0)) # create the gui self.__frame = Frame(master, relief=RAISED, borderwidth=1) self.__frame.grid(row=3, column=1, sticky='NS') # Red self.__xl = Label(self.__frame, text='Red:') self.__xl.grid(row=0, column=0, sticky=E) self.__x = Entry(self.__frame, width=4) self.__x.grid(row=0, column=1) self.__x.bindtags(self.__x.bindtags() + ('Normalize', 'Update')) self.__x.bind_class('Normalize', '<Key>', self.__normalize) self.__x.bind_class('Update' , '<Key>', self.__maybeupdate) # Green self.__yl = Label(self.__frame, text='Green:') self.__yl.grid(row=1, column=0, sticky=E) self.__y = Entry(self.__frame, width=4) self.__y.grid(row=1, column=1) self.__y.bindtags(self.__y.bindtags() + ('Normalize', 'Update')) # Blue self.__zl = Label(self.__frame, text='Blue:') self.__zl.grid(row=2, column=0, sticky=E) self.__z = Entry(self.__frame, width=4) self.__z.grid(row=2, column=1) self.__z.bindtags(self.__z.bindtags() + ('Normalize', 'Update')) # Update while typing? self.__uwt = Checkbutton(self.__frame, text='Update while typing', variable=self.__uwtyping) self.__uwt.grid(row=3, column=0, columnspan=2, sticky=W) # Hex/Dec self.__hex = Checkbutton(self.__frame, text='Hexadecimal', variable=self.__hexp, command=self.__togglehex) self.__hex.grid(row=4, column=0, columnspan=2, sticky=W)
f72d580d5e7759fd75ab18c238f851cadba248b3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f72d580d5e7759fd75ab18c238f851cadba248b3/TypeinViewer.py
if not self._dict['Download-URL']:
if not self._dict.get('Download-URL'):
def prerequisites(self): """Return a list of prerequisites for this package. The list contains 2-tuples, of which the first item is either a PimpPackage object or None, and the second is a descriptive string. The first item can be None if this package depends on something that isn't pimp-installable, in which case the descriptive string should tell the user what to do.""" rv = [] if not self._dict['Download-URL']: return [(None, "This package needs to be installed manually")] if not self._dict['Prerequisites']: return [] for item in self._dict['Prerequisites']: if type(item) == str: pkg = None descr = str(item) else: name = item['Name'] if item.has_key('Version'): name = name + '-' + item['Version'] if item.has_key('Flavor'): name = name + '-' + item['Flavor'] pkg = self._db.find(name) if not pkg: descr = "Requires unknown %s"%name else: descr = pkg.description() rv.append((pkg, descr)) return rv
53b341ff67f2b7d63db2783734a813354a5e3264 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/53b341ff67f2b7d63db2783734a813354a5e3264/pimp.py
fp = os.popen(cmd, "r")
dummy, fp = os.popen4(cmd, "r") dummy.close()
def _cmd(self, output, dir, *cmditems): """Internal routine to run a shell command in a given directory.""" cmd = ("cd \"%s\"; " % dir) + " ".join(cmditems) if output: output.write("+ %s\n" % cmd) if NO_EXECUTE: return 0 fp = os.popen(cmd, "r") while 1: line = fp.readline() if not line: break if output: output.write(line) rv = fp.close() return rv
53b341ff67f2b7d63db2783734a813354a5e3264 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/53b341ff67f2b7d63db2783734a813354a5e3264/pimp.py
self.installaehandler('aevt', '****', self.other)
self.installaehandler('****', '****', self.other)
def __init__(self): MiniApplication.__init__(self) AEServer.__init__(self) self.installaehandler('aevt', 'oapp', self.open_app) self.installaehandler('aevt', 'quit', self.quit) self.installaehandler('aevt', '****', self.other) self.mainloop()
55a0bde2903e12b511c4ebb12d64547dea6d57cb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/55a0bde2903e12b511c4ebb12d64547dea6d57cb/MiniAEFrame.py
sqstring = r"(\b[rR])?'([^'\\\n]|\\.)*'?" dqstring = r'(\b[rR])?"([^"\\\n]|\\.)*"?' sq3string = r"(\b[rR])?'''([^'\\]|\\.|'(?!''))*(''')?" dq3string = r'(\b[rR])?"""([^"\\]|\\.|"(?!""))*(""")?'
sqstring = r"(\b[rR])?'[^'\\\n]*(\\.[^'\\\n]*)*'?" dqstring = r'(\b[rR])?"[^"\\\n]*(\\.[^"\\\n]*)*"?' sq3string = r"(\b[rR])?'''[^'\\]*((\\.|'(?!''))[^'\\]*)*(''')?" dq3string = r'(\b[rR])?"""[^"\\]*((\\.|"(?!""))[^"\\]*)*(""")?'
def make_pat(): kw = r"\b" + any("KEYWORD", keyword.kwlist) + r"\b" comment = any("COMMENT", [r"#[^\n]*"]) sqstring = r"(\b[rR])?'([^'\\\n]|\\.)*'?" dqstring = r'(\b[rR])?"([^"\\\n]|\\.)*"?' sq3string = r"(\b[rR])?'''([^'\\]|\\.|'(?!''))*(''')?" dq3string = r'(\b[rR])?"""([^"\\]|\\.|"(?!""))*(""")?' string = any("STRING", [sq3string, dq3string, sqstring, dqstring]) return kw + "|" + comment + "|" + string + "|" + any("SYNC", [r"\n"])
da4b25e0d99a13b25cae675127774bfd2bb55f2d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/da4b25e0d99a13b25cae675127774bfd2bb55f2d/ColorDelegator.py
timestamp = regex.compile('\+OK.*\(<[^>]+>\)')
timestamp = re.compile(r'\+OK.*(<[^>]+>)')
def rpop(self, user): """Not sure what this does.""" return self._shortcmd('RPOP %s' % user)
ccc2e3d05d2c7475f84718b066ab0306ea97e168 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ccc2e3d05d2c7475f84718b066ab0306ea97e168/poplib.py
if self.timestamp.match(self.welcome) <= 0:
m = self.timestamp.match(self.welcome) if not m:
def apop(self, user, secret): """Authorisation
ccc2e3d05d2c7475f84718b066ab0306ea97e168 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ccc2e3d05d2c7475f84718b066ab0306ea97e168/poplib.py
digest = md5.new(self.timestamp.group(1)+secret).digest()
digest = md5.new(m.group(1)+secret).digest()
def apop(self, user, secret): """Authorisation
ccc2e3d05d2c7475f84718b066ab0306ea97e168 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ccc2e3d05d2c7475f84718b066ab0306ea97e168/poplib.py
sizehint, if given, is passed as size argument to the stream's .read() method. """ if sizehint is None: data = self.stream.read() else: data = self.stream.read(sizehint)
sizehint, if given, is ignored since there is no efficient way to finding the true end-of-line. """ data = self.stream.read()
def readlines(self, sizehint=None):
d594849c42b6141622f8e442e26b49e2df6ef4ff /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d594849c42b6141622f8e442e26b49e2df6ef4ff/codecs.py
if sizehint is None: data = self.reader.read() else: data = self.reader.read(sizehint)
data = self.reader.read()
def readlines(self, sizehint=None):
d594849c42b6141622f8e442e26b49e2df6ef4ff /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d594849c42b6141622f8e442e26b49e2df6ef4ff/codecs.py
def pickle(ob_type, pickle_function, constructor_ob = None):
def pickle(ob_type, pickle_function, constructor_ob=None): if type(ob_type) is _ClassType: raise TypeError("copy_reg is not intended for use with classes") if not callable(pickle_function): raise TypeError("reduction functions must be callable")
def pickle(ob_type, pickle_function, constructor_ob = None): dispatch_table[ob_type] = pickle_function if constructor_ob is not None: constructor(constructor_ob)
78a6a369641d53c4085eb167af0d1cef65c129fe /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/78a6a369641d53c4085eb167af0d1cef65c129fe/copy_reg.py
def pickle_complex(c): return complex, (c.real, c.imag)
78a6a369641d53c4085eb167af0d1cef65c129fe /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/78a6a369641d53c4085eb167af0d1cef65c129fe/copy_reg.py
_notfound = None
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)
aed51d8121f321e37274171b695cd0e3876465c6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/aed51d8121f321e37274171b695cd0e3876465c6/os.py
global _notfound
def _execvpe(file, args, env=None): if env is not None: func = execve argrest = (args, env) else: func = execv argrest = (args,) env = environ global _notfound 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) if not _notfound: if sys.platform[:4] == 'beos': # Process handling (fork, wait) under BeOS (up to 5.0) # doesn't interoperate reliably with the thread interlocking # that happens during an import. The actual error we need # is the same on BeOS for posix.open() et al., ENOENT. try: unlink('/_#.# ## #.#') except error, _notfound: pass else: import tempfile t = tempfile.mktemp() # Exec a file that is guaranteed not to exist try: execv(t, ('blah',)) except error, _notfound: pass exc, arg = error, _notfound for dir in PATH: fullname = path.join(dir, file) try: apply(func, (fullname,) + argrest) except error, (errno, msg): if errno != arg[0]: exc, arg = error, (errno, msg) raise exc, arg
aed51d8121f321e37274171b695cd0e3876465c6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/aed51d8121f321e37274171b695cd0e3876465c6/os.py
if not _notfound: if sys.platform[:4] == 'beos': try: unlink('/_ except error, _notfound: pass else: import tempfile t = tempfile.mktemp() try: execv(t, ('blah',)) except error, _notfound: pass exc, arg = error, _notfound
def _execvpe(file, args, env=None): if env is not None: func = execve argrest = (args, env) else: func = execv argrest = (args,) env = environ global _notfound 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) if not _notfound: if sys.platform[:4] == 'beos': # Process handling (fork, wait) under BeOS (up to 5.0) # doesn't interoperate reliably with the thread interlocking # that happens during an import. The actual error we need # is the same on BeOS for posix.open() et al., ENOENT. try: unlink('/_#.# ## #.#') except error, _notfound: pass else: import tempfile t = tempfile.mktemp() # Exec a file that is guaranteed not to exist try: execv(t, ('blah',)) except error, _notfound: pass exc, arg = error, _notfound for dir in PATH: fullname = path.join(dir, file) try: apply(func, (fullname,) + argrest) except error, (errno, msg): if errno != arg[0]: exc, arg = error, (errno, msg) raise exc, arg
aed51d8121f321e37274171b695cd0e3876465c6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/aed51d8121f321e37274171b695cd0e3876465c6/os.py
if errno != arg[0]: exc, arg = error, (errno, msg) raise exc, arg
if errno != ENOENT and errno != ENOTDIR: raise raise error, (errno, msg)
def _execvpe(file, args, env=None): if env is not None: func = execve argrest = (args, env) else: func = execv argrest = (args,) env = environ global _notfound 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) if not _notfound: if sys.platform[:4] == 'beos': # Process handling (fork, wait) under BeOS (up to 5.0) # doesn't interoperate reliably with the thread interlocking # that happens during an import. The actual error we need # is the same on BeOS for posix.open() et al., ENOENT. try: unlink('/_#.# ## #.#') except error, _notfound: pass else: import tempfile t = tempfile.mktemp() # Exec a file that is guaranteed not to exist try: execv(t, ('blah',)) except error, _notfound: pass exc, arg = error, _notfound for dir in PATH: fullname = path.join(dir, file) try: apply(func, (fullname,) + argrest) except error, (errno, msg): if errno != arg[0]: exc, arg = error, (errno, msg) raise exc, arg
aed51d8121f321e37274171b695cd0e3876465c6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/aed51d8121f321e37274171b695cd0e3876465c6/os.py
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
raise HTTPError(req.get_full_url(), code, msg, headers, fp)
def redirect_request(self, req, fp, code, msg, headers, newurl): """Return a Request or None in response to a redirect.
e3b67bcb7e38ae29453f637b019de10adb8de360 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e3b67bcb7e38ae29453f637b019de10adb8de360/urllib2.py
revparse_prog = re.compile(r'^(\d{1,3})\.(\d{1-4})$')
revparse_prog = re.compile(r'^(\d{1,3})\.(\d{1,4})$')
def revparse(rev): global revparse_prog if not revparse_prog: revparse_prog = re.compile(r'^(\d{1,3})\.(\d{1-4})$') m = revparse_prog.match(rev) if not m: return None [major, minor] = map(string.atoi, m.group(1, 2)) return major, minor
55b40b06d2cb3e6effd3aa663813923c4001ee66 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/55b40b06d2cb3e6effd3aa663813923c4001ee66/faqwiz.py
self.text.insert(mark, str(s), tags)
self.text.insert(mark, s, tags)
def write(self, s, tags=(), mark="iomark"): self.text.mark_gravity(mark, RIGHT) self.text.insert(mark, str(s), tags) self.text.mark_gravity(mark, LEFT) self.text.see(mark) self.text.update()
75a8e65873f8c73f27f353b30bb1de5aceb6b74c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/75a8e65873f8c73f27f353b30bb1de5aceb6b74c/OutputWindow.py
if type(cmd) == type(''):
if isinstance(cmd, types.StringTypes):
def _run_child(self, cmd): if type(cmd) == type(''): cmd = ['/bin/sh', '-c', cmd] for i in range(3, MAXFD): try: os.close(i) except: pass try: os.execvp(cmd[0], cmd) finally: os._exit(1)
95b057e3ea98f78cad8cbee3c77640c11573b792 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/95b057e3ea98f78cad8cbee3c77640c11573b792/popen2.py
def open_module(self, event=None): # XXX Shouldn't this be in IOBinding or in FileList? try: name = self.text.get("sel.first", "sel.last") except TclError: name = "" else: name = string.strip(name) if not name: name = tkSimpleDialog.askstring("Module", "Enter the name of a Python module\n" "to search on sys.path and open:", parent=self.text) if name: name = string.strip(name) if not name: return # XXX Ought to support package syntax # XXX Ought to insert current file's directory in front of path try: (f, file, (suffix, mode, type)) = imp.find_module(name) except (NameError, ImportError), msg: tkMessageBox.showerror("Import error", str(msg), parent=self.text) return if type != imp.PY_SOURCE: tkMessageBox.showerror("Unsupported type", "%s is not a source module" % name, parent=self.text) return if f: f.close() if self.flist: self.flist.open(file) else: self.io.loadfile(file)
b2c729fe2758d13ce4a5affdc67c3f7573edbc48 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b2c729fe2758d13ce4a5affdc67c3f7573edbc48/EditorWindow.py
(f, file, (suffix, mode, type)) = imp.find_module(name)
(f, file, (suffix, mode, type)) = _find_module(name)
def open_module(self, event=None): # XXX Shouldn't this be in IOBinding or in FileList? try: name = self.text.get("sel.first", "sel.last") except TclError: name = "" else: name = string.strip(name) if not name: name = tkSimpleDialog.askstring("Module", "Enter the name of a Python module\n" "to search on sys.path and open:", parent=self.text) if name: name = string.strip(name) if not name: return # XXX Ought to support package syntax # XXX Ought to insert current file's directory in front of path try: (f, file, (suffix, mode, type)) = imp.find_module(name) except (NameError, ImportError), msg: tkMessageBox.showerror("Import error", str(msg), parent=self.text) return if type != imp.PY_SOURCE: tkMessageBox.showerror("Unsupported type", "%s is not a source module" % name, parent=self.text) return if f: f.close() if self.flist: self.flist.open(file) else: self.io.loadfile(file)
b2c729fe2758d13ce4a5affdc67c3f7573edbc48 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b2c729fe2758d13ce4a5affdc67c3f7573edbc48/EditorWindow.py
def extended_linecache_checkcache(orig_checkcache=linecache.checkcache):
def extended_linecache_checkcache(filename=None, orig_checkcache=linecache.checkcache):
def extended_linecache_checkcache(orig_checkcache=linecache.checkcache): """Extend linecache.checkcache to preserve the <pyshell#...> entries Rather than repeating the linecache code, patch it to save the pyshell# entries, call the original linecache.checkcache(), and then restore the saved entries. Assigning the orig_checkcache keyword arg freezes its value at definition time to the (original) method linecache.checkcache(), i.e. makes orig_checkcache lexical. """ cache = linecache.cache save = {} for filename in cache.keys(): if filename[:1] + filename[-1:] == '<>': save[filename] = cache[filename] orig_checkcache() cache.update(save)
f7a8899f33fb0a1efe6cb57fc1b712fa1059d0a6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f7a8899f33fb0a1efe6cb57fc1b712fa1059d0a6/PyShell.py
Rather than repeating the linecache code, patch it to save the pyshell entries, call the original linecache.checkcache(), and then restore the saved entries. Assigning the orig_checkcache keyword arg freezes its value at definition time to the (original) method linecache.checkcache(), i.e. makes orig_checkcache lexical.
Rather than repeating the linecache code, patch it to save the <pyshell (which destroys them), and then restore the saved entries. orig_checkcache is bound at definition time to the original method, allowing it to be patched.
def extended_linecache_checkcache(orig_checkcache=linecache.checkcache): """Extend linecache.checkcache to preserve the <pyshell#...> entries Rather than repeating the linecache code, patch it to save the pyshell# entries, call the original linecache.checkcache(), and then restore the saved entries. Assigning the orig_checkcache keyword arg freezes its value at definition time to the (original) method linecache.checkcache(), i.e. makes orig_checkcache lexical. """ cache = linecache.cache save = {} for filename in cache.keys(): if filename[:1] + filename[-1:] == '<>': save[filename] = cache[filename] orig_checkcache() cache.update(save)
f7a8899f33fb0a1efe6cb57fc1b712fa1059d0a6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f7a8899f33fb0a1efe6cb57fc1b712fa1059d0a6/PyShell.py
A IncrementalEncoder encodes an input in multiple steps. The input can be
An IncrementalEncoder encodes an input in multiple steps. The input can be
def decode(self, input, errors='strict'):
6bed1c1fab3e89c459ed58f1d312de220d7c858e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6bed1c1fab3e89c459ed58f1d312de220d7c858e/codecs.py
Creates a IncrementalEncoder instance.
Creates an IncrementalEncoder instance.
def __init__(self, errors='strict'): """ Creates a IncrementalEncoder instance.
6bed1c1fab3e89c459ed58f1d312de220d7c858e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6bed1c1fab3e89c459ed58f1d312de220d7c858e/codecs.py
for data in f[1]: data = convert_path(data) (out, _) = self.copy_file(data, dir) self.outfiles.append(out)
if f[1] == []: self.outfiles.append(dir) else: for data in f[1]: data = convert_path(data) (out, _) = self.copy_file(data, dir) self.outfiles.append(out)
def run (self): self.mkpath(self.install_dir) for f in self.data_files: if type(f) == StringType: # it's a simple file, so copy it f = convert_path(f) if self.warn_dir: self.warn("setup script did not provide a directory for " "'%s' -- installing right in '%s'" % (f, self.install_dir)) (out, _) = self.copy_file(f, self.install_dir) self.outfiles.append(out) else: # it's a tuple with path to install to and a list of files dir = convert_path(f[0]) if not os.path.isabs(dir): dir = os.path.join(self.install_dir, dir) elif self.root: dir = change_root(self.root, dir) self.mkpath(dir) for data in f[1]: data = convert_path(data) (out, _) = self.copy_file(data, dir) self.outfiles.append(out)
4d335b3b9b4d24f2869be08b1706153c005523ab /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4d335b3b9b4d24f2869be08b1706153c005523ab/install_data.py
if msg[:3] != '500': raise error_perm, msg
if msg.args[0][:3] != '500': raise
def cwd(self, dirname): '''Change to a directory.''' if dirname == '..': try: return self.voidcmd('CDUP') except error_perm, msg: if msg[:3] != '500': raise error_perm, msg elif dirname == '': dirname = '.' # does nothing, but could return error cmd = 'CWD ' + dirname return self.voidcmd(cmd)
b5255114d1221f3fec027005a16dc61812eacf4b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b5255114d1221f3fec027005a16dc61812eacf4b/ftplib.py
if str[0] == '"' and str[-1:] == '"': return str[1:-1] if str[0] == '<' and str[-1:] == '>':
if str.startswith('"') and str.endswith('"'): return str[1:-1].replace('\\\\', '\\').replace('\\"', '"') if str.startswith('<') and str.endswith('>'):
def unquote(str): """Remove quotes from a string.""" if len(str) > 1: if str[0] == '"' and str[-1:] == '"': return str[1:-1] if str[0] == '<' and str[-1:] == '>': return str[1:-1] return str
4e09d5c6d6f5e3eaf8175c0ec54901b6f7a005a1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4e09d5c6d6f5e3eaf8175c0ec54901b6f7a005a1/rfc822.py
if opener == "else" or "elif":
if opener in ("else", "elif"):
def interesting_lines(self, firstline): """Generator which yields context lines, starting at firstline.""" # The indentation level we are currently in: lastindent = INFINITY # For a line to be interesting, it must begin with a block opening # keyword, and have less indentation than lastindent. for line_index in xrange(firstline, -1, -1): indent, text, opener = self.get_line_info(line_index) if indent < lastindent: lastindent = indent if opener == "else" or "elif": # We also show the if statement lastindent += 1 if opener and line_index < firstline: yield line_index, text
e3636e05dece349d97afc97b00945d795a5878e2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e3636e05dece349d97afc97b00945d795a5878e2/CodeContext.py
def grid_slaves(self, master, row=None, column=None): args = (master,)
def grid_slaves(self, row=None, column=None): args = ()
def grid_slaves(self, master, row=None, column=None): args = (master,) if row: args = args + ('-row', row) if column: args = args + ('-column', column) return map(self._nametowidget, self.tk.splitlist( apply(self.tk.call, ('grid', 'slaves', self._w) + args)))
1cd6a457d9c4aa3cea72e7ccef4b008eb5e24654 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1cd6a457d9c4aa3cea72e7ccef4b008eb5e24654/Tkinter.py
return self.tk.call(self._w, 'entrycget', '-' + option)
return self.tk.call(self._w, 'entrycget', index, '-' + option)
def entrycget(self, index, option): return self.tk.call(self._w, 'entrycget', '-' + option)
1cd6a457d9c4aa3cea72e7ccef4b008eb5e24654 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1cd6a457d9c4aa3cea72e7ccef4b008eb5e24654/Tkinter.py
i = 0 while i < len(line) and line[i].isspace(): i = i+1 list.append(' %s\n' % line.strip()) if offset is not None: s = ' ' for c in line[i:offset-1]: if c.isspace(): s = s + c else: s = s + ' ' list.append('%s^\n' % s) value = msg
if line is not None: i = 0 while i < len(line) and line[i].isspace(): i = i+1 list.append(' %s\n' % line.strip()) if offset is not None: s = ' ' for c in line[i:offset-1]: if c.isspace(): s = s + c else: s = s + ' ' list.append('%s^\n' % s) value = msg
def format_exception_only(etype, value): """Format the exception part of a traceback. The arguments are the exception type and value such as given by sys.last_type and sys.last_value. The return value is a list of strings, each ending in a newline. Normally, the list contains a single string; however, for SyntaxError exceptions, it contains several lines that (when printed) display detailed information about where the syntax error occurred. The message indicating which exception occurred is the always last string in the list. """ list = [] if type(etype) == types.ClassType: stype = etype.__name__ else: stype = etype if value is None: list.append(str(stype) + '\n') else: if etype is SyntaxError: try: msg, (filename, lineno, offset, line) = value except: pass else: if not filename: filename = "<string>" list.append(' File "%s", line %d\n' % (filename, lineno)) i = 0 while i < len(line) and line[i].isspace(): i = i+1 list.append(' %s\n' % line.strip()) if offset is not None: s = ' ' for c in line[i:offset-1]: if c.isspace(): s = s + c else: s = s + ' ' list.append('%s^\n' % s) value = msg s = _some_str(value) if s: list.append('%s: %s\n' % (str(stype), s)) else: list.append('%s\n' % str(stype)) return list
0bb580d297bdc6ccb33fcd15e317a79112e77750 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0bb580d297bdc6ccb33fcd15e317a79112e77750/traceback.py
data = self.sslobj.read(size) while len(data) < size: data += self.sslobj.read(size-len(data)) return data
chunks = [] read = 0 while read < size: data = self.sslobj.read(size-read) read += len(data) chunks.append(size) return ''.join(chunks)
def read(self, size): """Read 'size' bytes from remote.""" # sslobj.read() sometimes returns < size bytes data = self.sslobj.read(size) while len(data) < size: data += self.sslobj.read(size-len(data))
8f2b24401ee92cb90b5a75ef63dedfbfc883c140 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8f2b24401ee92cb90b5a75ef63dedfbfc883c140/imaplib.py
line = ""
line = []
def readline(self): """Read line from remote.""" # NB: socket.ssl needs a "readline" method, or perhaps a "makefile" method. line = "" while 1: char = self.sslobj.read(1) line += char if char == "\n": return line
8f2b24401ee92cb90b5a75ef63dedfbfc883c140 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8f2b24401ee92cb90b5a75ef63dedfbfc883c140/imaplib.py
line += char if char == "\n": return line
line.append(char) if char == "\n": return ''.join(line)
def readline(self): """Read line from remote.""" # NB: socket.ssl needs a "readline" method, or perhaps a "makefile" method. line = "" while 1: char = self.sslobj.read(1) line += char if char == "\n": return line
8f2b24401ee92cb90b5a75ef63dedfbfc883c140 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8f2b24401ee92cb90b5a75ef63dedfbfc883c140/imaplib.py
elif type(arg) == type(""):
elif isinstance(arg, basestring):
def load_stats(self, arg): if not arg: self.stats = {} elif type(arg) == type(""): f = open(arg, 'rb') self.stats = marshal.load(f) f.close() try: file_stats = os.stat(arg) arg = time.ctime(file_stats.st_mtime) + " " + arg except: # in case this is not unix pass self.files = [ arg ] elif hasattr(arg, 'create_stats'): arg.create_stats() self.stats = arg.stats arg.stats = {} if not self.stats: raise TypeError, "Cannot create or construct a %r object from '%r''" % ( self.__class__, arg) return
2286441a815b3dc2d9f5fa4e71c3d38875e9b463 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/2286441a815b3dc2d9f5fa4e71c3d38875e9b463/pstats.py
"Parse an XML document from a URL."
"Parse an XML document from a URL."
def parse(self, stream_or_string ):
26a7983f086930b887731042dffb0f0899dedb81 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/26a7983f086930b887731042dffb0f0899dedb81/expatreader.py
parser.set_aliases({'license': 'licence'})
parser.set_aliases({'licence': 'license'})
def parse_command_line (self): """Parse the setup script's command line, taken from the 'script_args' instance attribute (which defaults to 'sys.argv[1:]' -- see 'setup()' in core.py). This list is first processed for "global options" -- options that set attributes of the Distribution instance. Then, it is alternately scanned for Distutils commands and options for that command. Each new command terminates the options for the previous command. The allowed options for a command are determined by the 'user_options' attribute of the command class -- thus, we have to be able to load command classes in order to parse the command line. Any error in that 'options' attribute raises DistutilsGetoptError; any error on the command-line raises DistutilsArgError. If no Distutils commands were found on the command line, raises DistutilsArgError. Return true if command-line was successfully parsed and we should carry on with executing commands; false if no errors but we shouldn't execute commands (currently, this only happens if user asks for help). """ # # We now have enough information to show the Macintosh dialog that allows # the user to interactively specify the "command line". # if sys.platform == 'mac': import EasyDialogs cmdlist = self.get_command_list() self.script_args = EasyDialogs.GetArgv( self.global_options + self.display_options, cmdlist)
fa7dc57d6c9023a5028aacb802438527ab2cface /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/fa7dc57d6c9023a5028aacb802438527ab2cface/dist.py
if type(command) is ClassType and issubclass(klass, Command):
if type(command) is ClassType and issubclass(command, Command):
def _show_help (self, parser, global_options=1, display_options=1, commands=[]): """Show help for the setup script command-line in the form of several lists of command-line options. 'parser' should be a FancyGetopt instance; do not expect it to be returned in the same state, as its option table will be reset to make it generate the correct help text.
fa7dc57d6c9023a5028aacb802438527ab2cface /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/fa7dc57d6c9023a5028aacb802438527ab2cface/dist.py
self.licence = None
self.license = None
def __init__ (self): self.name = None self.version = None self.author = None self.author_email = None self.maintainer = None self.maintainer_email = None self.url = None self.licence = None self.description = None self.long_description = None self.keywords = None self.platforms = None
fa7dc57d6c9023a5028aacb802438527ab2cface /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/fa7dc57d6c9023a5028aacb802438527ab2cface/dist.py
pkg_info.write('License: %s\n' % self.get_licence() )
pkg_info.write('License: %s\n' % self.get_license() )
def write_pkg_info (self, base_dir): """Write the PKG-INFO file into the release tree. """
fa7dc57d6c9023a5028aacb802438527ab2cface /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/fa7dc57d6c9023a5028aacb802438527ab2cface/dist.py
def get_licence(self): return self.licence or "UNKNOWN"
def get_license(self): return self.license or "UNKNOWN" get_licence = get_license
def get_licence(self): return self.licence or "UNKNOWN"
fa7dc57d6c9023a5028aacb802438527ab2cface /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/fa7dc57d6c9023a5028aacb802438527ab2cface/dist.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,;}]*),?"
ec5d6b908c25d45ffcf5b5ad60cdb51b38b6a769 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ec5d6b908c25d45ffcf5b5ad60cdb51b38b6a769/scantools.py
if importer in (None, True, False):
if importer is None:
def get_importer(path_item): """Retrieve a PEP 302 importer for the given path item The returned importer is cached in sys.path_importer_cache if it was newly created by a path hook. If there is no importer, a wrapper around the basic import machinery is returned. This wrapper is never inserted into the importer cache (None is inserted instead). The cache (or part of it) can be cleared manually if a rescan of sys.path_hooks is necessary. """ try: importer = sys.path_importer_cache[path_item] except KeyError: for path_hook in sys.path_hooks: try: importer = path_hook(path_item) break except ImportError: pass else: importer = None sys.path_importer_cache.setdefault(path_item, importer) # The boolean values are used for caching valid and invalid # file paths for the built-in import machinery if importer in (None, True, False): try: importer = ImpImporter(path_item) except ImportError: importer = None return importer
f7575d0cb7a10b252cc1e05a1d24facc2294a195 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f7575d0cb7a10b252cc1e05a1d24facc2294a195/pkgutil.py
return codecs.mbs_encode(input,self.errors)[0]
return codecs.mbcs_encode(input,self.errors)[0]
def encode(self, input, final=False): return codecs.mbs_encode(input,self.errors)[0]
13ed60b5045aafff22918cf4262bcc2dd3afea90 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/13ed60b5045aafff22918cf4262bcc2dd3afea90/mbcs.py
return codecs.mbs_decode(input,self.errors)[0]
return codecs.mbcs_decode(input,self.errors)[0]
def decode(self, input, final=False): return codecs.mbs_decode(input,self.errors)[0]
13ed60b5045aafff22918cf4262bcc2dd3afea90 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/13ed60b5045aafff22918cf4262bcc2dd3afea90/mbcs.py
if pass_iso8859: i = i % 128 if 32 <= i <= 126:
if 32 <= (i % mod) <= 126:
def make_escapes(pass_iso8859): global escapes for i in range(256): if pass_iso8859: # Allow iso-8859 characters to pass through so that e.g. 'msgid # "Hhe"' would result not result in 'msgid "H\366he"'. Otherwise # we escape any character outside the 32..126 range. i = i % 128 if 32 <= i <= 126: escapes.append(chr(i)) else: escapes.append("\\%03o" % i) escapes[ord('\\')] = '\\\\' escapes[ord('\t')] = '\\t' escapes[ord('\r')] = '\\r' escapes[ord('\n')] = '\\n' escapes[ord('\"')] = '\\"'
7733e12c9cc0fbff9740ba6035bc5d266648449b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7733e12c9cc0fbff9740ba6035bc5d266648449b/pygettext.py
make_escapes(options.escapes)
make_escapes(options.escape)
def main(): default_keywords = ['_'] try: opts, args = getopt.getopt( sys.argv[1:], 'ad:Ehk:n:o:p:Vvw:x:', ['extract-all', 'default-domain', 'escape', 'help', 'keyword', 'add-location', 'no-location', 'output=', 'output-dir=', 'verbose', 'version', 'width=', 'exclude-file=', ]) except getopt.error, msg: usage(1, msg) # for holding option values class Options: # constants GNU = 1 SOLARIS = 2 # defaults extractall = 0 # FIXME: currently this option has no effect at all. escape = 0 keywords = [] outpath = '' outfile = 'messages.pot' location = GNU verbose = 0 width = 78 excludefilename = '' options = Options() locations = {'gnu' : options.GNU, 'solaris' : options.SOLARIS, } # parse options for opt, arg in opts: if opt in ('-h', '--help'): usage(0) elif opt in ('-a', '--extract-all'): options.extractall = 1 elif opt in ('-d', '--default-domain'): options.outfile = arg + '.pot' elif opt in ('-E', '--escape'): options.escape = 1 elif opt in ('-k', '--keyword'): if arg is None: default_keywords = [] options.keywords.append(arg) elif opt in ('-n', '--add-location'): if arg is None: arg = 'gnu' try: options.location = locations[string.lower(arg)] except KeyError: d = {'arg':arg} usage(1, _('Invalid value for --add-location: %(arg)s') % d) elif opt in ('--no-location',): options.location = 0 elif opt in ('-o', '--output'): options.outfile = arg elif opt in ('-p', '--output-dir'): options.outpath = arg elif opt in ('-v', '--verbose'): options.verbose = 1 elif opt in ('-V', '--version'): print _('pygettext.py (xgettext for Python) %s') % __version__ sys.exit(0) elif opt in ('-w', '--width'): try: options.width = int(arg) except ValueError: d = {'arg':arg} usage(1, _('Invalid value for --width: %(arg)s, must be int') % d) elif opt in ('-x', '--exclude-file'): options.excludefilename = arg # calculate escapes make_escapes(options.escapes) # calculate all keywords options.keywords.extend(default_keywords) # initialize list of strings to exclude if options.excludefilename: try: fp = open(options.excludefilename) options.toexclude = fp.readlines() fp.close() except IOError: sys.stderr.write(_("Can't read --exclude-file: %s") % options.excludefilename) sys.exit(1) else: options.toexclude = [] # slurp through all the files eater = TokenEater(options) for filename in args: if options.verbose: print _('Working on %(filename)s') % {'filename':filename} fp = open(filename) eater.set_filename(filename) tokenize.tokenize(fp.readline, eater) fp.close() if options.outpath: options.outfile = os.path.join(options.outpath, options.outfile) fp = open(options.outfile, 'w') eater.write(fp) fp.close()
7733e12c9cc0fbff9740ba6035bc5d266648449b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7733e12c9cc0fbff9740ba6035bc5d266648449b/pygettext.py
return PyShellEditorWindow.close(self)
return OutputWindow.close(self)
def close(self): # Extend base class method if self.executing: # XXX Need to ask a question here if not tkMessageBox.askokcancel( "Kill?", "The program is still running; do you want to kill it?", default="ok", master=self.text): return "cancel" self.canceled = 1 if self.reading: self.top.quit() return "cancel" return PyShellEditorWindow.close(self)
4269601f5c57a16bce656efd4576c86b054a95cd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4269601f5c57a16bce656efd4576c86b054a95cd/PyShell.py
if typ is dict:
if issubclass(typ, dict):
def _format(self, object, stream, indent, allowance, context, level): level = level + 1 objid = _id(object) if objid in context: stream.write(_recursion(object)) self._recursive = True self._readable = False return rep = self._repr(object, context, level - 1) typ = _type(object) sepLines = _len(rep) > (self._width - 1 - indent - allowance) write = stream.write
e57000338f81ad09d5aa1d846ac2f8a39850b5e3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e57000338f81ad09d5aa1d846ac2f8a39850b5e3/pprint.py
if typ is list or typ is tuple: if typ is list:
if issubclass(typ, list) or issubclass(typ, tuple): if issubclass(typ, list):
def _format(self, object, stream, indent, allowance, context, level): level = level + 1 objid = _id(object) if objid in context: stream.write(_recursion(object)) self._recursive = True self._readable = False return rep = self._repr(object, context, level - 1) typ = _type(object) sepLines = _len(rep) > (self._width - 1 - indent - allowance) write = stream.write
e57000338f81ad09d5aa1d846ac2f8a39850b5e3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e57000338f81ad09d5aa1d846ac2f8a39850b5e3/pprint.py
if typ is tuple and length == 1:
if issubclass(typ, tuple) and length == 1:
def _format(self, object, stream, indent, allowance, context, level): level = level + 1 objid = _id(object) if objid in context: stream.write(_recursion(object)) self._recursive = True self._readable = False return rep = self._repr(object, context, level - 1) typ = _type(object) sepLines = _len(rep) > (self._width - 1 - indent - allowance) write = stream.write
e57000338f81ad09d5aa1d846ac2f8a39850b5e3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e57000338f81ad09d5aa1d846ac2f8a39850b5e3/pprint.py
if typ is str:
if issubclass(typ, basestring):
def _safe_repr(object, context, maxlevels, level): typ = _type(object) if typ is str: if 'locale' not in _sys.modules: return `object`, True, False if "'" in object and '"' not in object: closure = '"' quotes = {'"': '\\"'} else: closure = "'" quotes = {"'": "\\'"} qget = quotes.get sio = _StringIO() write = sio.write for char in object: if char.isalpha(): write(char) else: write(qget(char, `char`[1:-1])) return ("%s%s%s" % (closure, sio.getvalue(), closure)), True, False if typ is dict: if not object: return "{}", True, False objid = _id(object) if maxlevels and level > maxlevels: return "{...}", False, objid in context if objid in context: return _recursion(object), False, True context[objid] = 1 readable = True recursive = False components = [] append = components.append level += 1 saferepr = _safe_repr for k, v in object.iteritems(): krepr, kreadable, krecur = saferepr(k, context, maxlevels, level) vrepr, vreadable, vrecur = saferepr(v, context, maxlevels, level) append("%s: %s" % (krepr, vrepr)) readable = readable and kreadable and vreadable if krecur or vrecur: recursive = True del context[objid] return "{%s}" % _commajoin(components), readable, recursive if typ is list or typ is tuple: if typ is list: if not object: return "[]", True, False format = "[%s]" elif _len(object) == 1: format = "(%s,)" else: if not object: return "()", True, False format = "(%s)" objid = _id(object) if maxlevels and level > maxlevels: return format % "...", False, objid in context if objid in context: return _recursion(object), False, True context[objid] = 1 readable = True recursive = False components = [] append = components.append level += 1 for o in object: orepr, oreadable, orecur = _safe_repr(o, context, maxlevels, level) append(orepr) if not oreadable: readable = False if orecur: recursive = True del context[objid] return format % _commajoin(components), readable, recursive rep = `object` return rep, (rep and not rep.startswith('<')), False
e57000338f81ad09d5aa1d846ac2f8a39850b5e3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e57000338f81ad09d5aa1d846ac2f8a39850b5e3/pprint.py
if typ is dict:
if issubclass(typ, dict):
def _safe_repr(object, context, maxlevels, level): typ = _type(object) if typ is str: if 'locale' not in _sys.modules: return `object`, True, False if "'" in object and '"' not in object: closure = '"' quotes = {'"': '\\"'} else: closure = "'" quotes = {"'": "\\'"} qget = quotes.get sio = _StringIO() write = sio.write for char in object: if char.isalpha(): write(char) else: write(qget(char, `char`[1:-1])) return ("%s%s%s" % (closure, sio.getvalue(), closure)), True, False if typ is dict: if not object: return "{}", True, False objid = _id(object) if maxlevels and level > maxlevels: return "{...}", False, objid in context if objid in context: return _recursion(object), False, True context[objid] = 1 readable = True recursive = False components = [] append = components.append level += 1 saferepr = _safe_repr for k, v in object.iteritems(): krepr, kreadable, krecur = saferepr(k, context, maxlevels, level) vrepr, vreadable, vrecur = saferepr(v, context, maxlevels, level) append("%s: %s" % (krepr, vrepr)) readable = readable and kreadable and vreadable if krecur or vrecur: recursive = True del context[objid] return "{%s}" % _commajoin(components), readable, recursive if typ is list or typ is tuple: if typ is list: if not object: return "[]", True, False format = "[%s]" elif _len(object) == 1: format = "(%s,)" else: if not object: return "()", True, False format = "(%s)" objid = _id(object) if maxlevels and level > maxlevels: return format % "...", False, objid in context if objid in context: return _recursion(object), False, True context[objid] = 1 readable = True recursive = False components = [] append = components.append level += 1 for o in object: orepr, oreadable, orecur = _safe_repr(o, context, maxlevels, level) append(orepr) if not oreadable: readable = False if orecur: recursive = True del context[objid] return format % _commajoin(components), readable, recursive rep = `object` return rep, (rep and not rep.startswith('<')), False
e57000338f81ad09d5aa1d846ac2f8a39850b5e3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e57000338f81ad09d5aa1d846ac2f8a39850b5e3/pprint.py
if typ is list or typ is tuple: if typ is list:
if issubclass(typ, list) or issubclass(typ, tuple): if issubclass(typ, list):
def _safe_repr(object, context, maxlevels, level): typ = _type(object) if typ is str: if 'locale' not in _sys.modules: return `object`, True, False if "'" in object and '"' not in object: closure = '"' quotes = {'"': '\\"'} else: closure = "'" quotes = {"'": "\\'"} qget = quotes.get sio = _StringIO() write = sio.write for char in object: if char.isalpha(): write(char) else: write(qget(char, `char`[1:-1])) return ("%s%s%s" % (closure, sio.getvalue(), closure)), True, False if typ is dict: if not object: return "{}", True, False objid = _id(object) if maxlevels and level > maxlevels: return "{...}", False, objid in context if objid in context: return _recursion(object), False, True context[objid] = 1 readable = True recursive = False components = [] append = components.append level += 1 saferepr = _safe_repr for k, v in object.iteritems(): krepr, kreadable, krecur = saferepr(k, context, maxlevels, level) vrepr, vreadable, vrecur = saferepr(v, context, maxlevels, level) append("%s: %s" % (krepr, vrepr)) readable = readable and kreadable and vreadable if krecur or vrecur: recursive = True del context[objid] return "{%s}" % _commajoin(components), readable, recursive if typ is list or typ is tuple: if typ is list: if not object: return "[]", True, False format = "[%s]" elif _len(object) == 1: format = "(%s,)" else: if not object: return "()", True, False format = "(%s)" objid = _id(object) if maxlevels and level > maxlevels: return format % "...", False, objid in context if objid in context: return _recursion(object), False, True context[objid] = 1 readable = True recursive = False components = [] append = components.append level += 1 for o in object: orepr, oreadable, orecur = _safe_repr(o, context, maxlevels, level) append(orepr) if not oreadable: readable = False if orecur: recursive = True del context[objid] return format % _commajoin(components), readable, recursive rep = `object` return rep, (rep and not rep.startswith('<')), False
e57000338f81ad09d5aa1d846ac2f8a39850b5e3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e57000338f81ad09d5aa1d846ac2f8a39850b5e3/pprint.py
if stdin == None and stdout == None and stderr == None:
if stdin is None and stdout is None and stderr is None:
def _get_handles(self, stdin, stdout, stderr): """Construct and return tupel with IO objects: p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite """ if stdin == None and stdout == None and stderr == None: return (None, None, None, None, None, None)
d38ddf4ca23824f375e627bda82ffa995344c6e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d38ddf4ca23824f375e627bda82ffa995344c6e5/subprocess.py
if stdin == None:
if stdin is None:
def _get_handles(self, stdin, stdout, stderr): """Construct and return tupel with IO objects: p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite """ if stdin == None and stdout == None and stderr == None: return (None, None, None, None, None, None)
d38ddf4ca23824f375e627bda82ffa995344c6e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d38ddf4ca23824f375e627bda82ffa995344c6e5/subprocess.py
elif type(stdin) == int:
elif isinstance(stdin, int):
def _get_handles(self, stdin, stdout, stderr): """Construct and return tupel with IO objects: p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite """ if stdin == None and stdout == None and stderr == None: return (None, None, None, None, None, None)
d38ddf4ca23824f375e627bda82ffa995344c6e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d38ddf4ca23824f375e627bda82ffa995344c6e5/subprocess.py
if stdout == None:
if stdout is None:
def _get_handles(self, stdin, stdout, stderr): """Construct and return tupel with IO objects: p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite """ if stdin == None and stdout == None and stderr == None: return (None, None, None, None, None, None)
d38ddf4ca23824f375e627bda82ffa995344c6e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d38ddf4ca23824f375e627bda82ffa995344c6e5/subprocess.py
elif type(stdout) == int:
elif isinstance(stdout, int):
def _get_handles(self, stdin, stdout, stderr): """Construct and return tupel with IO objects: p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite """ if stdin == None and stdout == None and stderr == None: return (None, None, None, None, None, None)
d38ddf4ca23824f375e627bda82ffa995344c6e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d38ddf4ca23824f375e627bda82ffa995344c6e5/subprocess.py
if stderr == None:
if stderr is None:
def _get_handles(self, stdin, stdout, stderr): """Construct and return tupel with IO objects: p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite """ if stdin == None and stdout == None and stderr == None: return (None, None, None, None, None, None)
d38ddf4ca23824f375e627bda82ffa995344c6e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d38ddf4ca23824f375e627bda82ffa995344c6e5/subprocess.py
elif type(stderr) == int:
elif isinstance(stderr, int):
def _get_handles(self, stdin, stdout, stderr): """Construct and return tupel with IO objects: p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite """ if stdin == None and stdout == None and stderr == None: return (None, None, None, None, None, None)
d38ddf4ca23824f375e627bda82ffa995344c6e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d38ddf4ca23824f375e627bda82ffa995344c6e5/subprocess.py
if startupinfo == None:
if startupinfo is None:
def _execute_child(self, args, executable, preexec_fn, close_fds, cwd, env, universal_newlines, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite): """Execute program (MS Windows version)"""
d38ddf4ca23824f375e627bda82ffa995344c6e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d38ddf4ca23824f375e627bda82ffa995344c6e5/subprocess.py
if p2cread != None:
if p2cread is not None:
def _execute_child(self, args, executable, preexec_fn, close_fds, cwd, env, universal_newlines, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite): """Execute program (MS Windows version)"""
d38ddf4ca23824f375e627bda82ffa995344c6e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d38ddf4ca23824f375e627bda82ffa995344c6e5/subprocess.py
if c2pwrite != None:
if c2pwrite is not None:
def _execute_child(self, args, executable, preexec_fn, close_fds, cwd, env, universal_newlines, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite): """Execute program (MS Windows version)"""
d38ddf4ca23824f375e627bda82ffa995344c6e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d38ddf4ca23824f375e627bda82ffa995344c6e5/subprocess.py
if errwrite != None:
if errwrite is not None:
def _execute_child(self, args, executable, preexec_fn, close_fds, cwd, env, universal_newlines, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite): """Execute program (MS Windows version)"""
d38ddf4ca23824f375e627bda82ffa995344c6e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d38ddf4ca23824f375e627bda82ffa995344c6e5/subprocess.py
if self.returncode == None:
if self.returncode is None:
def poll(self): """Check if child process has terminated. Returns returncode attribute.""" if self.returncode == None: if WaitForSingleObject(self._handle, 0) == WAIT_OBJECT_0: self.returncode = GetExitCodeProcess(self._handle) _active.remove(self) return self.returncode
d38ddf4ca23824f375e627bda82ffa995344c6e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d38ddf4ca23824f375e627bda82ffa995344c6e5/subprocess.py
if self.returncode == None:
if self.returncode is None:
def wait(self): """Wait for child process to terminate. Returns returncode attribute.""" if self.returncode == None: obj = WaitForSingleObject(self._handle, INFINITE) self.returncode = GetExitCodeProcess(self._handle) _active.remove(self) return self.returncode
d38ddf4ca23824f375e627bda82ffa995344c6e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d38ddf4ca23824f375e627bda82ffa995344c6e5/subprocess.py
if input != None:
if input is not None:
def communicate(self, input=None): """Interact with process: Send data to stdin. Read data from stdout and stderr, until end-of-file is reached. Wait for process to terminate. The optional input argument should be a string to be sent to the child process, or None, if no data should be sent to the child.
d38ddf4ca23824f375e627bda82ffa995344c6e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d38ddf4ca23824f375e627bda82ffa995344c6e5/subprocess.py
if stdout != None:
if stdout is not None:
def communicate(self, input=None): """Interact with process: Send data to stdin. Read data from stdout and stderr, until end-of-file is reached. Wait for process to terminate. The optional input argument should be a string to be sent to the child process, or None, if no data should be sent to the child.
d38ddf4ca23824f375e627bda82ffa995344c6e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d38ddf4ca23824f375e627bda82ffa995344c6e5/subprocess.py
if stderr != None:
if stderr is not None:
def communicate(self, input=None): """Interact with process: Send data to stdin. Read data from stdout and stderr, until end-of-file is reached. Wait for process to terminate. The optional input argument should be a string to be sent to the child process, or None, if no data should be sent to the child.
d38ddf4ca23824f375e627bda82ffa995344c6e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d38ddf4ca23824f375e627bda82ffa995344c6e5/subprocess.py
if stdin == None:
if stdin is None:
def _get_handles(self, stdin, stdout, stderr): """Construct and return tupel with IO objects: p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite """ p2cread, p2cwrite = None, None c2pread, c2pwrite = None, None errread, errwrite = None, None
d38ddf4ca23824f375e627bda82ffa995344c6e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d38ddf4ca23824f375e627bda82ffa995344c6e5/subprocess.py
elif type(stdin) == int:
elif isinstance(stdin, int):
def _get_handles(self, stdin, stdout, stderr): """Construct and return tupel with IO objects: p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite """ p2cread, p2cwrite = None, None c2pread, c2pwrite = None, None errread, errwrite = None, None
d38ddf4ca23824f375e627bda82ffa995344c6e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d38ddf4ca23824f375e627bda82ffa995344c6e5/subprocess.py
if stdout == None:
if stdout is None:
def _get_handles(self, stdin, stdout, stderr): """Construct and return tupel with IO objects: p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite """ p2cread, p2cwrite = None, None c2pread, c2pwrite = None, None errread, errwrite = None, None
d38ddf4ca23824f375e627bda82ffa995344c6e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d38ddf4ca23824f375e627bda82ffa995344c6e5/subprocess.py
elif type(stdout) == int:
elif isinstance(stdout, int):
def _get_handles(self, stdin, stdout, stderr): """Construct and return tupel with IO objects: p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite """ p2cread, p2cwrite = None, None c2pread, c2pwrite = None, None errread, errwrite = None, None
d38ddf4ca23824f375e627bda82ffa995344c6e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d38ddf4ca23824f375e627bda82ffa995344c6e5/subprocess.py
if stderr == None:
if stderr is None:
def _get_handles(self, stdin, stdout, stderr): """Construct and return tupel with IO objects: p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite """ p2cread, p2cwrite = None, None c2pread, c2pwrite = None, None errread, errwrite = None, None
d38ddf4ca23824f375e627bda82ffa995344c6e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d38ddf4ca23824f375e627bda82ffa995344c6e5/subprocess.py
elif type(stderr) == int:
elif isinstance(stderr, int):
def _get_handles(self, stdin, stdout, stderr): """Construct and return tupel with IO objects: p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite """ p2cread, p2cwrite = None, None c2pread, c2pwrite = None, None errread, errwrite = None, None
d38ddf4ca23824f375e627bda82ffa995344c6e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d38ddf4ca23824f375e627bda82ffa995344c6e5/subprocess.py
if executable == None:
if executable is None:
def _execute_child(self, args, executable, preexec_fn, close_fds, cwd, env, universal_newlines, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite): """Execute program (POSIX version)"""
d38ddf4ca23824f375e627bda82ffa995344c6e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d38ddf4ca23824f375e627bda82ffa995344c6e5/subprocess.py
if cwd != None:
if cwd is not None:
def _execute_child(self, args, executable, preexec_fn, close_fds, cwd, env, universal_newlines, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite): """Execute program (POSIX version)"""
d38ddf4ca23824f375e627bda82ffa995344c6e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d38ddf4ca23824f375e627bda82ffa995344c6e5/subprocess.py
if env == None:
if env is None:
def _execute_child(self, args, executable, preexec_fn, close_fds, cwd, env, universal_newlines, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite): """Execute program (POSIX version)"""
d38ddf4ca23824f375e627bda82ffa995344c6e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d38ddf4ca23824f375e627bda82ffa995344c6e5/subprocess.py
if self.returncode == None:
if self.returncode is None:
def poll(self): """Check if child process has terminated. Returns returncode attribute.""" if self.returncode == None: try: pid, sts = os.waitpid(self.pid, os.WNOHANG) if pid == self.pid: self._handle_exitstatus(sts) except os.error: pass return self.returncode
d38ddf4ca23824f375e627bda82ffa995344c6e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d38ddf4ca23824f375e627bda82ffa995344c6e5/subprocess.py
if self.returncode == None:
if self.returncode is None:
def wait(self): """Wait for child process to terminate. Returns returncode attribute.""" if self.returncode == None: pid, sts = os.waitpid(self.pid, 0) self._handle_exitstatus(sts) return self.returncode
d38ddf4ca23824f375e627bda82ffa995344c6e5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d38ddf4ca23824f375e627bda82ffa995344c6e5/subprocess.py