rem
stringlengths 1
322k
| add
stringlengths 0
2.05M
| context
stringlengths 4
228k
| meta
stringlengths 156
215
|
---|---|---|---|
if not self.packageResourceFolder: | if not self.resourceFolder: | def _addResources(self): "Add Welcome/ReadMe/License files, .lproj folders and scripts." | 18f917dac1d0c4373b8f3ea1de666a7605f47d91 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/18f917dac1d0c4373b8f3ea1de666a7605f47d91/buildpkg.py |
pattern = join(self.packageResourceFolder, pat) | pattern = join(self.resourceFolder, pat) | def _addResources(self): "Add Welcome/ReadMe/License files, .lproj folders and scripts." | 18f917dac1d0c4373b8f3ea1de666a7605f47d91 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/18f917dac1d0c4373b8f3ea1de666a7605f47d91/buildpkg.py |
pattern = join(self.packageResourceFolder, packageName + pat) | pattern = join(self.resourceFolder, packageName + pat) | def _addResources(self): "Add Welcome/ReadMe/License files, .lproj folders and scripts." | 18f917dac1d0c4373b8f3ea1de666a7605f47d91 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/18f917dac1d0c4373b8f3ea1de666a7605f47d91/buildpkg.py |
files.append(f) | files.append((f, f)) | def _addResources(self): "Add Welcome/ReadMe/License files, .lproj folders and scripts." | 18f917dac1d0c4373b8f3ea1de666a7605f47d91 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/18f917dac1d0c4373b8f3ea1de666a7605f47d91/buildpkg.py |
files.append(f) | files.append((f, f)) elif f in ["pre-upgrade", "pre-install", "post-upgrade", "post-install"]: files.append((f, self.packageInfo["Title"]+"."+f)) | def _addResources(self): "Add Welcome/ReadMe/License files, .lproj folders and scripts." | 18f917dac1d0c4373b8f3ea1de666a7605f47d91 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/18f917dac1d0c4373b8f3ea1de666a7605f47d91/buildpkg.py |
files.append(f) | files.append((f,f)) | def _addResources(self): "Add Welcome/ReadMe/License files, .lproj folders and scripts." | 18f917dac1d0c4373b8f3ea1de666a7605f47d91 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/18f917dac1d0c4373b8f3ea1de666a7605f47d91/buildpkg.py |
files.append(f) | files.append((f,f)) | def _addResources(self): "Add Welcome/ReadMe/License files, .lproj folders and scripts." | 18f917dac1d0c4373b8f3ea1de666a7605f47d91 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/18f917dac1d0c4373b8f3ea1de666a7605f47d91/buildpkg.py |
for g in files: f = join(self.packageResourceFolder, g) | for src, dst in files: f = join(self.resourceFolder, src) | def _addResources(self): "Add Welcome/ReadMe/License files, .lproj folders and scripts." | 18f917dac1d0c4373b8f3ea1de666a7605f47d91 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/18f917dac1d0c4373b8f3ea1de666a7605f47d91/buildpkg.py |
shutil.copy(f, self.resourceFolder) | shutil.copy(f, os.path.join(self.packageResourceFolder, dst)) | def _addResources(self): "Add Welcome/ReadMe/License files, .lproj folders and scripts." | 18f917dac1d0c4373b8f3ea1de666a7605f47d91 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/18f917dac1d0c4373b8f3ea1de666a7605f47d91/buildpkg.py |
d = join(self.resourceFolder, basename(f)) | d = join(self.packageResourceFolder, dst) | def _addResources(self): "Add Welcome/ReadMe/License files, .lproj folders and scripts." | 18f917dac1d0c4373b8f3ea1de666a7605f47d91 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/18f917dac1d0c4373b8f3ea1de666a7605f47d91/buildpkg.py |
packageRootFolder = self.packageRootFolder files = GlobDirectoryWalker(packageRootFolder) | files = GlobDirectoryWalker(self.sourceFolder) | def _addSizes(self): "Write .sizes file with info about number and size of files." | 18f917dac1d0c4373b8f3ea1de666a7605f47d91 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/18f917dac1d0c4373b8f3ea1de666a7605f47d91/buildpkg.py |
installedSize = installedSize + os.stat(f)[6] d = dirname(packageRootFolder) base = basename(packageRootFolder) + ".pax.gz" archPath = join(d, self.resourceFolder, base) | installedSize = installedSize + os.lstat(f)[6] | def _addSizes(self): "Write .sizes file with info about number and size of files." | 18f917dac1d0c4373b8f3ea1de666a7605f47d91 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/18f917dac1d0c4373b8f3ea1de666a7605f47d91/buildpkg.py |
zippedSize = os.stat(archPath)[6] | zippedSize = os.stat(self.archPath+ ".gz")[6] | def _addSizes(self): "Write .sizes file with info about number and size of files." | 18f917dac1d0c4373b8f3ea1de666a7605f47d91 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/18f917dac1d0c4373b8f3ea1de666a7605f47d91/buildpkg.py |
base = basename(packageRootFolder) + ".sizes" f = open(join(self.resourceFolder, base), "w") format = "NumFiles %d\nInstalledSize %d\nCompressedSize %d" | base = self.packageInfo["Title"] + ".sizes" f = open(join(self.packageResourceFolder, base), "w") format = "NumFiles %d\nInstalledSize %d\nCompressedSize %d\n" | def _addSizes(self): "Write .sizes file with info about number and size of files." | 18f917dac1d0c4373b8f3ea1de666a7605f47d91 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/18f917dac1d0c4373b8f3ea1de666a7605f47d91/buildpkg.py |
self._read(length, self.fp.read) | return self._read(length, self.fp.read) | def read(self, length = None): self._read(length, self.fp.read) | af64954f44ac7eaee168db9fb9f0b45356e3007e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/af64954f44ac7eaee168db9fb9f0b45356e3007e/mailbox.py |
self._read(length, self.fp.readline) | return self._read(length, self.fp.readline) | def readline(self, length = None): self._read(length, self.fp.readline) | af64954f44ac7eaee168db9fb9f0b45356e3007e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/af64954f44ac7eaee168db9fb9f0b45356e3007e/mailbox.py |
def __init__(self, allow_none): | def __init__(self, allow_none, encoding): | def __init__(self, allow_none): self.funcs = {} self.instance = None self.allow_none = allow_none | c1f5320ba578927a5354c476e71e897980966204 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c1f5320ba578927a5354c476e71e897980966204/SimpleXMLRPCServer.py |
allow_none = self.allow_none) | allow_none=self.allow_none, encoding=self.encoding) | def _marshaled_dispatch(self, data, dispatch_method = None): """Dispatches an XML-RPC method from marshalled (XML) data. | c1f5320ba578927a5354c476e71e897980966204 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c1f5320ba578927a5354c476e71e897980966204/SimpleXMLRPCServer.py |
response = xmlrpclib.dumps(fault) | response = xmlrpclib.dumps(fault, allow_none=self.allow_none, encoding=self.encoding) | def _marshaled_dispatch(self, data, dispatch_method = None): """Dispatches an XML-RPC method from marshalled (XML) data. | c1f5320ba578927a5354c476e71e897980966204 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c1f5320ba578927a5354c476e71e897980966204/SimpleXMLRPCServer.py |
xmlrpclib.Fault(1, "%s:%s" % (sys.exc_type, sys.exc_value)) | xmlrpclib.Fault(1, "%s:%s" % (sys.exc_type, sys.exc_value)), encoding=self.encoding, allow_none=self.allow_none, | def _marshaled_dispatch(self, data, dispatch_method = None): """Dispatches an XML-RPC method from marshalled (XML) data. | c1f5320ba578927a5354c476e71e897980966204 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c1f5320ba578927a5354c476e71e897980966204/SimpleXMLRPCServer.py |
logRequests=True, allow_none=False): | logRequests=True, allow_none=False, encoding=None): | def __init__(self, addr, requestHandler=SimpleXMLRPCRequestHandler, logRequests=True, allow_none=False): self.logRequests = logRequests | c1f5320ba578927a5354c476e71e897980966204 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c1f5320ba578927a5354c476e71e897980966204/SimpleXMLRPCServer.py |
SimpleXMLRPCDispatcher.__init__(self, allow_none) | SimpleXMLRPCDispatcher.__init__(self, allow_none, encoding) | def __init__(self, addr, requestHandler=SimpleXMLRPCRequestHandler, logRequests=True, allow_none=False): self.logRequests = logRequests | c1f5320ba578927a5354c476e71e897980966204 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c1f5320ba578927a5354c476e71e897980966204/SimpleXMLRPCServer.py |
def __init__(self, allow_none=False): SimpleXMLRPCDispatcher.__init__(self, allow_none) | def __init__(self, allow_none=False, encoding=None): SimpleXMLRPCDispatcher.__init__(self, allow_none, encoding) | def __init__(self, allow_none=False): SimpleXMLRPCDispatcher.__init__(self, allow_none) | c1f5320ba578927a5354c476e71e897980966204 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c1f5320ba578927a5354c476e71e897980966204/SimpleXMLRPCServer.py |
n = int(s.rstrip(NUL) or "0", 8) | n = int(s.rstrip(NUL + " ") or "0", 8) | def nti(s): """Convert a number field to a python number. """ # There are two possible encodings for a number field, see # itn() below. if s[0] != chr(0200): n = int(s.rstrip(NUL) or "0", 8) else: n = 0L for i in xrange(len(s) - 1): n <<= 8 n += ord(s[i + 1]) return n | 243a7c48d5dd4b82744579e8b579242ac4cddbe4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/243a7c48d5dd4b82744579e8b579242ac4cddbe4/tarfile.py |
def read(self, n = 0): if n <= 0: | def read(self, n = -1): if n < 0: | def read(self, n = 0): if n <= 0: newpos = len(self.buf) else: newpos = min(self.pos+n, len(self.buf)) r = self.buf[self.pos:newpos] self.pos = newpos return r | b14b22ccf03dd3b7592282133c475512e590caa8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b14b22ccf03dd3b7592282133c475512e590caa8/StringIO.py |
"timeout (%g) is %g seconds more than expected (%g)" | "timeout (%g) is more than %g seconds more than expected (%g)" | def testConnectTimeout(self): # Test connect() timeout _timeout = 0.001 self.sock.settimeout(_timeout) | 68d041cf575108164c1e30f309348a706a164278 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/68d041cf575108164c1e30f309348a706a164278/test_timeout.py |
print "<H3>Shell environment:</H3>" | print "<H3>Shell Environment:</H3>" | def print_environ(): """Dump the shell environment as HTML.""" keys = environ.keys() keys.sort() print print "<H3>Shell environment:</H3>" print "<DL>" for key in keys: print "<DT>", escape(key), "<DD>", escape(environ[key]) print "</DL>" print | 7c730ecdf095b906e689569ac38ac8e05d0db1cc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/7c730ecdf095b906e689569ac38ac8e05d0db1cc/cgi.py |
print "<H3>Form contents:</H3>" | print "<H3>Form Contents:</H3>" | def print_form(form): """Dump the contents of a form as HTML.""" keys = form.keys() keys.sort() print print "<H3>Form contents:</H3>" print "<DL>" for key in keys: print "<DT>" + escape(key) + ":", value = form[key] print "<i>" + escape(`type(value)`) + "</i>" print "<DD>" + escape(`value`) print "</DL>" print | 7c730ecdf095b906e689569ac38ac8e05d0db1cc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/7c730ecdf095b906e689569ac38ac8e05d0db1cc/cgi.py |
print "<H3>Command line Arguments:</H3>" | print "<H3>Command Line Arguments:</H3>" | def print_arguments(): print print "<H3>Command line Arguments:</H3>" print print sys.argv print | 7c730ecdf095b906e689569ac38ac8e05d0db1cc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/7c730ecdf095b906e689569ac38ac8e05d0db1cc/cgi.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"]) | 26a47d203cc291d8bc7deefa27569e2b93151bc2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/26a47d203cc291d8bc7deefa27569e2b93151bc2/ColorDelegator.py |
headers, 'file:'+pathname2url(file)) | headers, 'file:'+file) | def open_local_file(self, url): import mimetypes, mimetools, StringIO mtype = mimetypes.guess_type(url)[0] headers = mimetools.Message(StringIO.StringIO( 'Content-Type: %s\n' % (mtype or 'text/plain'))) host, file = splithost(url) if not host: return addinfourl(open(url2pathname(file), 'rb'), headers, 'file:'+pathname2url(file)) host, port = splitport(host) if not port \ and socket.gethostbyname(host) in (localhost(), thishost()): return addinfourl(open(url2pathname(file), 'rb'), headers, 'file:'+pathname2url(file)) raise IOError, ('local file error', 'not on local host') | 8a225771f078d20927cf6cf69336f084a0e05b14 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8a225771f078d20927cf6cf69336f084a0e05b14/urllib.py |
headers, 'file:'+pathname2url(file)) | headers, 'file:'+file) | def open_local_file(self, url): import mimetypes, mimetools, StringIO mtype = mimetypes.guess_type(url)[0] headers = mimetools.Message(StringIO.StringIO( 'Content-Type: %s\n' % (mtype or 'text/plain'))) host, file = splithost(url) if not host: return addinfourl(open(url2pathname(file), 'rb'), headers, 'file:'+pathname2url(file)) host, port = splitport(host) if not port \ and socket.gethostbyname(host) in (localhost(), thishost()): return addinfourl(open(url2pathname(file), 'rb'), headers, 'file:'+pathname2url(file)) raise IOError, ('local file error', 'not on local host') | 8a225771f078d20927cf6cf69336f084a0e05b14 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8a225771f078d20927cf6cf69336f084a0e05b14/urllib.py |
file = mod.get_file() self.assertEquals(file, os.path.join(TEMP_ZIP, os.sep.join(modules) + expected_ext)) | if expected_ext: file = mod.get_file() self.assertEquals(file, os.path.join(TEMP_ZIP, os.sep.join(modules) + expected_ext)) | def doTest(self, expected_ext, files, *modules): z = ZipFile(TEMP_ZIP, "w") try: for name, (mtime, data) in files.items(): zinfo = ZipInfo(name, time.localtime(mtime)) zinfo.compress_type = self.compression z.writestr(zinfo, data) z.close() sys.path.insert(0, TEMP_ZIP) | d718139d9b75542c5cbe877ebe426844c5ba8f3d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d718139d9b75542c5cbe877ebe426844c5ba8f3d/test_zipimport.py |
>>> print a.__dict__ {'default': -1000, 'x2': 200, 'x1': 100} | >>> print sortdict(a.__dict__) {'default': -1000, 'x1': 100, 'x2': 200} | >>> def sorted(seq): | 6a1ebc0c7c1e22a34125ae51b29095f9cbe8c2dc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/6a1ebc0c7c1e22a34125ae51b29095f9cbe8c2dc/test_descrtut.py |
"""Read and parse a list of filenames.""" | """Read and parse a filename or a list of filenames. Files that cannot be opened are silently ignored; this is designed so that you can specifiy a list of potential configuration file locations (e.g. current directory, user's home directory, systemwide directory), and all existing configuration files in the list will be read. A single filename may also be given. """ | def read(self, filenames): """Read and parse a list of filenames.""" if type(filenames) is type(''): filenames = [filenames] for file in filenames: fp = open(file) self.__read(fp) fp.close() | 42f2508737be4b91901a62048ab63207472719d5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/42f2508737be4b91901a62048ab63207472719d5/ConfigParser.py |
for file in filenames: fp = open(file) self.__read(fp) | for filename in filenames: try: fp = open(filename) except IOError: continue self.__read(fp, filename) | def read(self, filenames): """Read and parse a list of filenames.""" if type(filenames) is type(''): filenames = [filenames] for file in filenames: fp = open(file) self.__read(fp) fp.close() | 42f2508737be4b91901a62048ab63207472719d5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/42f2508737be4b91901a62048ab63207472719d5/ConfigParser.py |
def __read(self, fp): | def __read(self, fp, fpname): | def __read(self, fp): """Parse a sectioned setup file. | 42f2508737be4b91901a62048ab63207472719d5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/42f2508737be4b91901a62048ab63207472719d5/ConfigParser.py |
raise MissingSectionHeaderError(fp.name, lineno, `line`) | raise MissingSectionHeaderError(fpname, lineno, `line`) | def __read(self, fp): """Parse a sectioned setup file. | 42f2508737be4b91901a62048ab63207472719d5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/42f2508737be4b91901a62048ab63207472719d5/ConfigParser.py |
e = ParsingError(fp.name) | e = ParsingError(fpname) | def __read(self, fp): """Parse a sectioned setup file. | 42f2508737be4b91901a62048ab63207472719d5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/42f2508737be4b91901a62048ab63207472719d5/ConfigParser.py |
genpluginproject("carbon", "_CF", sources=[":cf:_CFmodule.c", ":cf:pycfbridge.c"], outputdir="::Lib:Carbon") | genpluginproject("carbon", "_CF", sources=["_CFmodule.c", "pycfbridge.c"], outputdir="::Lib:Carbon") | def genpluginproject(architecture, module, project=None, projectdir=None, sources=[], sourcedirs=[], libraries=[], extradirs=[], extraexportsymbols=[], outputdir=":::Lib:lib-dynload", libraryflags=None, stdlibraryflags=None, prefixname=None, initialize=None): if CARBON_ONLY and architecture == "ppc": return if architecture == "all": # For the time being we generate two project files. Not as nice as # a single multitarget project, but easier to implement for now. genpluginproject("ppc", module, project, projectdir, sources, sourcedirs, libraries, extradirs, extraexportsymbols, outputdir, libraryflags, stdlibraryflags, prefixname, initialize) genpluginproject("carbon", module, project, projectdir, sources, sourcedirs, libraries, extradirs, extraexportsymbols, outputdir, libraryflags, stdlibraryflags, prefixname, initialize) return templatename = "template-%s" % architecture targetname = "%s.%s" % (module, architecture) dllname = "%s.%s.slb" % (module, architecture) if not project: if architecture != "ppc": project = "%s.%s.mcp"%(module, architecture) else: project = "%s.mcp"%module if not projectdir: projectdir = PROJECTDIR if not sources: sources = [module + 'module.c'] if not sourcedirs: for moduledir in MODULEDIRS: if '%' in moduledir: # For historical reasons an initial _ in the modulename # is not reflected in the folder name if module[0] == '_': modulewithout_ = module[1:] else: modulewithout_ = module moduledir = moduledir % modulewithout_ fn = os.path.join(projectdir, os.path.join(moduledir, sources[0])) if os.path.exists(fn): moduledir, sourcefile = os.path.split(fn) sourcedirs = [relpath(projectdir, moduledir)] sources[0] = sourcefile break else: print "Warning: %s: sourcefile not found: %s"%(module, sources[0]) sourcedirs = [] if prefixname: pass elif architecture == "carbon": prefixname = "mwerks_shcarbon_pch" else: prefixname = "mwerks_plugin_config.h" dict = { "sysprefix" : relpath(projectdir, sys.prefix), "sources" : sources, "extrasearchdirs" : sourcedirs + extradirs, "libraries": libraries, "mac_outputdir" : outputdir, "extraexportsymbols" : extraexportsymbols, "mac_targetname" : targetname, "mac_dllname" : dllname, "prefixname" : prefixname, } if libraryflags: dict['libraryflags'] = libraryflags if stdlibraryflags: dict['stdlibraryflags'] = stdlibraryflags if initialize: dict['initialize'] = initialize mkcwproject.mkproject(os.path.join(projectdir, project), module, dict, force=FORCEREBUILD, templatename=templatename) | c0c060dcf1b58be0ff5703c618d4221361733ce1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c0c060dcf1b58be0ff5703c618d4221361733ce1/genpluginprojects.py |
def item_cget(self, col, opt): return self.tk.call(self._w, 'item', 'cget', col, opt) | def item_cget(self, entry, col, opt): return self.tk.call(self._w, 'item', 'cget', entry, col, opt) | def item_cget(self, col, opt): return self.tk.call(self._w, 'item', 'cget', col, opt) | 09839d0471d4c3a58d2a3d8901b9a51df575aa68 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/09839d0471d4c3a58d2a3d8901b9a51df575aa68/Tix.py |
import linecache | def formatwarning(message, category, filename, lineno): """Function to format a warning the standard way.""" import linecache s = "%s:%s: %s: %s\n" % (filename, lineno, category.__name__, message) line = linecache.getline(filename, lineno).strip() if line: s = s + " " + line + "\n" return s | ff1867c6d8a1c147697076f9f2708256b9b069be /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ff1867c6d8a1c147697076f9f2708256b9b069be/warnings.py |
|
if sys.byteorder == 'little': fmt = ossaudiodev.AFMT_S16_LE else: fmt = ossaudiodev.AFMT_S16_BE | def play_sound_file(data, rate, ssize, nchannels): try: dsp = ossaudiodev.open('w') except IOError, msg: if msg[0] in (errno.EACCES, errno.ENODEV, errno.EBUSY): raise TestSkipped, msg raise TestFailed, msg # set the data format if sys.byteorder == 'little': fmt = ossaudiodev.AFMT_S16_LE else: fmt = ossaudiodev.AFMT_S16_BE # at least check that these methods can be invoked dsp.bufsize() dsp.obufcount() dsp.obuffree() dsp.getptr() dsp.fileno() # set parameters based on .au file headers dsp.setparameters(fmt, nchannels, rate) t1 = time.time() print "playing test sound file..." dsp.write(data) dsp.close() t2 = time.time() print "elapsed time: %.1f sec" % (t2-t1) | b9b5213bb722276e91b31fbd602a50e743f21091 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b9b5213bb722276e91b31fbd602a50e743f21091/test_ossaudiodev.py |
|
dsp.setparameters(fmt, nchannels, rate) | dsp.setparameters(AFMT_S16_NE, nchannels, rate) | def play_sound_file(data, rate, ssize, nchannels): try: dsp = ossaudiodev.open('w') except IOError, msg: if msg[0] in (errno.EACCES, errno.ENODEV, errno.EBUSY): raise TestSkipped, msg raise TestFailed, msg # set the data format if sys.byteorder == 'little': fmt = ossaudiodev.AFMT_S16_LE else: fmt = ossaudiodev.AFMT_S16_BE # at least check that these methods can be invoked dsp.bufsize() dsp.obufcount() dsp.obuffree() dsp.getptr() dsp.fileno() # set parameters based on .au file headers dsp.setparameters(fmt, nchannels, rate) t1 = time.time() print "playing test sound file..." dsp.write(data) dsp.close() t2 = time.time() print "elapsed time: %.1f sec" % (t2-t1) | b9b5213bb722276e91b31fbd602a50e743f21091 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b9b5213bb722276e91b31fbd602a50e743f21091/test_ossaudiodev.py |
def_build = "%s setup.py build" % self.python | def_setup_call = "%s %s" % (self.python,os.path.basename(sys.argv[0])) def_build = "%s build" % def_setup_call | 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(), ] | 7053f69120d7f196399e89029ab1f0f0eb99c4bf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/7053f69120d7f196399e89029ab1f0f0eb99c4bf/bdist_rpm.py |
("%s setup.py install " | ("%s install " | 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(), ] | 7053f69120d7f196399e89029ab1f0f0eb99c4bf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/7053f69120d7f196399e89029ab1f0f0eb99c4bf/bdist_rpm.py |
"--record=INSTALLED_FILES") % self.python), | "--record=INSTALLED_FILES") % def_setup_call), | 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(), ] | 7053f69120d7f196399e89029ab1f0f0eb99c4bf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/7053f69120d7f196399e89029ab1f0f0eb99c4bf/bdist_rpm.py |
def join(a, *p): """Join two or more pathname components, inserting "\\" as needed""" path = a for b in p: if isabs(b): path = b elif path == '' or path[-1:] in '/\\': path = path + b else: path = path + os.sep + b return path | c9656f612582e29c928b4900ff2dd83979849848 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c9656f612582e29c928b4900ff2dd83979849848/ntpath.py |
||
"""Split a pathname into drive and path specifiers. Return a 2-tuple (drive, path); either part may be empty. This recognizes UNC paths (e.g. '\\\\host\\mountpoint\\dir\\file')""" | """Split a pathname into drive and path specifiers. Returns a 2-tuple "(drive,path)"; either part may be empty""" | def splitdrive(p): """Split a pathname into drive and path specifiers. Return a 2-tuple (drive, path); either part may be empty. This recognizes UNC paths (e.g. '\\\\host\\mountpoint\\dir\\file')""" if p[1:2] == ':': return p[0:2], p[2:] firstTwo = p[0:2] if firstTwo == '//' or firstTwo == '\\\\': # is a UNC path: # vvvvvvvvvvvvvvvvvvvv equivalent to drive letter # \\machine\mountpoint\directories... # directory ^^^^^^^^^^^^^^^ normp = normcase(p) index = string.find(normp, '\\', 2) if index == -1: ##raise RuntimeError, 'illegal UNC path: "' + p + '"' return ("", p) index = string.find(normp, '\\', index + 1) if index == -1: index = len(p) return p[:index], p[index:] return '', p | c9656f612582e29c928b4900ff2dd83979849848 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c9656f612582e29c928b4900ff2dd83979849848/ntpath.py |
def isfile(path): """Test whether a path is a regular file""" try: st = os.stat(path) except os.error: return 0 return stat.S_ISREG(st[stat.ST_MODE]) | c9656f612582e29c928b4900ff2dd83979849848 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c9656f612582e29c928b4900ff2dd83979849848/ntpath.py |
||
del names["__builtins__"] | if names.has_key("__builtins__"): del names["__builtins__"] | def check_all(modname): names = {} try: exec "import %s" % modname in names except ImportError: # silent fail here seems the best route since some modules # may not be available in all environments return verify(hasattr(sys.modules[modname], "__all__"), "%s has no __all__ attribute" % modname) names = {} exec "from %s import *" % modname in names del names["__builtins__"] keys = names.keys() keys.sort() all = list(sys.modules[modname].__all__) # in case it's a tuple all.sort() verify(keys==all, "%s != %s" % (keys, all)) | 5043ac46a2161551f3d89f716466ebfa4445deed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5043ac46a2161551f3d89f716466ebfa4445deed/test___all__.py |
([("Point", "indent", "OutMode")], [("Point_ptr", "indent", "InMode")]), | def makerepairinstructions(self): return [ ([('ListBounds_ptr', '*', 'InMode')], [('Rect_ptr', '*', 'InMode')]), | 233f2aa28b09c86d9ece2d9a1eba55dcd0a0335d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/233f2aa28b09c86d9ece2d9a1eba55dcd0a0335d/listscan.py |
|
def sample(self, population, k, int=int): | def sample(self, population, k): | def sample(self, population, k, int=int): """Chooses k unique random elements from a population sequence. | 5412d81bade133739ec19f25961c05fd7a296bf2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5412d81bade133739ec19f25961c05fd7a296bf2/random.py |
j = int(random() * (n-i)) | j = _int(random() * (n-i)) | def sample(self, population, k, int=int): """Chooses k unique random elements from a population sequence. | 5412d81bade133739ec19f25961c05fd7a296bf2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5412d81bade133739ec19f25961c05fd7a296bf2/random.py |
j = int(random() * n) | j = _int(random() * n) | def sample(self, population, k, int=int): """Chooses k unique random elements from a population sequence. | 5412d81bade133739ec19f25961c05fd7a296bf2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5412d81bade133739ec19f25961c05fd7a296bf2/random.py |
j = int(random() * n) | j = _int(random() * n) | def sample(self, population, k, int=int): """Chooses k unique random elements from a population sequence. | 5412d81bade133739ec19f25961c05fd7a296bf2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5412d81bade133739ec19f25961c05fd7a296bf2/random.py |
transform = element._as_temporarily_immutable except AttributeError: pass else: element = transform() return element in self._data | return element in self._data except TypeError: transform = getattr(element, "_as_temporary_immutable", None) if transform is None: raise return transform() in self._data | def __contains__(self, element): """Report whether an element is a member of a set. | afe9595634c6691d2ea48fc5971fcd2d0c549740 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/afe9595634c6691d2ea48fc5971fcd2d0c549740/sets.py |
for elt in iterable: | for element in iterable: | def update(self, iterable): """Add all values from an iterable (such as a list or file).""" data = self._data value = True for elt in iterable: try: transform = elt._as_immutable except AttributeError: pass else: elt = transform() data[elt] = value | afe9595634c6691d2ea48fc5971fcd2d0c549740 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/afe9595634c6691d2ea48fc5971fcd2d0c549740/sets.py |
transform = elt._as_immutable except AttributeError: pass else: elt = transform() data[elt] = value | data[element] = value except TypeError: transform = getattr(element, "_as_temporary_immutable", None) if transform is None: raise data[transform()] = value | def update(self, iterable): """Add all values from an iterable (such as a list or file).""" data = self._data value = True for elt in iterable: try: transform = elt._as_immutable except AttributeError: pass else: elt = transform() data[elt] = value | afe9595634c6691d2ea48fc5971fcd2d0c549740 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/afe9595634c6691d2ea48fc5971fcd2d0c549740/sets.py |
transform = element._as_immutable except AttributeError: pass else: element = transform() self._data[element] = True | self._data[element] = True except TypeError: transform = getattr(element, "_as_temporary_immutable", None) if transform is None: raise self._data[transform()] = True | def add(self, element): """Add an element to a set. | afe9595634c6691d2ea48fc5971fcd2d0c549740 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/afe9595634c6691d2ea48fc5971fcd2d0c549740/sets.py |
transform = element._as_temporarily_immutable except AttributeError: pass else: element = transform() del self._data[element] | del self._data[element] except TypeError: transform = getattr(element, "_as_temporary_immutable", None) if transform is None: raise del self._data[transform()] | def remove(self, element): """Remove an element from a set; it must be a member. | afe9595634c6691d2ea48fc5971fcd2d0c549740 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/afe9595634c6691d2ea48fc5971fcd2d0c549740/sets.py |
gp.pixmode(GL.PM_RTOL, 1) | gl.pixmode(GL.PM_RTOL, 1) | def showpartframe(self, data, chromdata, (x,y,w,h)): pmsize = self.bpp xpf, ypf = self.xpf, self.ypf if self.upside_down: gl.pixmode(GL.PM_TTOB, 1) if self.mirror_image: gp.pixmode(GL.PM_RTOL, 1) if self.format in ('jpeg', 'jpeggrey'): import jpeg data, width, height, bytes = jpeg.decompress(data) pmsize = bytes*8 elif self.format == 'compress': if not self.decompressor: import cl, CL scheme = cl.QueryScheme(self.compressheader) self.decompressor = cl.OpenDecompressor(scheme) headersize = self.decompressor.ReadHeader(self.compressheader) width = self.decompressor.GetParam(CL.IMAGE_WIDTH) height = self.decompressor.GetParam(CL.IMAGE_HEIGHT) params = [CL.ORIGINAL_FORMAT, CL.RGBX, \ CL.ORIENTATION, CL.BOTTOM_UP, \ CL.FRAME_BUFFER_SIZE, width*height*CL.BytesPerPixel(CL.RGBX)] self.decompressor.SetParams(params) data = self.decompressor.Decompress(1, data) elif self.format in ('mono', 'grey4'): if self.mustunpack: if self.format == 'mono': data = imageop.mono2grey(data, \ w/xpf, h/ypf, 0x20, 0xdf) elif self.format == 'grey4': data = imageop.grey42grey(data, \ w/xpf, h/ypf) pmsize = 8 elif self.format == 'grey2': data = imageop.grey22grey(data, w/xpf, h/ypf) pmsize = 8 if not self.colormapinited: self.initcolormap() if self.fixcolor0: gl.mapcolor(self.color0) self.fixcolor0 = 0 xfactor = yfactor = self.magnify xfactor = xfactor * xpf yfactor = yfactor * ypf if chromdata and not self.skipchrom: cp = self.chrompack cx = int(x*xfactor*cp) + self.xorigin cy = int(y*yfactor*cp) + self.yorigin cw = (w+cp-1)/cp ch = (h+cp-1)/cp gl.rectzoom(xfactor*cp, yfactor*cp) gl.pixmode(GL.PM_SIZE, 16) gl.writemask(self.mask - ((1 << self.c0bits) - 1)) gl.lrectwrite(cx, cy, cx + cw - 1, cy + ch - 1, \ chromdata) # if pmsize < 32: gl.writemask((1 << self.c0bits) - 1) gl.pixmode(GL.PM_SIZE, pmsize) w = w/xpf h = h/ypf x = x/xpf y = y/ypf gl.rectzoom(xfactor, yfactor) x = int(x*xfactor)+self.xorigin y = int(y*yfactor)+self.yorigin gl.lrectwrite(x, y, x + w - 1, y + h - 1, data) gl.gflush() | 734021fe8943fd4ffc264b91296287d4b0e4eb1a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/734021fe8943fd4ffc264b91296287d4b0e4eb1a/VFile.py |
Node.debug=open( "debug4.out", "w" ) | Node.debug=StringIO() | def __init__( self ): self.childNodes=[] if Node._debug: index=repr( id( self ))+repr( self.__class__ ) Node.allnodes[index]=repr( self.__dict__ ) if Node.debug==None: Node.debug=open( "debug4.out", "w" ) Node.debug.write( "create %s\n"%index ) | f0957d392e46781c2bb15f5f62aba6c6dd5bb3da /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f0957d392e46781c2bb15f5f62aba6c6dd5bb3da/minidom.py |
if type( attname_or_tuple ) == type( () ): | if type( attname_or_tuple ) == types.TupleType: | def __getitem__( self, attname_or_tuple ): if type( attname_or_tuple ) == type( () ): return self._attrsNS[attname_or_tuple] else: return self._attrs[attname_or_tuple] | f0957d392e46781c2bb15f5f62aba6c6dd5bb3da /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f0957d392e46781c2bb15f5f62aba6c6dd5bb3da/minidom.py |
def __setitem__( self, attname ): raise TypeError, "object does not support item assignment" | def __setitem__( self, attname, value ): if type( value ) == types.StringType: node=Attr( attname ) node.value=value else: assert isinstance( value, Attr ) or type( value )==types.StringType node=value old=self._attrs.get( attname, None) if old: old.unlink() self._attrs[node.name]=node self._attrsNS[(node.namespaceURI,node.localName)]=node | def __setitem__( self, attname ): raise TypeError, "object does not support item assignment" | f0957d392e46781c2bb15f5f62aba6c6dd5bb3da /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f0957d392e46781c2bb15f5f62aba6c6dd5bb3da/minidom.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) | 9b3db2c2c77b9dc37cb1cf9e9135dfe7bfec4d7c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9b3db2c2c77b9dc37cb1cf9e9135dfe7bfec4d7c/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) | 9b3db2c2c77b9dc37cb1cf9e9135dfe7bfec4d7c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9b3db2c2c77b9dc37cb1cf9e9135dfe7bfec4d7c/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) | 9b3db2c2c77b9dc37cb1cf9e9135dfe7bfec4d7c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9b3db2c2c77b9dc37cb1cf9e9135dfe7bfec4d7c/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""" | 9b3db2c2c77b9dc37cb1cf9e9135dfe7bfec4d7c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9b3db2c2c77b9dc37cb1cf9e9135dfe7bfec4d7c/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) | 9b3db2c2c77b9dc37cb1cf9e9135dfe7bfec4d7c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9b3db2c2c77b9dc37cb1cf9e9135dfe7bfec4d7c/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) | 9b3db2c2c77b9dc37cb1cf9e9135dfe7bfec4d7c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9b3db2c2c77b9dc37cb1cf9e9135dfe7bfec4d7c/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) | 9b3db2c2c77b9dc37cb1cf9e9135dfe7bfec4d7c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9b3db2c2c77b9dc37cb1cf9e9135dfe7bfec4d7c/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""" | 9b3db2c2c77b9dc37cb1cf9e9135dfe7bfec4d7c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9b3db2c2c77b9dc37cb1cf9e9135dfe7bfec4d7c/test_hexoct.py |
def randrange(n): """Return a random shuffle of range(n).""" | def randfloats(n): """Return a list of n random floats in [0, 1).""" | def randrange(n): """Return a random shuffle of range(n).""" fn = os.path.join(td, "rr%06d" % n) try: fp = open(fn, "rb") except IOError: result = [] for i in range(n): result.append(random.random()) try: try: fp = open(fn, "wb") marshal.dump(result, fp) fp.close() fp = None finally: if fp: try: os.unlink(fn) except os.error: pass except IOError, msg: print "can't write", fn, ":", msg else: result = marshal.load(fp) fp.close() ##assert len(result) == n # Shuffle it a bit... for i in range(10): i = random.randrange(0, n) temp = result[:i] del result[:i] temp.reverse() result[len(result):] = temp del temp return result | c74091f4ea1e34382dd3b425d37f010ab91c9d7b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c74091f4ea1e34382dd3b425d37f010ab91c9d7b/sortperf.py |
result = [] for i in range(n): result.append(random.random()) | r = random.random result = [r() for i in xrange(n)] | def randrange(n): """Return a random shuffle of range(n).""" fn = os.path.join(td, "rr%06d" % n) try: fp = open(fn, "rb") except IOError: result = [] for i in range(n): result.append(random.random()) try: try: fp = open(fn, "wb") marshal.dump(result, fp) fp.close() fp = None finally: if fp: try: os.unlink(fn) except os.error: pass except IOError, msg: print "can't write", fn, ":", msg else: result = marshal.load(fp) fp.close() ##assert len(result) == n # Shuffle it a bit... for i in range(10): i = random.randrange(0, n) temp = result[:i] del result[:i] temp.reverse() result[len(result):] = temp del temp return result | c74091f4ea1e34382dd3b425d37f010ab91c9d7b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c74091f4ea1e34382dd3b425d37f010ab91c9d7b/sortperf.py |
def randrange(n): """Return a random shuffle of range(n).""" fn = os.path.join(td, "rr%06d" % n) try: fp = open(fn, "rb") except IOError: result = [] for i in range(n): result.append(random.random()) try: try: fp = open(fn, "wb") marshal.dump(result, fp) fp.close() fp = None finally: if fp: try: os.unlink(fn) except os.error: pass except IOError, msg: print "can't write", fn, ":", msg else: result = marshal.load(fp) fp.close() ##assert len(result) == n # Shuffle it a bit... for i in range(10): i = random.randrange(0, n) temp = result[:i] del result[:i] temp.reverse() result[len(result):] = temp del temp return result | c74091f4ea1e34382dd3b425d37f010ab91c9d7b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c74091f4ea1e34382dd3b425d37f010ab91c9d7b/sortperf.py |
||
i = random.randrange(0, n) | i = random.randrange(n) | def randrange(n): """Return a random shuffle of range(n).""" fn = os.path.join(td, "rr%06d" % n) try: fp = open(fn, "rb") except IOError: result = [] for i in range(n): result.append(random.random()) try: try: fp = open(fn, "wb") marshal.dump(result, fp) fp.close() fp = None finally: if fp: try: os.unlink(fn) except os.error: pass except IOError, msg: print "can't write", fn, ":", msg else: result = marshal.load(fp) fp.close() ##assert len(result) == n # Shuffle it a bit... for i in range(10): i = random.randrange(0, n) temp = result[:i] del result[:i] temp.reverse() result[len(result):] = temp del temp return result | c74091f4ea1e34382dd3b425d37f010ab91c9d7b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c74091f4ea1e34382dd3b425d37f010ab91c9d7b/sortperf.py |
result[len(result):] = temp | result.extend(temp) | def randrange(n): """Return a random shuffle of range(n).""" fn = os.path.join(td, "rr%06d" % n) try: fp = open(fn, "rb") except IOError: result = [] for i in range(n): result.append(random.random()) try: try: fp = open(fn, "wb") marshal.dump(result, fp) fp.close() fp = None finally: if fp: try: os.unlink(fn) except os.error: pass except IOError, msg: print "can't write", fn, ":", msg else: result = marshal.load(fp) fp.close() ##assert len(result) == n # Shuffle it a bit... for i in range(10): i = random.randrange(0, n) temp = result[:i] del result[:i] temp.reverse() result[len(result):] = temp del temp return result | c74091f4ea1e34382dd3b425d37f010ab91c9d7b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c74091f4ea1e34382dd3b425d37f010ab91c9d7b/sortperf.py |
def fl(): | def flush(): | def fl(): sys.stdout.flush() | c74091f4ea1e34382dd3b425d37f010ab91c9d7b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c74091f4ea1e34382dd3b425d37f010ab91c9d7b/sortperf.py |
fl() | flush() | def doit(L): t0 = time.clock() L.sort() t1 = time.clock() print "%6.2f" % (t1-t0), fl() | c74091f4ea1e34382dd3b425d37f010ab91c9d7b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c74091f4ea1e34382dd3b425d37f010ab91c9d7b/sortperf.py |
-sort: all equal | =sort: all equal | def tabulate(r): """Tabulate sort speed for lists of various sizes. The sizes are 2**i for i in r (the argument, a list). The output displays i, 2**i, and the time to sort arrays of 2**i floating point numbers with the following properties: *sort: random data \sort: descending data /sort: ascending data ~sort: many duplicates -sort: all equal !sort: worst case scenario """ cases = ("*sort", "\\sort", "/sort", "~sort", "-sort", "!sort") fmt = ("%2s %6s" + " %6s"*len(cases)) print fmt % (("i", "2**i") + cases) for i in r: n = 1<<i L = randrange(n) ##assert len(L) == n print "%2d %6d" % (i, n), fl() doit(L) # *sort L.reverse() doit(L) # \sort doit(L) # /sort if n > 4: del L[4:] L = L*(n/4) L = map(lambda x: --x, L) doit(L) # ~sort del L L = map(abs, [-0.5]*n) doit(L) # -sort L = range(n/2-1, -1, -1) L[len(L):] = range(n/2) doit(L) # !sort print | c74091f4ea1e34382dd3b425d37f010ab91c9d7b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c74091f4ea1e34382dd3b425d37f010ab91c9d7b/sortperf.py |
cases = ("*sort", "\\sort", "/sort", "~sort", "-sort", "!sort") fmt = ("%2s %6s" + " %6s"*len(cases)) | cases = ("*sort", "\\sort", "/sort", "~sort", "=sort", "!sort") fmt = ("%2s %7s" + " %6s"*len(cases)) | def tabulate(r): """Tabulate sort speed for lists of various sizes. The sizes are 2**i for i in r (the argument, a list). The output displays i, 2**i, and the time to sort arrays of 2**i floating point numbers with the following properties: *sort: random data \sort: descending data /sort: ascending data ~sort: many duplicates -sort: all equal !sort: worst case scenario """ cases = ("*sort", "\\sort", "/sort", "~sort", "-sort", "!sort") fmt = ("%2s %6s" + " %6s"*len(cases)) print fmt % (("i", "2**i") + cases) for i in r: n = 1<<i L = randrange(n) ##assert len(L) == n print "%2d %6d" % (i, n), fl() doit(L) # *sort L.reverse() doit(L) # \sort doit(L) # /sort if n > 4: del L[4:] L = L*(n/4) L = map(lambda x: --x, L) doit(L) # ~sort del L L = map(abs, [-0.5]*n) doit(L) # -sort L = range(n/2-1, -1, -1) L[len(L):] = range(n/2) doit(L) # !sort print | c74091f4ea1e34382dd3b425d37f010ab91c9d7b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c74091f4ea1e34382dd3b425d37f010ab91c9d7b/sortperf.py |
n = 1<<i L = randrange(n) print "%2d %6d" % (i, n), fl() | n = 1 << i L = randfloats(n) print "%2d %7d" % (i, n), flush() | def tabulate(r): """Tabulate sort speed for lists of various sizes. The sizes are 2**i for i in r (the argument, a list). The output displays i, 2**i, and the time to sort arrays of 2**i floating point numbers with the following properties: *sort: random data \sort: descending data /sort: ascending data ~sort: many duplicates -sort: all equal !sort: worst case scenario """ cases = ("*sort", "\\sort", "/sort", "~sort", "-sort", "!sort") fmt = ("%2s %6s" + " %6s"*len(cases)) print fmt % (("i", "2**i") + cases) for i in r: n = 1<<i L = randrange(n) ##assert len(L) == n print "%2d %6d" % (i, n), fl() doit(L) # *sort L.reverse() doit(L) # \sort doit(L) # /sort if n > 4: del L[4:] L = L*(n/4) L = map(lambda x: --x, L) doit(L) # ~sort del L L = map(abs, [-0.5]*n) doit(L) # -sort L = range(n/2-1, -1, -1) L[len(L):] = range(n/2) doit(L) # !sort print | c74091f4ea1e34382dd3b425d37f010ab91c9d7b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c74091f4ea1e34382dd3b425d37f010ab91c9d7b/sortperf.py |
L = L*(n/4) | L = L * (n // 4) | def tabulate(r): """Tabulate sort speed for lists of various sizes. The sizes are 2**i for i in r (the argument, a list). The output displays i, 2**i, and the time to sort arrays of 2**i floating point numbers with the following properties: *sort: random data \sort: descending data /sort: ascending data ~sort: many duplicates -sort: all equal !sort: worst case scenario """ cases = ("*sort", "\\sort", "/sort", "~sort", "-sort", "!sort") fmt = ("%2s %6s" + " %6s"*len(cases)) print fmt % (("i", "2**i") + cases) for i in r: n = 1<<i L = randrange(n) ##assert len(L) == n print "%2d %6d" % (i, n), fl() doit(L) # *sort L.reverse() doit(L) # \sort doit(L) # /sort if n > 4: del L[4:] L = L*(n/4) L = map(lambda x: --x, L) doit(L) # ~sort del L L = map(abs, [-0.5]*n) doit(L) # -sort L = range(n/2-1, -1, -1) L[len(L):] = range(n/2) doit(L) # !sort print | c74091f4ea1e34382dd3b425d37f010ab91c9d7b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c74091f4ea1e34382dd3b425d37f010ab91c9d7b/sortperf.py |
L = map(abs, [-0.5]*n) doit(L) L = range(n/2-1, -1, -1) L[len(L):] = range(n/2) | L = map(abs, [-0.5] * n) doit(L) del L half = n // 2 L = range(half - 1, -1, -1) L.extend(range(half)) L = map(float, L) | def tabulate(r): """Tabulate sort speed for lists of various sizes. The sizes are 2**i for i in r (the argument, a list). The output displays i, 2**i, and the time to sort arrays of 2**i floating point numbers with the following properties: *sort: random data \sort: descending data /sort: ascending data ~sort: many duplicates -sort: all equal !sort: worst case scenario """ cases = ("*sort", "\\sort", "/sort", "~sort", "-sort", "!sort") fmt = ("%2s %6s" + " %6s"*len(cases)) print fmt % (("i", "2**i") + cases) for i in r: n = 1<<i L = randrange(n) ##assert len(L) == n print "%2d %6d" % (i, n), fl() doit(L) # *sort L.reverse() doit(L) # \sort doit(L) # /sort if n > 4: del L[4:] L = L*(n/4) L = map(lambda x: --x, L) doit(L) # ~sort del L L = map(abs, [-0.5]*n) doit(L) # -sort L = range(n/2-1, -1, -1) L[len(L):] = range(n/2) doit(L) # !sort print | c74091f4ea1e34382dd3b425d37f010ab91c9d7b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c74091f4ea1e34382dd3b425d37f010ab91c9d7b/sortperf.py |
k2 = 19 | k2 = 20 | def main(): """Main program when invoked as a script. One argument: tabulate a single row. Two arguments: tabulate a range (inclusive). Extra arguments are used to seed the random generator. """ # default range (inclusive) k1 = 15 k2 = 19 if sys.argv[1:]: # one argument: single point k1 = k2 = int(sys.argv[1]) if sys.argv[2:]: # two arguments: specify range k2 = int(sys.argv[2]) if sys.argv[3:]: # derive random seed from remaining arguments x, y, z = 0, 0, 0 for a in sys.argv[3:]: h = hash(a) h, d = divmod(h, 256) h = h & 0xffffff x = (x^h^d) & 255 h = h>>8 y = (y^h^d) & 255 h = h>>8 z = (z^h^d) & 255 whrandom.seed(x, y, z) r = range(k1, k2+1) # include the end point tabulate(r) | c74091f4ea1e34382dd3b425d37f010ab91c9d7b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c74091f4ea1e34382dd3b425d37f010ab91c9d7b/sortperf.py |
x, y, z = 0, 0, 0 | x = 1 | def main(): """Main program when invoked as a script. One argument: tabulate a single row. Two arguments: tabulate a range (inclusive). Extra arguments are used to seed the random generator. """ # default range (inclusive) k1 = 15 k2 = 19 if sys.argv[1:]: # one argument: single point k1 = k2 = int(sys.argv[1]) if sys.argv[2:]: # two arguments: specify range k2 = int(sys.argv[2]) if sys.argv[3:]: # derive random seed from remaining arguments x, y, z = 0, 0, 0 for a in sys.argv[3:]: h = hash(a) h, d = divmod(h, 256) h = h & 0xffffff x = (x^h^d) & 255 h = h>>8 y = (y^h^d) & 255 h = h>>8 z = (z^h^d) & 255 whrandom.seed(x, y, z) r = range(k1, k2+1) # include the end point tabulate(r) | c74091f4ea1e34382dd3b425d37f010ab91c9d7b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c74091f4ea1e34382dd3b425d37f010ab91c9d7b/sortperf.py |
h = hash(a) h, d = divmod(h, 256) h = h & 0xffffff x = (x^h^d) & 255 h = h>>8 y = (y^h^d) & 255 h = h>>8 z = (z^h^d) & 255 whrandom.seed(x, y, z) | x = 69069 * x + hash(a) random.seed(x) | def main(): """Main program when invoked as a script. One argument: tabulate a single row. Two arguments: tabulate a range (inclusive). Extra arguments are used to seed the random generator. """ # default range (inclusive) k1 = 15 k2 = 19 if sys.argv[1:]: # one argument: single point k1 = k2 = int(sys.argv[1]) if sys.argv[2:]: # two arguments: specify range k2 = int(sys.argv[2]) if sys.argv[3:]: # derive random seed from remaining arguments x, y, z = 0, 0, 0 for a in sys.argv[3:]: h = hash(a) h, d = divmod(h, 256) h = h & 0xffffff x = (x^h^d) & 255 h = h>>8 y = (y^h^d) & 255 h = h>>8 z = (z^h^d) & 255 whrandom.seed(x, y, z) r = range(k1, k2+1) # include the end point tabulate(r) | c74091f4ea1e34382dd3b425d37f010ab91c9d7b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c74091f4ea1e34382dd3b425d37f010ab91c9d7b/sortperf.py |
if (new == Py_None) { | if (new == NULL || new == Py_None) { | def outputFreeIt(self, itselfname): Output("DisposeDialog(%s);", itselfname) | f2ecd710fd5a5b541e667d9781f14f90aa434243 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f2ecd710fd5a5b541e667d9781f14f90aa434243/dlgsupport.py |
self.recall(sel) | self.recall(sel, event) | def enter_callback(self, event): if self.executing and not self.reading: return # Let the default binding (insert '\n') take over # If some text is selected, recall the selection # (but only if this before the I/O mark) try: sel = self.text.get("sel.first", "sel.last") if sel: if self.text.compare("sel.last", "<=", "iomark"): self.recall(sel) return "break" except: pass # If we're strictly before the line containing iomark, recall # the current line, less a leading prompt, less leading or # trailing whitespace if self.text.compare("insert", "<", "iomark linestart"): # Check if there's a relevant stdin range -- if so, use it prev = self.text.tag_prevrange("stdin", "insert") if prev and self.text.compare("insert", "<", prev[1]): self.recall(self.text.get(prev[0], prev[1])) return "break" next = self.text.tag_nextrange("stdin", "insert") if next and self.text.compare("insert lineend", ">=", next[0]): self.recall(self.text.get(next[0], next[1])) return "break" # No stdin mark -- just get the current line, less any prompt line = self.text.get("insert linestart", "insert lineend") last_line_of_prompt = sys.ps1.split('\n')[-1] if line.startswith(last_line_of_prompt): line = line[len(last_line_of_prompt):] self.recall(line) return "break" # If we're between the beginning of the line and the iomark, i.e. # in the prompt area, move to the end of the prompt if self.text.compare("insert", "<", "iomark"): self.text.mark_set("insert", "iomark") # If we're in the current input and there's only whitespace # beyond the cursor, erase that whitespace first s = self.text.get("insert", "end-1c") if s and not s.strip(): self.text.delete("insert", "end-1c") # If we're in the current input before its last line, # insert a newline right at the insert point if self.text.compare("insert", "<", "end-1c linestart"): self.newline_and_indent_event(event) return "break" # We're in the last line; append a newline and submit it self.text.mark_set("insert", "end-1c") if self.reading: self.text.insert("insert", "\n") self.text.see("insert") else: self.newline_and_indent_event(event) self.text.tag_add("stdin", "iomark", "end-1c") self.text.update_idletasks() if self.reading: self.top.quit() # Break out of recursive mainloop() in raw_input() else: self.runit() return "break" | 4a60c2509101bbcdc5d7ab9cdd50c14feed8709f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4a60c2509101bbcdc5d7ab9cdd50c14feed8709f/PyShell.py |
self.recall(self.text.get(prev[0], prev[1])) | self.recall(self.text.get(prev[0], prev[1]), event) | def enter_callback(self, event): if self.executing and not self.reading: return # Let the default binding (insert '\n') take over # If some text is selected, recall the selection # (but only if this before the I/O mark) try: sel = self.text.get("sel.first", "sel.last") if sel: if self.text.compare("sel.last", "<=", "iomark"): self.recall(sel) return "break" except: pass # If we're strictly before the line containing iomark, recall # the current line, less a leading prompt, less leading or # trailing whitespace if self.text.compare("insert", "<", "iomark linestart"): # Check if there's a relevant stdin range -- if so, use it prev = self.text.tag_prevrange("stdin", "insert") if prev and self.text.compare("insert", "<", prev[1]): self.recall(self.text.get(prev[0], prev[1])) return "break" next = self.text.tag_nextrange("stdin", "insert") if next and self.text.compare("insert lineend", ">=", next[0]): self.recall(self.text.get(next[0], next[1])) return "break" # No stdin mark -- just get the current line, less any prompt line = self.text.get("insert linestart", "insert lineend") last_line_of_prompt = sys.ps1.split('\n')[-1] if line.startswith(last_line_of_prompt): line = line[len(last_line_of_prompt):] self.recall(line) return "break" # If we're between the beginning of the line and the iomark, i.e. # in the prompt area, move to the end of the prompt if self.text.compare("insert", "<", "iomark"): self.text.mark_set("insert", "iomark") # If we're in the current input and there's only whitespace # beyond the cursor, erase that whitespace first s = self.text.get("insert", "end-1c") if s and not s.strip(): self.text.delete("insert", "end-1c") # If we're in the current input before its last line, # insert a newline right at the insert point if self.text.compare("insert", "<", "end-1c linestart"): self.newline_and_indent_event(event) return "break" # We're in the last line; append a newline and submit it self.text.mark_set("insert", "end-1c") if self.reading: self.text.insert("insert", "\n") self.text.see("insert") else: self.newline_and_indent_event(event) self.text.tag_add("stdin", "iomark", "end-1c") self.text.update_idletasks() if self.reading: self.top.quit() # Break out of recursive mainloop() in raw_input() else: self.runit() return "break" | 4a60c2509101bbcdc5d7ab9cdd50c14feed8709f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4a60c2509101bbcdc5d7ab9cdd50c14feed8709f/PyShell.py |
self.recall(self.text.get(next[0], next[1])) | self.recall(self.text.get(next[0], next[1]), event) | def enter_callback(self, event): if self.executing and not self.reading: return # Let the default binding (insert '\n') take over # If some text is selected, recall the selection # (but only if this before the I/O mark) try: sel = self.text.get("sel.first", "sel.last") if sel: if self.text.compare("sel.last", "<=", "iomark"): self.recall(sel) return "break" except: pass # If we're strictly before the line containing iomark, recall # the current line, less a leading prompt, less leading or # trailing whitespace if self.text.compare("insert", "<", "iomark linestart"): # Check if there's a relevant stdin range -- if so, use it prev = self.text.tag_prevrange("stdin", "insert") if prev and self.text.compare("insert", "<", prev[1]): self.recall(self.text.get(prev[0], prev[1])) return "break" next = self.text.tag_nextrange("stdin", "insert") if next and self.text.compare("insert lineend", ">=", next[0]): self.recall(self.text.get(next[0], next[1])) return "break" # No stdin mark -- just get the current line, less any prompt line = self.text.get("insert linestart", "insert lineend") last_line_of_prompt = sys.ps1.split('\n')[-1] if line.startswith(last_line_of_prompt): line = line[len(last_line_of_prompt):] self.recall(line) return "break" # If we're between the beginning of the line and the iomark, i.e. # in the prompt area, move to the end of the prompt if self.text.compare("insert", "<", "iomark"): self.text.mark_set("insert", "iomark") # If we're in the current input and there's only whitespace # beyond the cursor, erase that whitespace first s = self.text.get("insert", "end-1c") if s and not s.strip(): self.text.delete("insert", "end-1c") # If we're in the current input before its last line, # insert a newline right at the insert point if self.text.compare("insert", "<", "end-1c linestart"): self.newline_and_indent_event(event) return "break" # We're in the last line; append a newline and submit it self.text.mark_set("insert", "end-1c") if self.reading: self.text.insert("insert", "\n") self.text.see("insert") else: self.newline_and_indent_event(event) self.text.tag_add("stdin", "iomark", "end-1c") self.text.update_idletasks() if self.reading: self.top.quit() # Break out of recursive mainloop() in raw_input() else: self.runit() return "break" | 4a60c2509101bbcdc5d7ab9cdd50c14feed8709f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4a60c2509101bbcdc5d7ab9cdd50c14feed8709f/PyShell.py |
self.recall(line) | self.recall(line, event) | def enter_callback(self, event): if self.executing and not self.reading: return # Let the default binding (insert '\n') take over # If some text is selected, recall the selection # (but only if this before the I/O mark) try: sel = self.text.get("sel.first", "sel.last") if sel: if self.text.compare("sel.last", "<=", "iomark"): self.recall(sel) return "break" except: pass # If we're strictly before the line containing iomark, recall # the current line, less a leading prompt, less leading or # trailing whitespace if self.text.compare("insert", "<", "iomark linestart"): # Check if there's a relevant stdin range -- if so, use it prev = self.text.tag_prevrange("stdin", "insert") if prev and self.text.compare("insert", "<", prev[1]): self.recall(self.text.get(prev[0], prev[1])) return "break" next = self.text.tag_nextrange("stdin", "insert") if next and self.text.compare("insert lineend", ">=", next[0]): self.recall(self.text.get(next[0], next[1])) return "break" # No stdin mark -- just get the current line, less any prompt line = self.text.get("insert linestart", "insert lineend") last_line_of_prompt = sys.ps1.split('\n')[-1] if line.startswith(last_line_of_prompt): line = line[len(last_line_of_prompt):] self.recall(line) return "break" # If we're between the beginning of the line and the iomark, i.e. # in the prompt area, move to the end of the prompt if self.text.compare("insert", "<", "iomark"): self.text.mark_set("insert", "iomark") # If we're in the current input and there's only whitespace # beyond the cursor, erase that whitespace first s = self.text.get("insert", "end-1c") if s and not s.strip(): self.text.delete("insert", "end-1c") # If we're in the current input before its last line, # insert a newline right at the insert point if self.text.compare("insert", "<", "end-1c linestart"): self.newline_and_indent_event(event) return "break" # We're in the last line; append a newline and submit it self.text.mark_set("insert", "end-1c") if self.reading: self.text.insert("insert", "\n") self.text.see("insert") else: self.newline_and_indent_event(event) self.text.tag_add("stdin", "iomark", "end-1c") self.text.update_idletasks() if self.reading: self.top.quit() # Break out of recursive mainloop() in raw_input() else: self.runit() return "break" | 4a60c2509101bbcdc5d7ab9cdd50c14feed8709f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4a60c2509101bbcdc5d7ab9cdd50c14feed8709f/PyShell.py |
def recall(self, s): if self.history: self.history.recall(s) | def recall(self, s, event): self.text.undo_block_start() try: self.text.tag_remove("sel", "1.0", "end") self.text.mark_set("insert", "end-1c") s = s.strip() lines = s.split('\n') if lines: prefix = self.text.get("insert linestart","insert").rstrip() if prefix and prefix[-1]==':': self.newline_and_indent_event(event) self.text.insert("insert",lines[0].strip()) if len(lines) > 1: self.newline_and_indent_event(event) for line in lines[1:]: self.text.insert("insert", line.strip()) self.newline_and_indent_event(event) else: self.text.insert("insert", s) finally: self.text.see("insert") self.text.undo_block_stop() | def recall(self, s): if self.history: self.history.recall(s) | 4a60c2509101bbcdc5d7ab9cdd50c14feed8709f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4a60c2509101bbcdc5d7ab9cdd50c14feed8709f/PyShell.py |
if pathname and pathname[0] == '/': | if not pathname: return pathname if pathname[0] == '/': | def convert_path (pathname): """Return 'pathname' as a name that will work on the native filesystem, i.e. split it on '/' and put it back together again using the current directory separator. Needed because filenames in the setup script are always supplied in Unix style, and have to be converted to the local convention before we can actually use them in the filesystem. Raises ValueError on non-Unix-ish systems if 'pathname' either starts or ends with a slash. """ if os.sep == '/': return pathname if pathname and pathname[0] == '/': raise ValueError, "path '%s' cannot be absolute" % pathname if pathname and pathname[-1] == '/': raise ValueError, "path '%s' cannot end with '/'" % pathname paths = string.split(pathname, '/') while '.' in paths: paths.remove('.') if not paths: return os.curdir return apply(os.path.join, paths) | 0123ec5f56f1bea434ab9b7b547337b250c0f3b3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/0123ec5f56f1bea434ab9b7b547337b250c0f3b3/util.py |
if pathname and pathname[-1] == '/': | if pathname[-1] == '/': | def convert_path (pathname): """Return 'pathname' as a name that will work on the native filesystem, i.e. split it on '/' and put it back together again using the current directory separator. Needed because filenames in the setup script are always supplied in Unix style, and have to be converted to the local convention before we can actually use them in the filesystem. Raises ValueError on non-Unix-ish systems if 'pathname' either starts or ends with a slash. """ if os.sep == '/': return pathname if pathname and pathname[0] == '/': raise ValueError, "path '%s' cannot be absolute" % pathname if pathname and pathname[-1] == '/': raise ValueError, "path '%s' cannot end with '/'" % pathname paths = string.split(pathname, '/') while '.' in paths: paths.remove('.') if not paths: return os.curdir return apply(os.path.join, paths) | 0123ec5f56f1bea434ab9b7b547337b250c0f3b3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/0123ec5f56f1bea434ab9b7b547337b250c0f3b3/util.py |
tag = self._command(name, mailbox, flags, date_time, message) return self._command_complete(name, tag) | return self._simple_command(name, mailbox, flags, date_time, message) | def append(self, mailbox, flags, date_time, message): """Append message to named mailbox. | 568f22046d54f57ebb15b35bb4692bb3d957b838 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/568f22046d54f57ebb15b35bb4692bb3d957b838/imaplib.py |
return code, self.untagged_responses.get(code, [None]) | return self._untagged_response(code, code) | def response(self, code): """Return data for response 'code' if received, or None. | 568f22046d54f57ebb15b35bb4692bb3d957b838 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/568f22046d54f57ebb15b35bb4692bb3d957b838/imaplib.py |
for r in ('EXISTS', 'READ-WRITE'): if self.untagged_responses.has_key(r): del self.untagged_responses[r] | self.untagged_responses = {} | def select(self, mailbox='INBOX', readonly=None): """Select a mailbox. | 568f22046d54f57ebb15b35bb4692bb3d957b838 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/568f22046d54f57ebb15b35bb4692bb3d957b838/imaplib.py |
command = '%s %s' % (command, flag_list) typ, dat = self._simple_command('STORE', message_set, command) | typ, dat = self._simple_command('STORE', message_set, command, flag_list) | def store(self, message_set, command, flag_list): """Alters flag dispositions for messages in mailbox. | 568f22046d54f57ebb15b35bb4692bb3d957b838 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/568f22046d54f57ebb15b35bb4692bb3d957b838/imaplib.py |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.