rem
stringlengths 1
322k
| add
stringlengths 0
2.05M
| context
stringlengths 4
228k
| meta
stringlengths 156
215
|
---|---|---|---|
labels = doc.getElementsByTagName("label") for label in labels: id = label.getAttribute("id") if not id: continue parent = label.parentNode if parent.tagName == "title": parent.parentNode.setAttribute("id", id) else: parent.setAttribute("id", id) parent.removeChild(label)
|
for node in doc.childNodes: if node.nodeType == xml.dom.core.ELEMENT: labels = node.getElementsByTagName("label") for label in labels: id = label.getAttribute("id") if not id: continue parent = label.parentNode if parent.tagName == "title": parent.parentNode.setAttribute("id", id) else: parent.setAttribute("id", id) parent.removeChild(label)
|
def handle_labels(doc): labels = doc.getElementsByTagName("label") for label in labels: id = label.getAttribute("id") if not id: continue parent = label.parentNode if parent.tagName == "title": parent.parentNode.setAttribute("id", id) else: parent.setAttribute("id", id) # now, remove <label id="..."/> from parent: parent.removeChild(label)
|
2664db9f763568dee0f53426ab9885ea3c624395 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/2664db9f763568dee0f53426ab9885ea3c624395/docfixer.py
|
if platform in ('darwin', 'mac'):
|
if platform in ('darwin', 'mac') and ("--disable-toolbox-glue" not in sysconfig.get_config_var("CONFIG_ARGS")):
|
def build_extensions(self):
|
cc8a4f6563395e39d77da9888d0ea3675214ca64 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/cc8a4f6563395e39d77da9888d0ea3675214ca64/setup.py
|
if platform == 'darwin':
|
if platform == 'darwin' and ("--disable-toolbox-glue" not in sysconfig.get_config_var("CONFIG_ARGS")):
|
def detect_modules(self): # Ensure that /usr/local is always used add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
|
cc8a4f6563395e39d77da9888d0ea3675214ca64 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/cc8a4f6563395e39d77da9888d0ea3675214ca64/setup.py
|
for p in paramre.split(value):
|
for p in _parseparam(';' + value):
|
def _get_params_preserve(self, failobj, header): # Like get_params() but preserves the quoting of values. BAW: # should this be part of the public interface? missing = [] value = self.get(header, missing) if value is missing: return failobj params = [] for p in paramre.split(value): try: name, val = p.split('=', 1) name = name.strip() val = val.strip() except ValueError: # Must have been a bare attribute name = p.strip() val = '' params.append((name, val)) params = Utils.decode_params(params) return params
|
a74e868857e2122d3e5c895a86a8cf930af48e0a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a74e868857e2122d3e5c895a86a8cf930af48e0a/Message.py
|
fss = alias.Resolve()[0] pathname = fss.as_pathname()
|
fsr = alias.FSResolveAlias(None)[0] pathname = fsr.as_pathname()
|
def open_file(self, _object=None, **args): for alias in _object: fss = alias.Resolve()[0] pathname = fss.as_pathname() sys.argv.append(pathname) self._quit()
|
b135548d0d6fb390d2b1c64e9a0b3db6c2043346 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b135548d0d6fb390d2b1c64e9a0b3db6c2043346/argvemulator.py
|
"""test whether PATH corresponds to a CGI script. Return a tuple (dir, rest) if PATH requires running a
|
"""Test whether self.path corresponds to a CGI script. Return a tuple (dir, rest) if self.path requires running a
|
def is_cgi(self): """test whether PATH corresponds to a CGI script.
|
e7d6b0a22e07adfa33cfa8658acf4c0b3cbecb39 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e7d6b0a22e07adfa33cfa8658acf4c0b3cbecb39/CGIHTTPServer.py
|
if not executable(scriptfile): self.send_error(403, "CGI script is not executable (%s)" % `scriptname`) return nobody = nobody_uid()
|
ispy = self.is_python(scriptname) if not ispy: if not (self.have_fork or self.have_popen2): self.send_error(403, "CGI script is not a Python script (%s)" % `scriptname`) return if not self.is_executable(scriptfile): self.send_error(403, "CGI script is not executable (%s)" % `scriptname`) return env = {} env['SERVER_SOFTWARE'] = self.version_string() env['SERVER_NAME'] = self.server.server_name env['GATEWAY_INTERFACE'] = 'CGI/1.1' env['SERVER_PROTOCOL'] = self.protocol_version env['SERVER_PORT'] = str(self.server.server_port) env['REQUEST_METHOD'] = self.command uqrest = urllib.unquote(rest) env['PATH_INFO'] = uqrest env['PATH_TRANSLATED'] = self.translate_path(uqrest) env['SCRIPT_NAME'] = scriptname if query: env['QUERY_STRING'] = query host = self.address_string() if host != self.client_address[0]: env['REMOTE_HOST'] = host env['REMOTE_ADDR'] = self.client_address[0] if self.headers.typeheader is None: env['CONTENT_TYPE'] = self.headers.type else: env['CONTENT_TYPE'] = self.headers.typeheader length = self.headers.getheader('content-length') if length: env['CONTENT_LENGTH'] = length accept = [] for line in self.headers.getallmatchingheaders('accept'): if line[:1] in string.whitespace: accept.append(string.strip(line)) else: accept = accept + string.split(line[7:], ',') env['HTTP_ACCEPT'] = string.joinfields(accept, ',') ua = self.headers.getheader('user-agent') if ua: env['HTTP_USER_AGENT'] = ua co = filter(None, self.headers.getheaders('cookie')) if co: env['HTTP_COOKIE'] = string.join(co, ', ') if not self.have_fork: for k in ('QUERY_STRING', 'REMOTE_HOST', 'CONTENT_LENGTH', 'HTTP_USER_AGENT', 'HTTP_COOKIE'): env.setdefault(k, "")
|
def run_cgi(self): """Execute a CGI script.""" dir, rest = self.cgi_info i = string.rfind(rest, '?') if i >= 0: rest, query = rest[:i], rest[i+1:] else: query = '' i = string.find(rest, '/') if i >= 0: script, rest = rest[:i], rest[i:] else: script, rest = rest, '' scriptname = dir + '/' + script scriptfile = self.translate_path(scriptname) if not os.path.exists(scriptfile): self.send_error(404, "No such CGI script (%s)" % `scriptname`) return if not os.path.isfile(scriptfile): self.send_error(403, "CGI script is not a plain file (%s)" % `scriptname`) return if not executable(scriptfile): self.send_error(403, "CGI script is not executable (%s)" % `scriptname`) return nobody = nobody_uid() self.send_response(200, "Script output follows") self.wfile.flush() # Always flush before forking pid = os.fork() if pid != 0: # Parent pid, sts = os.waitpid(pid, 0) if sts: self.log_error("CGI script exit status x%x" % sts) return # Child try: # Reference: http://hoohoo.ncsa.uiuc.edu/cgi/env.html # XXX Much of the following could be prepared ahead of time! env = {} env['SERVER_SOFTWARE'] = self.version_string() env['SERVER_NAME'] = self.server.server_name env['GATEWAY_INTERFACE'] = 'CGI/1.1' env['SERVER_PROTOCOL'] = self.protocol_version env['SERVER_PORT'] = str(self.server.server_port) env['REQUEST_METHOD'] = self.command uqrest = urllib.unquote(rest) env['PATH_INFO'] = uqrest env['PATH_TRANSLATED'] = self.translate_path(uqrest) env['SCRIPT_NAME'] = scriptname if query: env['QUERY_STRING'] = query host = self.address_string() if host != self.client_address[0]: env['REMOTE_HOST'] = host env['REMOTE_ADDR'] = self.client_address[0] # AUTH_TYPE # REMOTE_USER # REMOTE_IDENT if self.headers.typeheader is None: env['CONTENT_TYPE'] = self.headers.type else: env['CONTENT_TYPE'] = self.headers.typeheader length = self.headers.getheader('content-length') if length: env['CONTENT_LENGTH'] = length accept = [] for line in self.headers.getallmatchingheaders('accept'): if line[:1] in string.whitespace: accept.append(string.strip(line)) else: accept = accept + string.split(line[7:], ',') env['HTTP_ACCEPT'] = string.joinfields(accept, ',') ua = self.headers.getheader('user-agent') if ua: env['HTTP_USER_AGENT'] = ua co = filter(None, self.headers.getheaders('cookie')) if co: env['HTTP_COOKIE'] = string.join(co, ', ') # XXX Other HTTP_* headers decoded_query = string.replace(query, '+', ' ') try: os.setuid(nobody) except os.error: pass os.dup2(self.rfile.fileno(), 0) os.dup2(self.wfile.fileno(), 1) print scriptfile, script, decoded_query os.execve(scriptfile, [script, decoded_query], env) except: self.server.handle_error(self.request, self.client_address) os._exit(127)
|
e7d6b0a22e07adfa33cfa8658acf4c0b3cbecb39 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e7d6b0a22e07adfa33cfa8658acf4c0b3cbecb39/CGIHTTPServer.py
|
self.wfile.flush() pid = os.fork() if pid != 0: pid, sts = os.waitpid(pid, 0)
|
decoded_query = string.replace(query, '+', ' ') if self.have_fork: args = [script] if '=' not in decoded_query: args.append(decoded_query) nobody = nobody_uid() self.wfile.flush() pid = os.fork() if pid != 0: pid, sts = os.waitpid(pid, 0) if sts: self.log_error("CGI script exit status % return try: try: os.setuid(nobody) except os.error: pass os.dup2(self.rfile.fileno(), 0) os.dup2(self.wfile.fileno(), 1) os.execve(scriptfile, args, env) except: self.server.handle_error(self.request, self.client_address) os._exit(127) elif self.have_popen2: import shutil os.environ.update(env) cmdline = scriptfile if self.is_python(scriptfile): interp = sys.executable if interp.lower().endswith("w.exe"): interp = interp[:-5] = interp[-4:] cmdline = "%s %s" % (interp, cmdline) if '=' not in query and '"' not in query: cmdline = '%s "%s"' % (cmdline, query) self.log_error("command: %s", cmdline) try: nbytes = int(length) except: nbytes = 0 fi, fo = os.popen2(cmdline) if self.command.lower() == "post" and nbytes > 0: data = self.rfile.read(nbytes) fi.write(data) fi.close() shutil.copyfileobj(fo, self.wfile) sts = fo.close()
|
def run_cgi(self): """Execute a CGI script.""" dir, rest = self.cgi_info i = string.rfind(rest, '?') if i >= 0: rest, query = rest[:i], rest[i+1:] else: query = '' i = string.find(rest, '/') if i >= 0: script, rest = rest[:i], rest[i:] else: script, rest = rest, '' scriptname = dir + '/' + script scriptfile = self.translate_path(scriptname) if not os.path.exists(scriptfile): self.send_error(404, "No such CGI script (%s)" % `scriptname`) return if not os.path.isfile(scriptfile): self.send_error(403, "CGI script is not a plain file (%s)" % `scriptname`) return if not executable(scriptfile): self.send_error(403, "CGI script is not executable (%s)" % `scriptname`) return nobody = nobody_uid() self.send_response(200, "Script output follows") self.wfile.flush() # Always flush before forking pid = os.fork() if pid != 0: # Parent pid, sts = os.waitpid(pid, 0) if sts: self.log_error("CGI script exit status x%x" % sts) return # Child try: # Reference: http://hoohoo.ncsa.uiuc.edu/cgi/env.html # XXX Much of the following could be prepared ahead of time! env = {} env['SERVER_SOFTWARE'] = self.version_string() env['SERVER_NAME'] = self.server.server_name env['GATEWAY_INTERFACE'] = 'CGI/1.1' env['SERVER_PROTOCOL'] = self.protocol_version env['SERVER_PORT'] = str(self.server.server_port) env['REQUEST_METHOD'] = self.command uqrest = urllib.unquote(rest) env['PATH_INFO'] = uqrest env['PATH_TRANSLATED'] = self.translate_path(uqrest) env['SCRIPT_NAME'] = scriptname if query: env['QUERY_STRING'] = query host = self.address_string() if host != self.client_address[0]: env['REMOTE_HOST'] = host env['REMOTE_ADDR'] = self.client_address[0] # AUTH_TYPE # REMOTE_USER # REMOTE_IDENT if self.headers.typeheader is None: env['CONTENT_TYPE'] = self.headers.type else: env['CONTENT_TYPE'] = self.headers.typeheader length = self.headers.getheader('content-length') if length: env['CONTENT_LENGTH'] = length accept = [] for line in self.headers.getallmatchingheaders('accept'): if line[:1] in string.whitespace: accept.append(string.strip(line)) else: accept = accept + string.split(line[7:], ',') env['HTTP_ACCEPT'] = string.joinfields(accept, ',') ua = self.headers.getheader('user-agent') if ua: env['HTTP_USER_AGENT'] = ua co = filter(None, self.headers.getheaders('cookie')) if co: env['HTTP_COOKIE'] = string.join(co, ', ') # XXX Other HTTP_* headers decoded_query = string.replace(query, '+', ' ') try: os.setuid(nobody) except os.error: pass os.dup2(self.rfile.fileno(), 0) os.dup2(self.wfile.fileno(), 1) print scriptfile, script, decoded_query os.execve(scriptfile, [script, decoded_query], env) except: self.server.handle_error(self.request, self.client_address) os._exit(127)
|
e7d6b0a22e07adfa33cfa8658acf4c0b3cbecb39 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e7d6b0a22e07adfa33cfa8658acf4c0b3cbecb39/CGIHTTPServer.py
|
self.log_error("CGI script exit status x%x" % sts) return try: env = {} env['SERVER_SOFTWARE'] = self.version_string() env['SERVER_NAME'] = self.server.server_name env['GATEWAY_INTERFACE'] = 'CGI/1.1' env['SERVER_PROTOCOL'] = self.protocol_version env['SERVER_PORT'] = str(self.server.server_port) env['REQUEST_METHOD'] = self.command uqrest = urllib.unquote(rest) env['PATH_INFO'] = uqrest env['PATH_TRANSLATED'] = self.translate_path(uqrest) env['SCRIPT_NAME'] = scriptname if query: env['QUERY_STRING'] = query host = self.address_string() if host != self.client_address[0]: env['REMOTE_HOST'] = host env['REMOTE_ADDR'] = self.client_address[0] if self.headers.typeheader is None: env['CONTENT_TYPE'] = self.headers.type
|
self.log_error("CGI script exit status %
|
def run_cgi(self): """Execute a CGI script.""" dir, rest = self.cgi_info i = string.rfind(rest, '?') if i >= 0: rest, query = rest[:i], rest[i+1:] else: query = '' i = string.find(rest, '/') if i >= 0: script, rest = rest[:i], rest[i:] else: script, rest = rest, '' scriptname = dir + '/' + script scriptfile = self.translate_path(scriptname) if not os.path.exists(scriptfile): self.send_error(404, "No such CGI script (%s)" % `scriptname`) return if not os.path.isfile(scriptfile): self.send_error(403, "CGI script is not a plain file (%s)" % `scriptname`) return if not executable(scriptfile): self.send_error(403, "CGI script is not executable (%s)" % `scriptname`) return nobody = nobody_uid() self.send_response(200, "Script output follows") self.wfile.flush() # Always flush before forking pid = os.fork() if pid != 0: # Parent pid, sts = os.waitpid(pid, 0) if sts: self.log_error("CGI script exit status x%x" % sts) return # Child try: # Reference: http://hoohoo.ncsa.uiuc.edu/cgi/env.html # XXX Much of the following could be prepared ahead of time! env = {} env['SERVER_SOFTWARE'] = self.version_string() env['SERVER_NAME'] = self.server.server_name env['GATEWAY_INTERFACE'] = 'CGI/1.1' env['SERVER_PROTOCOL'] = self.protocol_version env['SERVER_PORT'] = str(self.server.server_port) env['REQUEST_METHOD'] = self.command uqrest = urllib.unquote(rest) env['PATH_INFO'] = uqrest env['PATH_TRANSLATED'] = self.translate_path(uqrest) env['SCRIPT_NAME'] = scriptname if query: env['QUERY_STRING'] = query host = self.address_string() if host != self.client_address[0]: env['REMOTE_HOST'] = host env['REMOTE_ADDR'] = self.client_address[0] # AUTH_TYPE # REMOTE_USER # REMOTE_IDENT if self.headers.typeheader is None: env['CONTENT_TYPE'] = self.headers.type else: env['CONTENT_TYPE'] = self.headers.typeheader length = self.headers.getheader('content-length') if length: env['CONTENT_LENGTH'] = length accept = [] for line in self.headers.getallmatchingheaders('accept'): if line[:1] in string.whitespace: accept.append(string.strip(line)) else: accept = accept + string.split(line[7:], ',') env['HTTP_ACCEPT'] = string.joinfields(accept, ',') ua = self.headers.getheader('user-agent') if ua: env['HTTP_USER_AGENT'] = ua co = filter(None, self.headers.getheaders('cookie')) if co: env['HTTP_COOKIE'] = string.join(co, ', ') # XXX Other HTTP_* headers decoded_query = string.replace(query, '+', ' ') try: os.setuid(nobody) except os.error: pass os.dup2(self.rfile.fileno(), 0) os.dup2(self.wfile.fileno(), 1) print scriptfile, script, decoded_query os.execve(scriptfile, [script, decoded_query], env) except: self.server.handle_error(self.request, self.client_address) os._exit(127)
|
e7d6b0a22e07adfa33cfa8658acf4c0b3cbecb39 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e7d6b0a22e07adfa33cfa8658acf4c0b3cbecb39/CGIHTTPServer.py
|
env['CONTENT_TYPE'] = self.headers.typeheader length = self.headers.getheader('content-length') if length: env['CONTENT_LENGTH'] = length accept = [] for line in self.headers.getallmatchingheaders('accept'): if line[:1] in string.whitespace: accept.append(string.strip(line)) else: accept = accept + string.split(line[7:], ',') env['HTTP_ACCEPT'] = string.joinfields(accept, ',') ua = self.headers.getheader('user-agent') if ua: env['HTTP_USER_AGENT'] = ua co = filter(None, self.headers.getheaders('cookie')) if co: env['HTTP_COOKIE'] = string.join(co, ', ') decoded_query = string.replace(query, '+', ' ')
|
self.log_error("CGI script exited OK") else: os.environ.update(env) save_argv = sys.argv save_stdin = sys.stdin save_stdout = sys.stdout save_stderr = sys.stderr
|
def run_cgi(self): """Execute a CGI script.""" dir, rest = self.cgi_info i = string.rfind(rest, '?') if i >= 0: rest, query = rest[:i], rest[i+1:] else: query = '' i = string.find(rest, '/') if i >= 0: script, rest = rest[:i], rest[i:] else: script, rest = rest, '' scriptname = dir + '/' + script scriptfile = self.translate_path(scriptname) if not os.path.exists(scriptfile): self.send_error(404, "No such CGI script (%s)" % `scriptname`) return if not os.path.isfile(scriptfile): self.send_error(403, "CGI script is not a plain file (%s)" % `scriptname`) return if not executable(scriptfile): self.send_error(403, "CGI script is not executable (%s)" % `scriptname`) return nobody = nobody_uid() self.send_response(200, "Script output follows") self.wfile.flush() # Always flush before forking pid = os.fork() if pid != 0: # Parent pid, sts = os.waitpid(pid, 0) if sts: self.log_error("CGI script exit status x%x" % sts) return # Child try: # Reference: http://hoohoo.ncsa.uiuc.edu/cgi/env.html # XXX Much of the following could be prepared ahead of time! env = {} env['SERVER_SOFTWARE'] = self.version_string() env['SERVER_NAME'] = self.server.server_name env['GATEWAY_INTERFACE'] = 'CGI/1.1' env['SERVER_PROTOCOL'] = self.protocol_version env['SERVER_PORT'] = str(self.server.server_port) env['REQUEST_METHOD'] = self.command uqrest = urllib.unquote(rest) env['PATH_INFO'] = uqrest env['PATH_TRANSLATED'] = self.translate_path(uqrest) env['SCRIPT_NAME'] = scriptname if query: env['QUERY_STRING'] = query host = self.address_string() if host != self.client_address[0]: env['REMOTE_HOST'] = host env['REMOTE_ADDR'] = self.client_address[0] # AUTH_TYPE # REMOTE_USER # REMOTE_IDENT if self.headers.typeheader is None: env['CONTENT_TYPE'] = self.headers.type else: env['CONTENT_TYPE'] = self.headers.typeheader length = self.headers.getheader('content-length') if length: env['CONTENT_LENGTH'] = length accept = [] for line in self.headers.getallmatchingheaders('accept'): if line[:1] in string.whitespace: accept.append(string.strip(line)) else: accept = accept + string.split(line[7:], ',') env['HTTP_ACCEPT'] = string.joinfields(accept, ',') ua = self.headers.getheader('user-agent') if ua: env['HTTP_USER_AGENT'] = ua co = filter(None, self.headers.getheaders('cookie')) if co: env['HTTP_COOKIE'] = string.join(co, ', ') # XXX Other HTTP_* headers decoded_query = string.replace(query, '+', ' ') try: os.setuid(nobody) except os.error: pass os.dup2(self.rfile.fileno(), 0) os.dup2(self.wfile.fileno(), 1) print scriptfile, script, decoded_query os.execve(scriptfile, [script, decoded_query], env) except: self.server.handle_error(self.request, self.client_address) os._exit(127)
|
e7d6b0a22e07adfa33cfa8658acf4c0b3cbecb39 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e7d6b0a22e07adfa33cfa8658acf4c0b3cbecb39/CGIHTTPServer.py
|
os.setuid(nobody) except os.error: pass os.dup2(self.rfile.fileno(), 0) os.dup2(self.wfile.fileno(), 1) print scriptfile, script, decoded_query os.execve(scriptfile, [script, decoded_query], env) except: self.server.handle_error(self.request, self.client_address) os._exit(127)
|
try: sys.argv = [scriptfile] if '=' not in decoded_query: sys.argv.append(decoded_query) sys.stdout = self.wfile sys.stdin = self.rfile execfile(scriptfile, {"__name__": "__main__"}) finally: sys.argv = save_argv sys.stdin = save_stdin sys.stdout = save_stdout sys.stderr = save_stderr except SystemExit, sts: self.log_error("CGI script exit status %s", str(sts)) else: self.log_error("CGI script exited OK")
|
def run_cgi(self): """Execute a CGI script.""" dir, rest = self.cgi_info i = string.rfind(rest, '?') if i >= 0: rest, query = rest[:i], rest[i+1:] else: query = '' i = string.find(rest, '/') if i >= 0: script, rest = rest[:i], rest[i:] else: script, rest = rest, '' scriptname = dir + '/' + script scriptfile = self.translate_path(scriptname) if not os.path.exists(scriptfile): self.send_error(404, "No such CGI script (%s)" % `scriptname`) return if not os.path.isfile(scriptfile): self.send_error(403, "CGI script is not a plain file (%s)" % `scriptname`) return if not executable(scriptfile): self.send_error(403, "CGI script is not executable (%s)" % `scriptname`) return nobody = nobody_uid() self.send_response(200, "Script output follows") self.wfile.flush() # Always flush before forking pid = os.fork() if pid != 0: # Parent pid, sts = os.waitpid(pid, 0) if sts: self.log_error("CGI script exit status x%x" % sts) return # Child try: # Reference: http://hoohoo.ncsa.uiuc.edu/cgi/env.html # XXX Much of the following could be prepared ahead of time! env = {} env['SERVER_SOFTWARE'] = self.version_string() env['SERVER_NAME'] = self.server.server_name env['GATEWAY_INTERFACE'] = 'CGI/1.1' env['SERVER_PROTOCOL'] = self.protocol_version env['SERVER_PORT'] = str(self.server.server_port) env['REQUEST_METHOD'] = self.command uqrest = urllib.unquote(rest) env['PATH_INFO'] = uqrest env['PATH_TRANSLATED'] = self.translate_path(uqrest) env['SCRIPT_NAME'] = scriptname if query: env['QUERY_STRING'] = query host = self.address_string() if host != self.client_address[0]: env['REMOTE_HOST'] = host env['REMOTE_ADDR'] = self.client_address[0] # AUTH_TYPE # REMOTE_USER # REMOTE_IDENT if self.headers.typeheader is None: env['CONTENT_TYPE'] = self.headers.type else: env['CONTENT_TYPE'] = self.headers.typeheader length = self.headers.getheader('content-length') if length: env['CONTENT_LENGTH'] = length accept = [] for line in self.headers.getallmatchingheaders('accept'): if line[:1] in string.whitespace: accept.append(string.strip(line)) else: accept = accept + string.split(line[7:], ',') env['HTTP_ACCEPT'] = string.joinfields(accept, ',') ua = self.headers.getheader('user-agent') if ua: env['HTTP_USER_AGENT'] = ua co = filter(None, self.headers.getheaders('cookie')) if co: env['HTTP_COOKIE'] = string.join(co, ', ') # XXX Other HTTP_* headers decoded_query = string.replace(query, '+', ' ') try: os.setuid(nobody) except os.error: pass os.dup2(self.rfile.fileno(), 0) os.dup2(self.wfile.fileno(), 1) print scriptfile, script, decoded_query os.execve(scriptfile, [script, decoded_query], env) except: self.server.handle_error(self.request, self.client_address) os._exit(127)
|
e7d6b0a22e07adfa33cfa8658acf4c0b3cbecb39 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e7d6b0a22e07adfa33cfa8658acf4c0b3cbecb39/CGIHTTPServer.py
|
import pwd
|
try: import pwd except ImportError: return -1
|
def nobody_uid(): """Internal routine to get nobody's uid""" global nobody if nobody: return nobody import pwd try: nobody = pwd.getpwnam('nobody')[2] except KeyError: nobody = 1 + max(map(lambda x: x[2], pwd.getpwall())) return nobody
|
e7d6b0a22e07adfa33cfa8658acf4c0b3cbecb39 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e7d6b0a22e07adfa33cfa8658acf4c0b3cbecb39/CGIHTTPServer.py
|
except:
|
except AttributeError:
|
def close(self): self.sync() try: self.dict.close() except: pass self.dict = 0
|
68dcd34c0a71d3b2a792d6b69a096de49de7cfd2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/68dcd34c0a71d3b2a792d6b69a096de49de7cfd2/shelve.py
|
if e.errno == errno.EAGAIN:
|
if e.errno in (errno.EAGAIN, errno.EACCES):
|
def _lock_file(f, dotlock=True): """Lock file f using lockf and dot locking.""" dotlock_done = False try: if fcntl: try: fcntl.lockf(f, fcntl.LOCK_EX | fcntl.LOCK_NB) except IOError, e: if e.errno == errno.EAGAIN: raise ExternalClashError('lockf: lock unavailable: %s' % f.name) else: raise if dotlock: try: pre_lock = _create_temporary(f.name + '.lock') pre_lock.close() except IOError, e: if e.errno == errno.EACCES: return # Without write access, just skip dotlocking. else: raise try: if hasattr(os, 'link'): os.link(pre_lock.name, f.name + '.lock') dotlock_done = True os.unlink(pre_lock.name) else: os.rename(pre_lock.name, f.name + '.lock') dotlock_done = True except OSError, e: if e.errno == errno.EEXIST: os.remove(pre_lock.name) raise ExternalClashError('dot lock unavailable: %s' % f.name) else: raise except: if fcntl: fcntl.lockf(f, fcntl.LOCK_UN) if dotlock_done: os.remove(f.name + '.lock') raise
|
7983c7298d2c1254bc17a5a1ab696bdf0360b63d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7983c7298d2c1254bc17a5a1ab696bdf0360b63d/mailbox.py
|
e.num = getint(b)
|
e.num = getint_event(b)
|
def _substitute(self, *args): """Internal function.""" if len(args) != len(self._subst_format): return args getboolean = self.tk.getboolean getint = int nsign, b, f, h, k, s, t, w, x, y, A, E, K, N, W, T, X, Y, D = args # Missing: (a, c, d, m, o, v, B, R) e = Event() e.serial = getint(nsign) e.num = getint(b) try: e.focus = getboolean(f) except TclError: pass e.height = getint(h) e.keycode = getint(k) # For Visibility events, event state is a string and # not an integer: try: e.state = getint(s) except ValueError: e.state = s e.time = getint(t) e.width = getint(w) e.x = getint(x) e.y = getint(y) e.char = A try: e.send_event = getboolean(E) except TclError: pass e.keysym = K e.keysym_num = getint(N) e.type = T try: e.widget = self._nametowidget(W) except KeyError: e.widget = W e.x_root = getint(X) e.y_root = getint(Y) try: e.delta = getint(D) except ValueError: e.delta = 0 return (e,)
|
043bbc7da387f613f3ce60c20063e2a29baff372 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/043bbc7da387f613f3ce60c20063e2a29baff372/Tkinter.py
|
e.height = getint(h) e.keycode = getint(k) try: e.state = getint(s) except ValueError: e.state = s e.time = getint(t) e.width = getint(w) e.x = getint(x) e.y = getint(y)
|
e.height = getint_event(h) e.keycode = getint_event(k) e.state = getint_event(s) e.time = getint_event(t) e.width = getint_event(w) e.x = getint_event(x) e.y = getint_event(y)
|
def _substitute(self, *args): """Internal function.""" if len(args) != len(self._subst_format): return args getboolean = self.tk.getboolean getint = int nsign, b, f, h, k, s, t, w, x, y, A, E, K, N, W, T, X, Y, D = args # Missing: (a, c, d, m, o, v, B, R) e = Event() e.serial = getint(nsign) e.num = getint(b) try: e.focus = getboolean(f) except TclError: pass e.height = getint(h) e.keycode = getint(k) # For Visibility events, event state is a string and # not an integer: try: e.state = getint(s) except ValueError: e.state = s e.time = getint(t) e.width = getint(w) e.x = getint(x) e.y = getint(y) e.char = A try: e.send_event = getboolean(E) except TclError: pass e.keysym = K e.keysym_num = getint(N) e.type = T try: e.widget = self._nametowidget(W) except KeyError: e.widget = W e.x_root = getint(X) e.y_root = getint(Y) try: e.delta = getint(D) except ValueError: e.delta = 0 return (e,)
|
043bbc7da387f613f3ce60c20063e2a29baff372 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/043bbc7da387f613f3ce60c20063e2a29baff372/Tkinter.py
|
e.keysym_num = getint(N)
|
e.keysym_num = getint_event(N)
|
def _substitute(self, *args): """Internal function.""" if len(args) != len(self._subst_format): return args getboolean = self.tk.getboolean getint = int nsign, b, f, h, k, s, t, w, x, y, A, E, K, N, W, T, X, Y, D = args # Missing: (a, c, d, m, o, v, B, R) e = Event() e.serial = getint(nsign) e.num = getint(b) try: e.focus = getboolean(f) except TclError: pass e.height = getint(h) e.keycode = getint(k) # For Visibility events, event state is a string and # not an integer: try: e.state = getint(s) except ValueError: e.state = s e.time = getint(t) e.width = getint(w) e.x = getint(x) e.y = getint(y) e.char = A try: e.send_event = getboolean(E) except TclError: pass e.keysym = K e.keysym_num = getint(N) e.type = T try: e.widget = self._nametowidget(W) except KeyError: e.widget = W e.x_root = getint(X) e.y_root = getint(Y) try: e.delta = getint(D) except ValueError: e.delta = 0 return (e,)
|
043bbc7da387f613f3ce60c20063e2a29baff372 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/043bbc7da387f613f3ce60c20063e2a29baff372/Tkinter.py
|
e.x_root = getint(X) e.y_root = getint(Y)
|
e.x_root = getint_event(X) e.y_root = getint_event(Y)
|
def _substitute(self, *args): """Internal function.""" if len(args) != len(self._subst_format): return args getboolean = self.tk.getboolean getint = int nsign, b, f, h, k, s, t, w, x, y, A, E, K, N, W, T, X, Y, D = args # Missing: (a, c, d, m, o, v, B, R) e = Event() e.serial = getint(nsign) e.num = getint(b) try: e.focus = getboolean(f) except TclError: pass e.height = getint(h) e.keycode = getint(k) # For Visibility events, event state is a string and # not an integer: try: e.state = getint(s) except ValueError: e.state = s e.time = getint(t) e.width = getint(w) e.x = getint(x) e.y = getint(y) e.char = A try: e.send_event = getboolean(E) except TclError: pass e.keysym = K e.keysym_num = getint(N) e.type = T try: e.widget = self._nametowidget(W) except KeyError: e.widget = W e.x_root = getint(X) e.y_root = getint(Y) try: e.delta = getint(D) except ValueError: e.delta = 0 return (e,)
|
043bbc7da387f613f3ce60c20063e2a29baff372 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/043bbc7da387f613f3ce60c20063e2a29baff372/Tkinter.py
|
return browser
|
return GenericBrowser(browser)
|
def get(using=None): """Return a browser launcher instance appropriate for the environment.""" if using: alternatives = [using] else: alternatives = _tryorder for browser in alternatives: if browser.find('%s') > -1: # User gave us a command line, don't mess with it. return browser else: # User gave us a browser name. command = _browsers[browser.lower()] if command[1] is None: return command[0]() else: return command[1] raise Error("could not locate runnable browser")
|
f7eb4faf38fc9e4a215acae3323140b99cdce08f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f7eb4faf38fc9e4a215acae3323140b99cdce08f/webbrowser.py
|
... def f():
|
... def _f():
|
... def f():
|
4a9ac4a83c5515df1b62e396a753ac17a931f997 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4a9ac4a83c5515df1b62e396a753ac17a931f997/doctest.py
|
>>> d = {"_f": m1.f, "g": m1.g, "h": m1.H, ... "f2": m2.f, "g2": m2.g, "h2": m2.H}
|
... def bar(self):
|
4a9ac4a83c5515df1b62e396a753ac17a931f997 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4a9ac4a83c5515df1b62e396a753ac17a931f997/doctest.py
|
|
>>> t.rundict(d, "rundict_test", m1)
|
>>> t.rundict(m1.__dict__, "rundict_test", m1)
|
... def bar(self):
|
4a9ac4a83c5515df1b62e396a753ac17a931f997 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4a9ac4a83c5515df1b62e396a753ac17a931f997/doctest.py
|
>>> t.rundict(d, "rundict_test_pvt", m1)
|
>>> t.rundict(m1.__dict__, "rundict_test_pvt", m1)
|
... def bar(self):
|
4a9ac4a83c5515df1b62e396a753ac17a931f997 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4a9ac4a83c5515df1b62e396a753ac17a931f997/doctest.py
|
>>> t.rundict(d, "rundict_test_pvt")
|
>>> t.rundict(m1.__dict__, "rundict_test_pvt")
|
... def bar(self):
|
4a9ac4a83c5515df1b62e396a753ac17a931f997 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4a9ac4a83c5515df1b62e396a753ac17a931f997/doctest.py
|
f, t = tester.rundict(m.__dict__, name)
|
f, t = tester.rundict(m.__dict__, name, m)
|
def testmod(m, name=None, globs=None, verbose=None, isprivate=None, report=1): """m, name=None, globs=None, verbose=None, isprivate=None, report=1 Test examples in docstrings in functions and classes reachable from module m, starting with m.__doc__. Private names are skipped. Also test examples reachable from dict m.__test__ if it exists and is not None. m.__dict__ maps names to functions, classes and strings; function and class docstrings are tested even if the name is private; strings are tested directly, as if they were docstrings. Return (#failures, #tests). See doctest.__doc__ for an overview. Optional keyword arg "name" gives the name of the module; by default use m.__name__. Optional keyword arg "globs" gives a dict to be used as the globals when executing examples; by default, use m.__dict__. A copy of this dict is actually used for each docstring, so that each docstring's examples start with a clean slate. Optional keyword arg "verbose" prints lots of stuff if true, prints only failures if false; by default, it's true iff "-v" is in sys.argv. Optional keyword arg "isprivate" specifies a function used to determine whether a name is private. The default function is doctest.is_private; see its docs for details. Optional keyword arg "report" prints a summary at the end when true, else prints nothing at the end. In verbose mode, the summary is detailed, else very brief (in fact, empty if all tests passed). Advanced tomfoolery: testmod runs methods of a local instance of class doctest.Tester, then merges the results into (or creates) global Tester instance doctest.master. Methods of doctest.master can be called directly too, if you want to do something unusual. Passing report=0 to testmod is especially useful then, to delay displaying a summary. Invoke doctest.master.summarize(verbose) when you're done fiddling. """ global master if not _ismodule(m): raise TypeError("testmod: module required; " + `m`) if name is None: name = m.__name__ tester = Tester(m, globs=globs, verbose=verbose, isprivate=isprivate) failures, tries = tester.rundoc(m, name) f, t = tester.rundict(m.__dict__, name) failures = failures + f tries = tries + t if hasattr(m, "__test__"): testdict = m.__test__ if testdict: if not hasattr(testdict, "items"): raise TypeError("testmod: module.__test__ must support " ".items(); " + `testdict`) f, t = tester.run__test__(testdict, name + ".__test__") failures = failures + f tries = tries + t if report: tester.summarize() if master is None: master = tester else: master.merge(tester) return failures, tries
|
4a9ac4a83c5515df1b62e396a753ac17a931f997 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4a9ac4a83c5515df1b62e396a753ac17a931f997/doctest.py
|
elif ord(c) < 32 or c in ' "*+,:;<=>?[]|':
|
elif ord(c) < 32 or c in ' ",:;<=>':
|
def normcase(s): res, s = splitdrive(s) for c in s: if c in '/\\': res = res + os.sep elif c == '.' and res[-1:] == os.sep: res = res + mapchar + c elif ord(c) < 32 or c in ' "*+,:;<=>?[]|': if res[-1:] != mapchar: res = res + mapchar else: res = res + c return string.lower(res)
|
f3b4903a9f24ba2a9af3f26b8f402ef7bce52a2f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f3b4903a9f24ba2a9af3f26b8f402ef7bce52a2f/dospath.py
|
>>> max(tupleids) - min(tupleids)
|
>>> int(max(tupleids) - min(tupleids))
|
>>> def f(n):
|
88459359b160741c7abcad38a97db65004430125 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/88459359b160741c7abcad38a97db65004430125/test_genexps.py
|
def hexrepr(t):
|
def hexrepr(t, precision=4):
|
def hexrepr(t): if t is None: return 'None' try: len(t) except: return '0x%04x' % t try: return '(' + ', '.join(map(lambda t: '0x%04x' % t, t)) + ')' except TypeError, why: print '* failed to convert %r: %s' % (t, why) raise
|
bd20ea55bc7a044a773e6824f7fcef4f5669d44c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/bd20ea55bc7a044a773e6824f7fcef4f5669d44c/gencodec.py
|
return '0x%04x' % t
|
return '0x%0*X' % (precision, t)
|
def hexrepr(t): if t is None: return 'None' try: len(t) except: return '0x%04x' % t try: return '(' + ', '.join(map(lambda t: '0x%04x' % t, t)) + ')' except TypeError, why: print '* failed to convert %r: %s' % (t, why) raise
|
bd20ea55bc7a044a773e6824f7fcef4f5669d44c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/bd20ea55bc7a044a773e6824f7fcef4f5669d44c/gencodec.py
|
return '(' + ', '.join(map(lambda t: '0x%04x' % t, t)) + ')'
|
return '(' + ', '.join(['0x%0*X' % (precision, item) for item in t]) + ')'
|
def hexrepr(t): if t is None: return 'None' try: len(t) except: return '0x%04x' % t try: return '(' + ', '.join(map(lambda t: '0x%04x' % t, t)) + ')' except TypeError, why: print '* failed to convert %r: %s' % (t, why) raise
|
bd20ea55bc7a044a773e6824f7fcef4f5669d44c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/bd20ea55bc7a044a773e6824f7fcef4f5669d44c/gencodec.py
|
def python_mapdef_code(varname, map, comments=1):
|
def python_mapdef_code(varname, map, comments=1, precisions=(2, 4)):
|
def python_mapdef_code(varname, map, comments=1): l = [] append = l.append if map.has_key("IDENTITY"): append("%s = codecs.make_identity_dict(range(%d))" % (varname, map["IDENTITY"])) append("%s.update({" % varname) splits = 1 del map["IDENTITY"] identity = 1 else: append("%s = {" % varname) splits = 0 identity = 0 mappings = map.items() mappings.sort() i = 0 for mapkey, mapvalue in mappings: mapcomment = '' if isinstance(mapkey, tuple): (mapkey, mapcomment) = mapkey if isinstance(mapvalue, tuple): (mapvalue, mapcomment) = mapvalue if mapkey is None: continue if (identity and mapkey == mapvalue and mapkey < 256): # No need to include identity mappings, since these # are already set for the first 256 code points. continue key = hexrepr(mapkey) value = hexrepr(mapvalue) if mapcomment and comments: append(' %s: %s,\t# %s' % (key, value, mapcomment)) else: append(' %s: %s,' % (key, value)) i += 1 if i == 4096: # Split the definition into parts to that the Python # parser doesn't dump core if splits == 0: append('}') else: append('})') append('%s.update({' % varname) i = 0 splits = splits + 1 if splits == 0: append('}') else: append('})') return l
|
bd20ea55bc7a044a773e6824f7fcef4f5669d44c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/bd20ea55bc7a044a773e6824f7fcef4f5669d44c/gencodec.py
|
key = hexrepr(mapkey) value = hexrepr(mapvalue)
|
key = hexrepr(mapkey, key_precision) value = hexrepr(mapvalue, value_precision)
|
def python_mapdef_code(varname, map, comments=1): l = [] append = l.append if map.has_key("IDENTITY"): append("%s = codecs.make_identity_dict(range(%d))" % (varname, map["IDENTITY"])) append("%s.update({" % varname) splits = 1 del map["IDENTITY"] identity = 1 else: append("%s = {" % varname) splits = 0 identity = 0 mappings = map.items() mappings.sort() i = 0 for mapkey, mapvalue in mappings: mapcomment = '' if isinstance(mapkey, tuple): (mapkey, mapcomment) = mapkey if isinstance(mapvalue, tuple): (mapvalue, mapcomment) = mapvalue if mapkey is None: continue if (identity and mapkey == mapvalue and mapkey < 256): # No need to include identity mappings, since these # are already set for the first 256 code points. continue key = hexrepr(mapkey) value = hexrepr(mapvalue) if mapcomment and comments: append(' %s: %s,\t# %s' % (key, value, mapcomment)) else: append(' %s: %s,' % (key, value)) i += 1 if i == 4096: # Split the definition into parts to that the Python # parser doesn't dump core if splits == 0: append('}') else: append('})') append('%s.update({' % varname) i = 0 splits = splits + 1 if splits == 0: append('}') else: append('})') return l
|
bd20ea55bc7a044a773e6824f7fcef4f5669d44c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/bd20ea55bc7a044a773e6824f7fcef4f5669d44c/gencodec.py
|
def python_tabledef_code(varname, map, comments=1):
|
def python_tabledef_code(varname, map, comments=1, key_precision=2):
|
def python_tabledef_code(varname, map, comments=1): l = [] append = l.append append('%s = (' % varname) # Analyze map and create table dict mappings = map.items() mappings.sort() table = {} maxkey = 0 if map.has_key('IDENTITY'): for key in range(256): table[key] = (key, '') maxkey = 255 del map['IDENTITY'] for mapkey, mapvalue in mappings: mapcomment = '' if isinstance(mapkey, tuple): (mapkey, mapcomment) = mapkey if isinstance(mapvalue, tuple): (mapvalue, mapcomment) = mapvalue if mapkey is None: continue table[mapkey] = (mapvalue, mapcomment) if mapkey > maxkey: maxkey = mapkey if maxkey > MAX_TABLE_SIZE: # Table too large return None # Create table code for key in range(maxkey + 1): if key not in table: mapvalue = None mapcomment = 'UNDEFINED' else: mapvalue, mapcomment = table[key] if mapvalue is None: mapchar = UNI_UNDEFINED else: if isinstance(mapvalue, tuple): # 1-n mappings not supported return None else: mapchar = unichr(mapvalue) if mapcomment and comments: append(' %r\t# %s -> %s' % (mapchar, hexrepr(key), mapcomment)) else: append(' %r' % mapchar) append(')') return l
|
bd20ea55bc7a044a773e6824f7fcef4f5669d44c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/bd20ea55bc7a044a773e6824f7fcef4f5669d44c/gencodec.py
|
hexrepr(key),
|
hexrepr(key, key_precision),
|
def python_tabledef_code(varname, map, comments=1): l = [] append = l.append append('%s = (' % varname) # Analyze map and create table dict mappings = map.items() mappings.sort() table = {} maxkey = 0 if map.has_key('IDENTITY'): for key in range(256): table[key] = (key, '') maxkey = 255 del map['IDENTITY'] for mapkey, mapvalue in mappings: mapcomment = '' if isinstance(mapkey, tuple): (mapkey, mapcomment) = mapkey if isinstance(mapvalue, tuple): (mapvalue, mapcomment) = mapvalue if mapkey is None: continue table[mapkey] = (mapvalue, mapcomment) if mapkey > maxkey: maxkey = mapkey if maxkey > MAX_TABLE_SIZE: # Table too large return None # Create table code for key in range(maxkey + 1): if key not in table: mapvalue = None mapcomment = 'UNDEFINED' else: mapvalue, mapcomment = table[key] if mapvalue is None: mapchar = UNI_UNDEFINED else: if isinstance(mapvalue, tuple): # 1-n mappings not supported return None else: mapchar = unichr(mapvalue) if mapcomment and comments: append(' %r\t# %s -> %s' % (mapchar, hexrepr(key), mapcomment)) else: append(' %r' % mapchar) append(')') return l
|
bd20ea55bc7a044a773e6824f7fcef4f5669d44c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/bd20ea55bc7a044a773e6824f7fcef4f5669d44c/gencodec.py
|
comments=comments)
|
comments=comments, precisions=(4, 2))
|
def codegen(name, map, comments=1): """ Returns Python source for the given map. Comments are included in the source, if comments is true (default). """ # Generate code decoding_map_code = python_mapdef_code( 'decoding_map', map, comments=comments) decoding_table_code = python_tabledef_code( 'decoding_table', map, comments=comments) encoding_map_code = python_mapdef_code( 'encoding_map', codecs.make_encoding_map(map), comments=comments) l = [ '''\
|
bd20ea55bc7a044a773e6824f7fcef4f5669d44c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/bd20ea55bc7a044a773e6824f7fcef4f5669d44c/gencodec.py
|
''') if not decoding_table_code: l.append('''
|
def getregentry(): return (Codec().encode,Codec().decode,StreamReader,StreamWriter)
|
bd20ea55bc7a044a773e6824f7fcef4f5669d44c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/bd20ea55bc7a044a773e6824f7fcef4f5669d44c/gencodec.py
|
|
l.extend(decoding_map_code) if decoding_table_code:
|
l.extend(decoding_map_code) else:
|
def getregentry(): return (Codec().encode,Codec().decode,StreamReader,StreamWriter)
|
bd20ea55bc7a044a773e6824f7fcef4f5669d44c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/bd20ea55bc7a044a773e6824f7fcef4f5669d44c/gencodec.py
|
self.openedurl = '%s:%s' % (type, url)
|
def open(self, fullurl, data=None): fullurl = unwrap(fullurl) if self.tempcache and self.tempcache.has_key(fullurl): filename, headers = self.tempcache[fullurl] fp = open(filename, 'rb') return addinfourl(fp, headers, fullurl) type, url = splittype(fullurl) if not type: type = 'file' self.openedurl = '%s:%s' % (type, url) if self.proxies.has_key(type): proxy = self.proxies[type] type, proxy = splittype(proxy) host, selector = splithost(proxy) url = (host, fullurl) # Signal special case to open_*() name = 'open_' + type if '-' in name: # replace - with _ name = string.join(string.split(name, '-'), '_') if not hasattr(self, name): if data is None: return self.open_unknown(fullurl) else: return self.open_unknown(fullurl, data) try: if data is None: return getattr(self, name)(url) else: return getattr(self, name)(url, data) except socket.error, msg: raise IOError, ('socket error', msg), sys.exc_info()[2]
|
8a666e7c56192f42288a30a53adf5299fda29557 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8a666e7c56192f42288a30a53adf5299fda29557/urllib.py
|
|
self.openedurl = url
|
def retrieve(self, url, filename=None): url = unwrap(url) self.openedurl = url if self.tempcache and self.tempcache.has_key(url): return self.tempcache[url] type, url1 = splittype(url) if not filename and (not type or type == 'file'): try: fp = self.open_local_file(url1) del fp return url2pathname(splithost(url1)[1]), None except IOError, msg: pass fp = self.open(url) headers = fp.info() if not filename: import tempfile filename = tempfile.mktemp() self.__tempfiles.append(filename) result = filename, headers if self.tempcache is not None: self.tempcache[url] = result tfp = open(filename, 'wb') bs = 1024*8 block = fp.read(bs) while block: tfp.write(block) block = fp.read(bs) fp.close() tfp.close() del fp del tfp return result
|
8a666e7c56192f42288a30a53adf5299fda29557 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8a666e7c56192f42288a30a53adf5299fda29557/urllib.py
|
|
return addinfourl(fp, headers, self.openedurl)
|
return addinfourl(fp, headers, "http:" + url)
|
def open_http(self, url, data=None): import httplib if type(url) is type(""): host, selector = splithost(url) user_passwd, host = splituser(host) realhost = host else: host, selector = url urltype, rest = splittype(selector) user_passwd = None if string.lower(urltype) != 'http': realhost = None else: realhost, rest = splithost(rest) user_passwd, realhost = splituser(realhost) if user_passwd: selector = "%s://%s%s" % (urltype, realhost, rest) #print "proxy via http:", host, selector if not host: raise IOError, ('http error', 'no host given') if user_passwd: import base64 auth = string.strip(base64.encodestring(user_passwd)) else: auth = None h = httplib.HTTP(host) if data is not None: h.putrequest('POST', selector) h.putheader('Content-type', 'application/x-www-form-urlencoded') h.putheader('Content-length', '%d' % len(data)) else: h.putrequest('GET', selector) if auth: h.putheader('Authorization', 'Basic %s' % auth) if realhost: h.putheader('Host', realhost) for args in self.addheaders: apply(h.putheader, args) h.endheaders() if data is not None: h.send(data + '\r\n') errcode, errmsg, headers = h.getreply() fp = h.getfile() if errcode == 200: return addinfourl(fp, headers, self.openedurl) else: return self.http_error(url, fp, errcode, errmsg, headers)
|
8a666e7c56192f42288a30a53adf5299fda29557 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8a666e7c56192f42288a30a53adf5299fda29557/urllib.py
|
return addinfourl(fp, noheaders(), self.openedurl)
|
return addinfourl(fp, noheaders(), "gopher:" + url)
|
def open_gopher(self, url): import gopherlib host, selector = splithost(url) if not host: raise IOError, ('gopher error', 'no host given') type, selector = splitgophertype(selector) selector, query = splitquery(selector) selector = unquote(selector) if query: query = unquote(query) fp = gopherlib.send_query(selector, query, host) else: fp = gopherlib.send_selector(selector, host) return addinfourl(fp, noheaders(), self.openedurl)
|
8a666e7c56192f42288a30a53adf5299fda29557 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8a666e7c56192f42288a30a53adf5299fda29557/urllib.py
|
ftpwrapper(user, passwd, host, port, dirs)
|
ftpwrapper(user, passwd, host, port, dirs)
|
def open_ftp(self, url): host, path = splithost(url) if not host: raise IOError, ('ftp error', 'no host given') host, port = splitport(host) user, host = splituser(host) if user: user, passwd = splitpasswd(user) else: passwd = None host = socket.gethostbyname(host) if not port: import ftplib port = ftplib.FTP_PORT else: port = int(port) path, attrs = splitattr(path) dirs = string.splitfields(path, '/') dirs, file = dirs[:-1], dirs[-1] if dirs and not dirs[0]: dirs = dirs[1:] key = (user, host, port, string.joinfields(dirs, '/')) if len(self.ftpcache) > MAXFTPCACHE: # Prune the cache, rather arbitrarily for k in self.ftpcache.keys(): if k != key: v = self.ftpcache[k] del self.ftpcache[k] v.close() try: if not self.ftpcache.has_key(key): self.ftpcache[key] = \ ftpwrapper(user, passwd, host, port, dirs) if not file: type = 'D' else: type = 'I' for attr in attrs: attr, value = splitvalue(attr) if string.lower(attr) == 'type' and \ value in ('a', 'A', 'i', 'I', 'd', 'D'): type = string.upper(value) return addinfourl( self.ftpcache[key].retrfile(file, type), noheaders(), self.openedurl) except ftperrors(), msg: raise IOError, ('ftp error', msg), sys.exc_info()[2]
|
8a666e7c56192f42288a30a53adf5299fda29557 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8a666e7c56192f42288a30a53adf5299fda29557/urllib.py
|
noheaders(), self.openedurl)
|
noheaders(), "ftp:" + url)
|
def open_ftp(self, url): host, path = splithost(url) if not host: raise IOError, ('ftp error', 'no host given') host, port = splitport(host) user, host = splituser(host) if user: user, passwd = splitpasswd(user) else: passwd = None host = socket.gethostbyname(host) if not port: import ftplib port = ftplib.FTP_PORT else: port = int(port) path, attrs = splitattr(path) dirs = string.splitfields(path, '/') dirs, file = dirs[:-1], dirs[-1] if dirs and not dirs[0]: dirs = dirs[1:] key = (user, host, port, string.joinfields(dirs, '/')) if len(self.ftpcache) > MAXFTPCACHE: # Prune the cache, rather arbitrarily for k in self.ftpcache.keys(): if k != key: v = self.ftpcache[k] del self.ftpcache[k] v.close() try: if not self.ftpcache.has_key(key): self.ftpcache[key] = \ ftpwrapper(user, passwd, host, port, dirs) if not file: type = 'D' else: type = 'I' for attr in attrs: attr, value = splitvalue(attr) if string.lower(attr) == 'type' and \ value in ('a', 'A', 'i', 'I', 'd', 'D'): type = string.upper(value) return addinfourl( self.ftpcache[key].retrfile(file, type), noheaders(), self.openedurl) except ftperrors(), msg: raise IOError, ('ftp error', msg), sys.exc_info()[2]
|
8a666e7c56192f42288a30a53adf5299fda29557 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8a666e7c56192f42288a30a53adf5299fda29557/urllib.py
|
return addinfourl(fp, headers, self.openedurl)
|
return addinfourl(fp, headers, "http:" + url)
|
def http_error_default(self, url, fp, errcode, errmsg, headers): return addinfourl(fp, headers, self.openedurl)
|
8a666e7c56192f42288a30a53adf5299fda29557 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8a666e7c56192f42288a30a53adf5299fda29557/urllib.py
|
if (os.path.exists('Modules/_curses_panel.c') and module_enabled(exts, '_curses') and
|
if (module_enabled(exts, '_curses') and
|
def detect_modules(self): # Ensure that /usr/local is always used if '/usr/local/lib' not in self.compiler.library_dirs: self.compiler.library_dirs.insert(0, '/usr/local/lib') if '/usr/local/include' not in self.compiler.include_dirs: self.compiler.include_dirs.insert(0, '/usr/local/include' )
|
e7ffbb24e80800de3667a88af96d03f8c9717039 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e7ffbb24e80800de3667a88af96d03f8c9717039/setup.py
|
def getfileinfo(name):
|
def getfileinfo(name):
|
def FInfo():
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
fp = open(name, '*rb')
|
fp = openrf(name, '*rb')
|
def getfileinfo(name):
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
def openrsrc(name, *mode): if mode: mode = mode[0]
|
def openrsrc(name, *mode): if not mode: mode = '*rb'
|
def getfileinfo(name):
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
mode = 'rb' mode = '*' + mode return open(name, mode)
|
mode = '*' + mode[0] return openrf(name, mode)
|
def openrsrc(name, *mode):
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
import regsub class FInfo:
|
import regsub class FInfo:
|
def openrsrc(name, *mode):
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
self.Type = '????' self.Creator = '????' self.Flags = 0 def getfileinfo(name):
|
self.Type = '????' self.Creator = '????' self.Flags = 0 def getfileinfo(name):
|
def __init__(self): self.Type = '????' self.Creator = '????' self.Flags = 0
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
if not c in string.whitespace and (c<' ' or ord(c) > 0177): break
|
if not c in string.whitespace and (c<' ' or ord(c) > 0177): break
|
def getfileinfo(name):
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
finfo.Type = 'TEXT'
|
finfo.Type = 'TEXT'
|
def getfileinfo(name):
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
class openrsrc:
|
class openrsrc:
|
def getfileinfo(name):
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
pass
|
pass
|
def __init__(self, *args): pass
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
return ''
|
return ''
|
def read(self, *args): return ''
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
pass
|
pass
|
def close(self): pass
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
"""Write data to the coder in 3-byte chunks""" def __init__(self, ofp):
|
"""Write data to the coder in 3-byte chunks""" def __init__(self, ofp):
|
def close(self): pass
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
def write(self, data):
|
self.hqxdata = '' self.linelen = LINELEN-1 def write(self, data):
|
def __init__(self, ofp):
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
while len(self.data) > LINELEN: hqxdata = binascii.b2a_hqx(self.data[:LINELEN]) self.ofp.write(hqxdata+'\n') self.data = self.data[LINELEN:] def close(self):
|
datalen = len(self.data) todo = (datalen/3)*3 data = self.data[:todo] self.data = self.data[todo:] self.hqxdata = self.hqxdata + binascii.b2a_hqx(data) while len(self.hqxdata) > self.linelen: self.ofp.write(self.hqxdata[:self.linelen]+'\n') self.hqxdata = self.hqxdata[self.linelen:] self.linelen = LINELEN def close(self):
|
def write(self, data):
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
self.ofp.write(binascii.b2a_hqx(self.data))
|
self.hqxdata = self.hqxdata + binascii.b2a_hqx(self.data) while self.hqxdata: self.ofp.write(self.hqxdata[:self.linelen]) self.hqxdata = self.hqxdata[self.linelen:] self.linelen = LINELEN
|
def close(self):
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
"""Write data to the RLE-coder in suitably large chunks""" def __init__(self, ofp):
|
"""Write data to the RLE-coder in suitably large chunks""" def __init__(self, ofp):
|
def close(self):
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
def write(self, data): if DEBUG: testf.write(data)
|
def write(self, data):
|
def write(self, data):
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
return
|
return
|
def write(self, data):
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
def close(self):
|
def close(self):
|
def close(self):
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
rledata = binascii.rlecode_hqx(self.data) self.ofp.write(rledata)
|
rledata = binascii.rlecode_hqx(self.data) self.ofp.write(rledata)
|
def close(self):
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
def __init__(self, (name, finfo, dlen, rlen), ofp): if type(ofp) == type(''): ofname = ofp ofp = open(ofname, 'w') if os.name == 'mac': fss = macfs.FSSpec(ofname) fss.SetCreatorType('BnHq', 'TEXT') ofp.write('(This file may be decompressed with BinHex 4.0)\n\n:')
|
def __init__(self, (name, finfo, dlen, rlen), ofp): if type(ofp) == type(''): ofname = ofp ofp = open(ofname, 'w') if os.name == 'mac': fss = macfs.FSSpec(ofname) fss.SetCreatorType('BnHq', 'TEXT') ofp.write('(This file must be converted with BinHex 4.0)\n\n:')
|
def __init__(self, (name, finfo, dlen, rlen), ofp): if type(ofp) == type(''): ofname = ofp ofp = open(ofname, 'w') if os.name == 'mac': fss = macfs.FSSpec(ofname) fss.SetCreatorType('BnHq', 'TEXT')
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
finfo = FInfo()
|
finfo = FInfo()
|
def __init__(self, (name, finfo, dlen, rlen), ofp): if type(ofp) == type(''): ofname = ofp ofp = open(ofname, 'w') if os.name == 'mac': fss = macfs.FSSpec(ofname) fss.SetCreatorType('BnHq', 'TEXT')
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
def _writeinfo(self, name, finfo): if DEBUG: print 'binhex info:', name, finfo.Type, finfo.Creator, self.dlen, self.rlen
|
def _writeinfo(self, name, finfo):
|
def _writeinfo(self, name, finfo):
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
raise Error, 'Filename too long'
|
raise Error, 'Filename too long'
|
def _writeinfo(self, name, finfo):
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
def _write(self, data):
|
def _write(self, data):
|
def _write(self, data):
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
def _writecrc(self):
|
def _writecrc(self):
|
def _writecrc(self):
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
def write(self, data):
|
def write(self, data):
|
def write(self, data):
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
raise Error, 'Writing data at the wrong time'
|
raise Error, 'Writing data at the wrong time'
|
def write(self, data):
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
def close_data(self):
|
def close_data(self):
|
def close_data(self):
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
raise Error, 'Incorrect data size, diff='+`self.rlen`
|
raise Error, 'Incorrect data size, diff='+`self.rlen`
|
def close_data(self):
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
def write_rsrc(self, data):
|
def write_rsrc(self, data):
|
def write_rsrc(self, data):
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
self.close_data()
|
self.close_data()
|
def write_rsrc(self, data):
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
raise Error, 'Writing resource data at the wrong time'
|
raise Error, 'Writing resource data at the wrong time'
|
def write_rsrc(self, data):
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
def close(self):
|
def close(self):
|
def close(self):
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
self.close_data()
|
self.close_data()
|
def close(self):
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
raise Error, 'Close at the wrong time'
|
raise Error, 'Close at the wrong time'
|
def close(self):
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
raise Error, "Incorrect resource-datasize, diff="+`self.rlen`
|
raise Error, "Incorrect resource-datasize, diff="+`self.rlen`
|
def close(self):
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
d = ifp.read() ofp.write(d)
|
while 1: d = ifp.read(128000) if not d: break ofp.write(d)
|
def binhex(inp, out): """(infilename, outfilename) - Create binhex-encoded copy of a file""" finfo = getfileinfo(inp) ofp = BinHex(finfo, out) ifp = open(inp, 'rb') # XXXX Do textfile translation on non-mac systems d = ifp.read() ofp.write(d) ofp.close_data() ifp.close() ifp = openrsrc(inp, 'rb') d = ifp.read() ofp.write_rsrc(d) ofp.close() ifp.close()
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
d = ifp.read() ofp.write_rsrc(d)
|
while 1: d = ifp.read(128000) if not d: break ofp.write_rsrc(d)
|
def binhex(inp, out): """(infilename, outfilename) - Create binhex-encoded copy of a file""" finfo = getfileinfo(inp) ofp = BinHex(finfo, out) ifp = open(inp, 'rb') # XXXX Do textfile translation on non-mac systems d = ifp.read() ofp.write(d) ofp.close_data() ifp.close() ifp = openrsrc(inp, 'rb') d = ifp.read() ofp.write_rsrc(d) ofp.close() ifp.close()
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
ifp.close()
|
ifp.close()
|
def binhex(inp, out): """(infilename, outfilename) - Create binhex-encoded copy of a file""" finfo = getfileinfo(inp) ofp = BinHex(finfo, out) ifp = open(inp, 'rb') # XXXX Do textfile translation on non-mac systems d = ifp.read() ofp.write(d) ofp.close_data() ifp.close() ifp = openrsrc(inp, 'rb') d = ifp.read() ofp.write_rsrc(d) ofp.close() ifp.close()
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
"""Read data via the decoder in 4-byte chunks""" def __init__(self, ifp):
|
"""Read data via the decoder in 4-byte chunks""" def __init__(self, ifp):
|
def binhex(inp, out): """(infilename, outfilename) - Create binhex-encoded copy of a file""" finfo = getfileinfo(inp) ofp = BinHex(finfo, out) ifp = open(inp, 'rb') # XXXX Do textfile translation on non-mac systems d = ifp.read() ofp.write(d) ofp.close_data() ifp.close() ifp = openrsrc(inp, 'rb') d = ifp.read() ofp.write_rsrc(d) ofp.close() ifp.close()
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
def read(self, totalwtd):
|
def read(self, totalwtd):
|
def read(self, totalwtd):
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
def close(self):
|
def close(self):
|
def close(self):
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
"""Read data via the RLE-coder""" def __init__(self, ifp):
|
"""Read data via the RLE-coder""" def __init__(self, ifp):
|
def close(self):
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
def read(self, wtd):
|
def read(self, wtd):
|
def read(self, wtd):
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
self._fill(wtd-len(self.post_buffer))
|
self._fill(wtd-len(self.post_buffer))
|
def read(self, wtd):
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
print 'WTD', wtd, 'GOT', len(rv)
|
def read(self, wtd):
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
|
def _fill(self, wtd):
|
def _fill(self, wtd):
|
def _fill(self, wtd):
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
def close(self):
|
def close(self):
|
def close(self):
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
def __init__(self, ifp):
|
def __init__(self, ifp):
|
def __init__(self, ifp):
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
ifp = open(ifp)
|
ifp = open(ifp)
|
def __init__(self, ifp):
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
if DEBUG: print 'SKIP:', ch+dummy
|
def __init__(self, ifp):
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
|
def _read(self, len):
|
def _read(self, len):
|
def _read(self, len):
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
def _checkcrc(self):
|
def _checkcrc(self):
|
def _checkcrc(self):
|
a220e67a9ed94d66b81e393a3bb9e6acd10068c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a220e67a9ed94d66b81e393a3bb9e6acd10068c1/binhex.py
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.