rem
stringlengths 1
322k
| add
stringlengths 0
2.05M
| context
stringlengths 4
228k
| meta
stringlengths 156
215
|
---|---|---|---|
if line[:prefix_len] == prefix: s = string.split(line[prefix_len:], '}', 1)[0] | prefix = None if line.startswith(PREFIX_1): prefix = PREFIX_1 elif line.startswith(PREFIX_2): prefix = PREFIX_2 if prefix: s = line[len(prefix):].split('}', 1)[0] | def main(): rcfile = os.path.join(os.path.dirname(refcounts.__file__), os.pardir, "api", "refcounts.dat") outfile = "-" opts, args = getopt.getopt(sys.argv[1:], "o:r:", ["output=", "refcounts="]) for opt, arg in opts: if opt in ("-o", "--output"): outfile = arg elif opt in ("-r", "--refcounts"): rcfile = arg rcdict = refcounts.load(rcfile) if outfile == "-": output = sys.stdout else: output = open(outfile, "w") if not args: args = ["-"] prefix = PREFIX prefix_len = len(prefix) for infile in args: if infile == "-": input = sys.stdin else: input = open(infile) while 1: line = input.readline() if not line: break if line[:prefix_len] == prefix: s = string.split(line[prefix_len:], '}', 1)[0] try: info = rcdict[s] except KeyError: sys.stderr.write("No refcount data for %s\n" % s) else: if info.result_type in ("PyObject*", "PyVarObject*"): if info.result_refs is None: rc = "Always \NULL{}" else: rc = info.result_refs and "New" or "Borrowed" rc = rc + " reference" line = (r"\begin{cfuncdesc}[%s]{%s}{" % (rc, info.result_type)) \ + line[prefix_len:] output.write(line) if infile != "-": input.close() if outfile != "-": output.close() | 3764b6b67ec28e594d03bb95efb9b9ad029f018c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3764b6b67ec28e594d03bb95efb9b9ad029f018c/anno-api.py |
+ line[prefix_len:] | + line[len(prefix):] | def main(): rcfile = os.path.join(os.path.dirname(refcounts.__file__), os.pardir, "api", "refcounts.dat") outfile = "-" opts, args = getopt.getopt(sys.argv[1:], "o:r:", ["output=", "refcounts="]) for opt, arg in opts: if opt in ("-o", "--output"): outfile = arg elif opt in ("-r", "--refcounts"): rcfile = arg rcdict = refcounts.load(rcfile) if outfile == "-": output = sys.stdout else: output = open(outfile, "w") if not args: args = ["-"] prefix = PREFIX prefix_len = len(prefix) for infile in args: if infile == "-": input = sys.stdin else: input = open(infile) while 1: line = input.readline() if not line: break if line[:prefix_len] == prefix: s = string.split(line[prefix_len:], '}', 1)[0] try: info = rcdict[s] except KeyError: sys.stderr.write("No refcount data for %s\n" % s) else: if info.result_type in ("PyObject*", "PyVarObject*"): if info.result_refs is None: rc = "Always \NULL{}" else: rc = info.result_refs and "New" or "Borrowed" rc = rc + " reference" line = (r"\begin{cfuncdesc}[%s]{%s}{" % (rc, info.result_type)) \ + line[prefix_len:] output.write(line) if infile != "-": input.close() if outfile != "-": output.close() | 3764b6b67ec28e594d03bb95efb9b9ad029f018c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3764b6b67ec28e594d03bb95efb9b9ad029f018c/anno-api.py |
if sys.platform == 'darwin' and g.has_key('CONFIGURE_MACOSX_DEPLOYMENT_TARGET'): cfg_target = g['CONFIGURE_MACOSX_DEPLOYMENT_TARGET'] cur_target = os.getenv('MACOSX_DEPLOYMENT_TARGET', '') if cfg_target != cur_target: my_msg = ('$MACOSX_DEPLOYMENT_TARGET mismatch: now "%s" but "%s" during configure' % (cur_target, cfg_target)) raise DistutilsPlatformError(my_msg) | def _init_posix(): """Initialize the module as appropriate for POSIX systems.""" g = {} # load the installed Makefile: try: filename = get_makefile_filename() parse_makefile(filename, g) except IOError, msg: my_msg = "invalid Python installation: unable to open %s" % filename if hasattr(msg, "strerror"): my_msg = my_msg + " (%s)" % msg.strerror raise DistutilsPlatformError(my_msg) # On AIX, there are wrong paths to the linker scripts in the Makefile # -- these paths are relative to the Python source, but when installed # the scripts are in another directory. if python_build: g['LDSHARED'] = g['BLDSHARED'] elif sys.version < '2.1': # The following two branches are for 1.5.2 compatibility. if sys.platform == 'aix4': # what about AIX 3.x ? # Linker script is in the config directory, not in Modules as the # Makefile says. python_lib = get_python_lib(standard_lib=1) ld_so_aix = os.path.join(python_lib, 'config', 'ld_so_aix') python_exp = os.path.join(python_lib, 'config', 'python.exp') g['LDSHARED'] = "%s %s -bI:%s" % (ld_so_aix, g['CC'], python_exp) elif sys.platform == 'beos': # Linker script is in the config directory. In the Makefile it is # relative to the srcdir, which after installation no longer makes # sense. python_lib = get_python_lib(standard_lib=1) linkerscript_path = string.split(g['LDSHARED'])[0] linkerscript_name = os.path.basename(linkerscript_path) linkerscript = os.path.join(python_lib, 'config', linkerscript_name) # XXX this isn't the right place to do this: adding the Python # library to the link, if needed, should be in the "build_ext" # command. (It's also needed for non-MS compilers on Windows, and # it's taken care of for them by the 'build_ext.get_libraries()' # method.) g['LDSHARED'] = ("%s -L%s/lib -lpython%s" % (linkerscript, PREFIX, sys.version[0:3])) global _config_vars _config_vars = g | 6b08a40442ca500c8e2073e012b51af66cab9c5a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6b08a40442ca500c8e2073e012b51af66cab9c5a/sysconfig.py |
|
text = self._split_header(text) | text = self._split_header(h, text) | def _write_headers(self, msg): for h, v in msg.items(): # We only write the MIME-Version: header for the outermost # container message. Unfortunately, we can't use same technique # as for the Unix-From above because we don't know when # MIME-Version: will occur. if h.lower() == 'mime-version' and not self.__first: continue # RFC 2822 says that lines SHOULD be no more than maxheaderlen # characters wide, so we're well within our rights to split long # headers. text = '%s: %s' % (h, v) if self.__maxheaderlen > 0 and len(text) > self.__maxheaderlen: text = self._split_header(text) print >> self._fp, text # A blank line always separates headers from body print >> self._fp | 062749ac577be62c2f14fe61c2167c9c5b909ea3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/062749ac577be62c2f14fe61c2167c9c5b909ea3/Generator.py |
def _split_header(self, text): | def _split_header(self, name, text): | def _split_header(self, text): maxheaderlen = self.__maxheaderlen # Find out whether any lines in the header are really longer than # maxheaderlen characters wide. There could be continuation lines # that actually shorten it. Also, replace hard tabs with 8 spaces. lines = [s.replace('\t', SPACE8) for s in text.split('\n')] for line in lines: if len(line) > maxheaderlen: break else: # No line was actually longer than maxheaderlen characters, so # just return the original unchanged. return text rtn = [] for line in text.split('\n'): splitline = [] # Short lines can remain unchanged if len(line.replace('\t', SPACE8)) <= maxheaderlen: splitline.append(line) rtn.append(SEMINLTAB.join(splitline)) else: oldlen = len(line) # Try to break the line on semicolons, but if that doesn't # work, try to split on folding whitespace. while len(line) > maxheaderlen: i = line.rfind(';', 0, maxheaderlen) if i < 0: break splitline.append(line[:i]) line = line[i+1:].lstrip() if len(line) <> oldlen: # Splitting on semis worked splitline.append(line) rtn.append(SEMINLTAB.join(splitline)) continue # Splitting on semis didn't help, so try to split on # whitespace. parts = re.split(r'(\s+)', line) # Watch out though for "Header: longnonsplittableline" if parts[0].endswith(':') and len(parts) == 3: rtn.append(line) continue first = parts.pop(0) sublines = [first] acc = len(first) while parts: len0 = len(parts[0]) len1 = len(parts[1]) if acc + len0 + len1 < maxheaderlen: sublines.append(parts.pop(0)) sublines.append(parts.pop(0)) acc += len0 + len1 else: # Split it here, but don't forget to ignore the # next whitespace-only part splitline.append(EMPTYSTRING.join(sublines)) del parts[0] first = parts.pop(0) sublines = [first] acc = len(first) splitline.append(EMPTYSTRING.join(sublines)) rtn.append(NLTAB.join(splitline)) return NL.join(rtn) | 062749ac577be62c2f14fe61c2167c9c5b909ea3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/062749ac577be62c2f14fe61c2167c9c5b909ea3/Generator.py |
lines = [s.replace('\t', SPACE8) for s in text.split('\n')] | lines = [s.replace('\t', SPACE8) for s in text.splitlines()] | def _split_header(self, text): maxheaderlen = self.__maxheaderlen # Find out whether any lines in the header are really longer than # maxheaderlen characters wide. There could be continuation lines # that actually shorten it. Also, replace hard tabs with 8 spaces. lines = [s.replace('\t', SPACE8) for s in text.split('\n')] for line in lines: if len(line) > maxheaderlen: break else: # No line was actually longer than maxheaderlen characters, so # just return the original unchanged. return text rtn = [] for line in text.split('\n'): splitline = [] # Short lines can remain unchanged if len(line.replace('\t', SPACE8)) <= maxheaderlen: splitline.append(line) rtn.append(SEMINLTAB.join(splitline)) else: oldlen = len(line) # Try to break the line on semicolons, but if that doesn't # work, try to split on folding whitespace. while len(line) > maxheaderlen: i = line.rfind(';', 0, maxheaderlen) if i < 0: break splitline.append(line[:i]) line = line[i+1:].lstrip() if len(line) <> oldlen: # Splitting on semis worked splitline.append(line) rtn.append(SEMINLTAB.join(splitline)) continue # Splitting on semis didn't help, so try to split on # whitespace. parts = re.split(r'(\s+)', line) # Watch out though for "Header: longnonsplittableline" if parts[0].endswith(':') and len(parts) == 3: rtn.append(line) continue first = parts.pop(0) sublines = [first] acc = len(first) while parts: len0 = len(parts[0]) len1 = len(parts[1]) if acc + len0 + len1 < maxheaderlen: sublines.append(parts.pop(0)) sublines.append(parts.pop(0)) acc += len0 + len1 else: # Split it here, but don't forget to ignore the # next whitespace-only part splitline.append(EMPTYSTRING.join(sublines)) del parts[0] first = parts.pop(0) sublines = [first] acc = len(first) splitline.append(EMPTYSTRING.join(sublines)) rtn.append(NLTAB.join(splitline)) return NL.join(rtn) | 062749ac577be62c2f14fe61c2167c9c5b909ea3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/062749ac577be62c2f14fe61c2167c9c5b909ea3/Generator.py |
rtn = [] for line in text.split('\n'): splitline = [] if len(line.replace('\t', SPACE8)) <= maxheaderlen: splitline.append(line) rtn.append(SEMINLTAB.join(splitline)) else: oldlen = len(line) while len(line) > maxheaderlen: i = line.rfind(';', 0, maxheaderlen) if i < 0: break splitline.append(line[:i]) line = line[i+1:].lstrip() if len(line) <> oldlen: splitline.append(line) rtn.append(SEMINLTAB.join(splitline)) continue parts = re.split(r'(\s+)', line) if parts[0].endswith(':') and len(parts) == 3: rtn.append(line) continue first = parts.pop(0) sublines = [first] acc = len(first) while parts: len0 = len(parts[0]) len1 = len(parts[1]) if acc + len0 + len1 < maxheaderlen: sublines.append(parts.pop(0)) sublines.append(parts.pop(0)) acc += len0 + len1 else: splitline.append(EMPTYSTRING.join(sublines)) del parts[0] first = parts.pop(0) sublines = [first] acc = len(first) splitline.append(EMPTYSTRING.join(sublines)) rtn.append(NLTAB.join(splitline)) return NL.join(rtn) | h = Header(text, maxlinelen=maxheaderlen, continuation_ws='\t') return h.encode() | def _split_header(self, text): maxheaderlen = self.__maxheaderlen # Find out whether any lines in the header are really longer than # maxheaderlen characters wide. There could be continuation lines # that actually shorten it. Also, replace hard tabs with 8 spaces. lines = [s.replace('\t', SPACE8) for s in text.split('\n')] for line in lines: if len(line) > maxheaderlen: break else: # No line was actually longer than maxheaderlen characters, so # just return the original unchanged. return text rtn = [] for line in text.split('\n'): splitline = [] # Short lines can remain unchanged if len(line.replace('\t', SPACE8)) <= maxheaderlen: splitline.append(line) rtn.append(SEMINLTAB.join(splitline)) else: oldlen = len(line) # Try to break the line on semicolons, but if that doesn't # work, try to split on folding whitespace. while len(line) > maxheaderlen: i = line.rfind(';', 0, maxheaderlen) if i < 0: break splitline.append(line[:i]) line = line[i+1:].lstrip() if len(line) <> oldlen: # Splitting on semis worked splitline.append(line) rtn.append(SEMINLTAB.join(splitline)) continue # Splitting on semis didn't help, so try to split on # whitespace. parts = re.split(r'(\s+)', line) # Watch out though for "Header: longnonsplittableline" if parts[0].endswith(':') and len(parts) == 3: rtn.append(line) continue first = parts.pop(0) sublines = [first] acc = len(first) while parts: len0 = len(parts[0]) len1 = len(parts[1]) if acc + len0 + len1 < maxheaderlen: sublines.append(parts.pop(0)) sublines.append(parts.pop(0)) acc += len0 + len1 else: # Split it here, but don't forget to ignore the # next whitespace-only part splitline.append(EMPTYSTRING.join(sublines)) del parts[0] first = parts.pop(0) sublines = [first] acc = len(first) splitline.append(EMPTYSTRING.join(sublines)) rtn.append(NLTAB.join(splitline)) return NL.join(rtn) | 062749ac577be62c2f14fe61c2167c9c5b909ea3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/062749ac577be62c2f14fe61c2167c9c5b909ea3/Generator.py |
def QueueTaskDoneTest(q) | def QueueTaskDoneTest(q): | def QueueTaskDoneTest(q) try: q.task_done() except ValueError: pass else: raise TestFailed("Did not detect task count going negative") | baf05b7e09fa7f83292f7384025e94b116da00c0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/baf05b7e09fa7f83292f7384025e94b116da00c0/test_queue.py |
('a = 1,2,3', '((1, 2, 3))',), ('("a","b","c")', "(('a', 'b', 'c'))",), ('a,b,c = 1,2,3', '((1, 2, 3))',), | ('a = 1,2,3', '((1, 2, 3))'), ('("a","b","c")', "(('a', 'b', 'c'))"), ('a,b,c = 1,2,3', '((1, 2, 3))'), ('(None, 1, None)', '((None, 1, None))'), ('((1, 2), 3, 4)', '(((1, 2), 3, 4))'), | def test_folding_of_tuples_of_constants(self): for line, elem in ( ('a = 1,2,3', '((1, 2, 3))',), ('("a","b","c")', "(('a', 'b', 'c'))",), ('a,b,c = 1,2,3', '((1, 2, 3))',), ): asm = dis_single(line) self.assert_(elem in asm) self.assert_('BUILD_TUPLE' not in asm) | 5dec096e6a62be5769904111a16d32ee86a9ef46 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5dec096e6a62be5769904111a16d32ee86a9ef46/test_peepholer.py |
if platform == 'cygwin': lib_prefix = 'cyg' else: lib_prefix = '' | def detect_tkinter(self, inc_dirs, lib_dirs): # The _tkinter module. | cccac1a163915d7a4e757a1a4e62b21c91b5c475 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/cccac1a163915d7a4e757a1a4e62b21c91b5c475/setup.py |
|
tklib = self.compiler.find_library_file(lib_dirs, lib_prefix + 'tk' + version) tcllib = self.compiler.find_library_file(lib_dirs, lib_prefix + 'tcl' + version) | tklib = self.compiler.find_library_file(lib_dirs, 'tk' + version) tcllib = self.compiler.find_library_file(lib_dirs, 'tcl' + version) | def detect_tkinter(self, inc_dirs, lib_dirs): # The _tkinter module. | cccac1a163915d7a4e757a1a4e62b21c91b5c475 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/cccac1a163915d7a4e757a1a4e62b21c91b5c475/setup.py |
libs.append(lib_prefix + 'tk'+ version) libs.append(lib_prefix + 'tcl'+ version) | libs.append('tk'+ version) libs.append('tcl'+ version) | def detect_tkinter(self, inc_dirs, lib_dirs): # The _tkinter module. | cccac1a163915d7a4e757a1a4e62b21c91b5c475 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/cccac1a163915d7a4e757a1a4e62b21c91b5c475/setup.py |
print "Breakpoint in", filename, "at", lineno | def set_break(self, filename, lineno, temporary=0, cond = None): filename = self.canonic(filename) import linecache # Import as late as possible line = linecache.getline(filename, lineno) if not line: return 'Line %s:%d does not exist' % (filename, lineno) if not self.breaks.has_key(filename): self.breaks[filename] = [] list = self.breaks[filename] if not lineno in list: list.append(lineno) bp = Breakpoint(filename, lineno, temporary, cond) print "Breakpoint in", filename, "at", lineno | ca44236a1c313a6257c49ce223e4515329348015 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ca44236a1c313a6257c49ce223e4515329348015/bdb.py |
|
self.default(line) return | return self.default(line) | def onecmd(self, line): line = string.strip(line) if line == '?': line = 'help' elif line == '!': if hasattr(self, 'do_shell'): line = 'shell' else: self.default(line) return elif not line: self.emptyline() return self.lastcmd = line i, n = 0, len(line) while i < n and line[i] in self.identchars: i = i+1 cmd, arg = line[:i], string.strip(line[i:]) if cmd == '': return self.default(line) else: try: func = getattr(self, 'do_' + cmd) except AttributeError: return self.default(line) return func(arg) | c612681b20f2ff8786067a3d8c6d041bc64d0db0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c612681b20f2ff8786067a3d8c6d041bc64d0db0/cmd.py |
self.emptyline() return | return self.emptyline() | def onecmd(self, line): line = string.strip(line) if line == '?': line = 'help' elif line == '!': if hasattr(self, 'do_shell'): line = 'shell' else: self.default(line) return elif not line: self.emptyline() return self.lastcmd = line i, n = 0, len(line) while i < n and line[i] in self.identchars: i = i+1 cmd, arg = line[:i], string.strip(line[i:]) if cmd == '': return self.default(line) else: try: func = getattr(self, 'do_' + cmd) except AttributeError: return self.default(line) return func(arg) | c612681b20f2ff8786067a3d8c6d041bc64d0db0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c612681b20f2ff8786067a3d8c6d041bc64d0db0/cmd.py |
def do_event(self, (dev, val)): | def do_event(self, dev, val): | def do_event(self, (dev, val)): if dev == DEVICE.REDRAW: if self.vin: self.vin.redraw(val) if self.vout: self.vout.redraw(val) | a8993cfe16a04c612da72f72181ac63c6f858224 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a8993cfe16a04c612da72f72181ac63c6f858224/Vedit.py |
def cb_in_new(self, args): | def cb_in_new(self, *args): | def cb_in_new(self, args): self.msg('') hd, tl = os.path.split(self.ifile) filename = fl.file_selector('Input video file', hd, '', tl) if not filename: return self.open_input(filename) | a8993cfe16a04c612da72f72181ac63c6f858224 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a8993cfe16a04c612da72f72181ac63c6f858224/Vedit.py |
def cb_in_close(self, args): | def cb_in_close(self, *args): | def cb_in_close(self, args): self.msg('') self.close_input() | a8993cfe16a04c612da72f72181ac63c6f858224 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a8993cfe16a04c612da72f72181ac63c6f858224/Vedit.py |
def cb_in_skip(self, args): | def cb_in_skip(self, *args): | def cb_in_skip(self, args): if not self.icheck(): return if not self.vin.get(): self.err('End of input file') self.ishow() | a8993cfe16a04c612da72f72181ac63c6f858224 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a8993cfe16a04c612da72f72181ac63c6f858224/Vedit.py |
def cb_in_back(self, args): | def cb_in_back(self, *args): | def cb_in_back(self, args): if not self.icheck(): return if not self.vin.backup(): self.err('Input buffer exhausted') self.ishow() | a8993cfe16a04c612da72f72181ac63c6f858224 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a8993cfe16a04c612da72f72181ac63c6f858224/Vedit.py |
def cb_in_rewind(self, args): | def cb_in_rewind(self, *args): | def cb_in_rewind(self, args): if not self.icheck(): return self.vin.rewind() self.ishow() | a8993cfe16a04c612da72f72181ac63c6f858224 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a8993cfe16a04c612da72f72181ac63c6f858224/Vedit.py |
def cb_copy(self, args): | def cb_copy(self, *args): | def cb_copy(self, args): if not self.iocheck(): return data = self.vin.get() if not data: self.err('End of input file') self.ishow() return if self.vout.getinfo() <> self.vin.getinfo(): print 'Copying info...' self.vout.setinfo(self.vin.getinfo()) self.vout.put(data) self.oshow() self.ishow() | a8993cfe16a04c612da72f72181ac63c6f858224 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a8993cfe16a04c612da72f72181ac63c6f858224/Vedit.py |
def cb_uncopy(self, args): | def cb_uncopy(self, *args): | def cb_uncopy(self, args): if not self.iocheck(): return if not self.vout.backup(): self.err('Output buffer exhausted') return self.oshow() if not self.vin.backup(): self.err('Input buffer exhausted') return self.ishow() | a8993cfe16a04c612da72f72181ac63c6f858224 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a8993cfe16a04c612da72f72181ac63c6f858224/Vedit.py |
def cb_out_new(self, args): | def cb_out_new(self, *args): | def cb_out_new(self, args): self.msg('') hd, tl = os.path.split(self.ofile) filename = fl.file_selector('Output video file', hd, '', tl) if not filename: return self.open_output(filename) | a8993cfe16a04c612da72f72181ac63c6f858224 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a8993cfe16a04c612da72f72181ac63c6f858224/Vedit.py |
def cb_out_close(self, args): | def cb_out_close(self, *args): | def cb_out_close(self, args): self.msg('') self.close_output() | a8993cfe16a04c612da72f72181ac63c6f858224 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a8993cfe16a04c612da72f72181ac63c6f858224/Vedit.py |
def cb_out_skip(self, arg): | def cb_out_skip(self, *args): | def cb_out_skip(self, arg): if not self.ocheck(): return if not self.vout.forward(): self.err('Output buffer exhausted') self.oshow() | a8993cfe16a04c612da72f72181ac63c6f858224 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a8993cfe16a04c612da72f72181ac63c6f858224/Vedit.py |
def cb_out_back(self, args): | def cb_out_back(self, *args): | def cb_out_back(self, args): if not self.ocheck(): return if not self.vout.backup(): self.err('Output buffer exhausted') self.oshow() | a8993cfe16a04c612da72f72181ac63c6f858224 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a8993cfe16a04c612da72f72181ac63c6f858224/Vedit.py |
def cb_out_rewind(self, args): | def cb_out_rewind(self, *args): | def cb_out_rewind(self, args): if not self.ocheck(): return self.vout.rewind() self.oshow() | a8993cfe16a04c612da72f72181ac63c6f858224 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a8993cfe16a04c612da72f72181ac63c6f858224/Vedit.py |
def cb_quit(self, args): | def cb_quit(self, *args): | def cb_quit(self, args): self.close_input() self.close_output() sys.exit(0) | a8993cfe16a04c612da72f72181ac63c6f858224 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a8993cfe16a04c612da72f72181ac63c6f858224/Vedit.py |
RA("%s=%s;" % (self.key, self.coded_value)) | RA("%s=%s" % (self.key, self.coded_value)) | def OutputString(self, attrs=None): # Build up our result # result = [] RA = result.append | 532efabf1dcae183c586b78007baaaf59e4d61ca /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/532efabf1dcae183c586b78007baaaf59e4d61ca/Cookie.py |
RA("%s=%s;" % (self._reserved[K], _getdate(V))) | RA("%s=%s" % (self._reserved[K], _getdate(V))) | def OutputString(self, attrs=None): # Build up our result # result = [] RA = result.append | 532efabf1dcae183c586b78007baaaf59e4d61ca /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/532efabf1dcae183c586b78007baaaf59e4d61ca/Cookie.py |
RA("%s=%d;" % (self._reserved[K], V)) | RA("%s=%d" % (self._reserved[K], V)) | def OutputString(self, attrs=None): # Build up our result # result = [] RA = result.append | 532efabf1dcae183c586b78007baaaf59e4d61ca /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/532efabf1dcae183c586b78007baaaf59e4d61ca/Cookie.py |
RA("%s;" % self._reserved[K]) | RA(str(self._reserved[K])) | def OutputString(self, attrs=None): # Build up our result # result = [] RA = result.append | 532efabf1dcae183c586b78007baaaf59e4d61ca /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/532efabf1dcae183c586b78007baaaf59e4d61ca/Cookie.py |
RA("%s=%s;" % (self._reserved[K], V)) | RA("%s=%s" % (self._reserved[K], V)) | def OutputString(self, attrs=None): # Build up our result # result = [] RA = result.append | 532efabf1dcae183c586b78007baaaf59e4d61ca /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/532efabf1dcae183c586b78007baaaf59e4d61ca/Cookie.py |
return _spacejoin(result) | return _semispacejoin(result) | def OutputString(self, attrs=None): # Build up our result # result = [] RA = result.append | 532efabf1dcae183c586b78007baaaf59e4d61ca /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/532efabf1dcae183c586b78007baaaf59e4d61ca/Cookie.py |
def output(self, attrs=None, header="Set-Cookie:", sep="\n"): | def output(self, attrs=None, header="Set-Cookie:", sep="\015\012"): | def output(self, attrs=None, header="Set-Cookie:", sep="\n"): """Return a string suitable for HTTP.""" result = [] items = self.items() items.sort() for K,V in items: result.append( V.output(attrs, header) ) return sep.join(result) | 532efabf1dcae183c586b78007baaaf59e4d61ca /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/532efabf1dcae183c586b78007baaaf59e4d61ca/Cookie.py |
return '<%s: %s>' % (self.__class__.__name__, _spacejoin(L)) | return '<%s: %s>' % (self.__class__.__name__, _semispacejoin(L)) | def __repr__(self): L = [] items = self.items() items.sort() for K,V in items: L.append( '%s=%s' % (K,repr(V.value) ) ) return '<%s: %s>' % (self.__class__.__name__, _spacejoin(L)) | 532efabf1dcae183c586b78007baaaf59e4d61ca /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/532efabf1dcae183c586b78007baaaf59e4d61ca/Cookie.py |
time.sleep(1) | time.sleep(1.1) | def test_autoseed(self): self.gen.seed() state1 = self.gen.getstate() time.sleep(1) self.gen.seed() # diffent seeds at different times state2 = self.gen.getstate() self.assertNotEqual(state1, state2) | 785d0a37e510ab4c76dc82e4605ad9ea0231d0a1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/785d0a37e510ab4c76dc82e4605ad9ea0231d0a1/test_random.py |
if auth: h.putheader('Authorization: Basic %s' % auth) | if auth: h.putheader('Authorization', 'Basic %s' % auth) | def open_https(self, url, data=None): """Use HTTPS protocol.""" import httplib user_passwd = None if isinstance(url, str): host, selector = splithost(url) if host: user_passwd, host = splituser(host) host = unquote(host) realhost = host else: host, selector = url urltype, rest = splittype(selector) url = rest user_passwd = None if urltype.lower() != 'https': realhost = None else: realhost, rest = splithost(rest) if realhost: user_passwd, realhost = splituser(realhost) if user_passwd: selector = "%s://%s%s" % (urltype, realhost, rest) #print "proxy via https:", host, selector if not host: raise IOError, ('https error', 'no host given') if user_passwd: import base64 auth = base64.encodestring(user_passwd).strip() else: auth = None h = httplib.HTTPS(host, 0, key_file=self.key_file, cert_file=self.cert_file) if data is not None: h.putrequest('POST', selector) h.putheader('Content-type', 'application/x-www-form-urlencoded') h.putheader('Content-length', '%d' % len(data)) else: h.putrequest('GET', selector) if auth: h.putheader('Authorization: Basic %s' % auth) if realhost: h.putheader('Host', realhost) for args in self.addheaders: h.putheader(*args) h.endheaders() if data is not None: h.send(data) errcode, errmsg, headers = h.getreply() fp = h.getfile() if errcode == 200: return addinfourl(fp, headers, "https:" + url) else: if data is None: return self.http_error(url, fp, errcode, errmsg, headers) else: return self.http_error(url, fp, errcode, errmsg, headers, data) | ff638ea6dbc7ff6819a083f9a9562a8099accade /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ff638ea6dbc7ff6819a083f9a9562a8099accade/urllib.py |
pid, status = os.wait() | exited_pid, status = os.waitpid(pid, 0) | def test_lock_conflict(self): # Fork off a subprocess that will lock the file for 2 seconds, # unlock it, and then exit. if not hasattr(os, 'fork'): return pid = os.fork() if pid == 0: # In the child, lock the mailbox. self._box.lock() time.sleep(2) self._box.unlock() os._exit(0) | 15486f78f0ccb04b86905b175c004a5b4c4f785e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/15486f78f0ccb04b86905b175c004a5b4c4f785e/test_mailbox.py |
doc(arg) | help.help(arg) | def stopped(): print 'pydoc server stopped' | b8c084e82c7bae771c0197b177f5c32c7e513c74 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b8c084e82c7bae771c0197b177f5c32c7e513c74/pydoc.py |
function, module, or package, or a dotted reference to a class or function within a module or module in a package. If <name> contains a '%s', it is used as the path to a Python source file to document. | Python keyword, topic, function, module, or package, or a dotted reference to a class or function within a module or module in a package. If <name> contains a '%s', it is used as the path to a Python source file to document. If name is 'keywords', 'topics', or 'modules', a listing of these things is displayed. | def stopped(): print 'pydoc server stopped' | b8c084e82c7bae771c0197b177f5c32c7e513c74 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b8c084e82c7bae771c0197b177f5c32c7e513c74/pydoc.py |
if not (self.have_fork or self.have_popen2): | if not (self.have_fork or self.have_popen2 or self.have_popen3): | def run_cgi(self): """Execute a CGI script.""" dir, rest = self.cgi_info i = rest.rfind('?') if i >= 0: rest, query = rest[:i], rest[i+1:] else: query = '' i = rest.find('/') 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 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 | 8cb6540652292991b8d1af4b66c125f270a094bf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8cb6540652292991b8d1af4b66c125f270a094bf/CGIHTTPServer.py |
elif self.have_popen2: | elif self.have_popen2 or self.have_popen3: | def run_cgi(self): """Execute a CGI script.""" dir, rest = self.cgi_info i = rest.rfind('?') if i >= 0: rest, query = rest[:i], rest[i+1:] else: query = '' i = rest.find('/') 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 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 | 8cb6540652292991b8d1af4b66c125f270a094bf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8cb6540652292991b8d1af4b66c125f270a094bf/CGIHTTPServer.py |
fi, fo = os.popen2(cmdline, 'b') | files = popenx(cmdline, 'b') fi = files[0] fo = files[1] if self.have_popen3: fe = files[2] | def run_cgi(self): """Execute a CGI script.""" dir, rest = self.cgi_info i = rest.rfind('?') if i >= 0: rest, query = rest[:i], rest[i+1:] else: query = '' i = rest.find('/') 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 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 | 8cb6540652292991b8d1af4b66c125f270a094bf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8cb6540652292991b8d1af4b66c125f270a094bf/CGIHTTPServer.py |
install = self.reinitialize_command('install') | install = self.reinitialize_command('install', reinit_subcommands=1) | def run (self): if (sys.platform != "win32" and (self.distribution.has_ext_modules() or self.distribution.has_c_libraries())): raise DistutilsPlatformError \ ("distribution contains extensions and/or C libraries; " "must be compiled on a Windows 32 platform") | cd494adc3b75bff0e79e25b68339989f33f2aac3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/cd494adc3b75bff0e79e25b68339989f33f2aac3/bdist_wininst.py |
bool, | def update(self): self.w.browser.update() | 71fd01c0996e6440a20c563df0ab8c7d20cf2841 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/71fd01c0996e6440a20c563df0ab8c7d20cf2841/PyBrowser.py |
|
items = map(None, range(len(seq)), seq) items = map(lambda (k, v), type = type, simp = SIMPLE_TYPES, indent = indent: (k, v, not type(v) in simp, indent), items) return items | return [(i, v, not isinstance(v, SIMPLE_TYPES), indent) for i, v in enumerate(seq)] | def unpack_sequence(seq, indent = 0): items = map(None, range(len(seq)), seq) items = map(lambda (k, v), type = type, simp = SIMPLE_TYPES, indent = indent: (k, v, not type(v) in simp, indent), items) return items | 71fd01c0996e6440a20c563df0ab8c7d20cf2841 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/71fd01c0996e6440a20c563df0ab8c7d20cf2841/PyBrowser.py |
test_mesg = 'From: %s@localhost\nSubject: IMAP4 test\n\ndata...\n' % USER | test_mesg = 'From: %(user)s@localhost%(lf)sSubject: IMAP4 test%(lf)s%(lf)sdata...%(lf)s' % {'user':USER, 'lf':CRLF} | def print_log(): _mesg('last %d IMAP4 interactions:' % len(_cmd_log)) for secs,line in _cmd_log: _mesg(line, secs) | e02f904cbfd12e5d89b71bc65ed76d5828cb4e83 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e02f904cbfd12e5d89b71bc65ed76d5828cb4e83/imaplib.py |
def __init__(self, filenames=()): | def __init__(self, filenames=(), strict=True): | def __init__(self, filenames=()): if not inited: init() self.encodings_map = encodings_map.copy() self.suffix_map = suffix_map.copy() self.types_map = types_map.copy() self.common_types = common_types.copy() for name in filenames: self.read(name) | 5ccaf8f1298628bea5a4c7442413f2901914f1bc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5ccaf8f1298628bea5a4c7442413f2901914f1bc/mimetypes.py |
self.types_map = types_map.copy() self.common_types = common_types.copy() | self.types_map = ({}, {}) self.types_map_inv = ({}, {}) for (ext, type) in types_map.items(): self.add_type(type, ext, True) for (ext, type) in common_types.items(): self.add_type(type, ext, False) | def __init__(self, filenames=()): if not inited: init() self.encodings_map = encodings_map.copy() self.suffix_map = suffix_map.copy() self.types_map = types_map.copy() self.common_types = common_types.copy() for name in filenames: self.read(name) | 5ccaf8f1298628bea5a4c7442413f2901914f1bc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5ccaf8f1298628bea5a4c7442413f2901914f1bc/mimetypes.py |
self.read(name) def guess_type(self, url, strict=1): | self.read(name, strict) def add_type(self, type, ext, strict=True): """Add a mapping between a type and and extension. When the extension is already known, the new type will replace the old one. When the type is already known the extension will be added to the list of known extensions. If strict is true, information will be added to list of standard types, else to the list of non-standard types. """ self.types_map[strict][ext] = type exts = self.types_map_inv[strict].setdefault(type, []) if ext not in exts: exts.append(ext) def guess_type(self, url, strict=True): | def __init__(self, filenames=()): if not inited: init() self.encodings_map = encodings_map.copy() self.suffix_map = suffix_map.copy() self.types_map = types_map.copy() self.common_types = common_types.copy() for name in filenames: self.read(name) | 5ccaf8f1298628bea5a4c7442413f2901914f1bc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5ccaf8f1298628bea5a4c7442413f2901914f1bc/mimetypes.py |
Optional `strict' argument when false adds a bunch of commonly found, | Optional `strict' argument when False adds a bunch of commonly found, | def guess_type(self, url, strict=1): """Guess the type of a file based on its URL. | 5ccaf8f1298628bea5a4c7442413f2901914f1bc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5ccaf8f1298628bea5a4c7442413f2901914f1bc/mimetypes.py |
types_map = self.types_map common_types = self.common_types | types_map = self.types_map[True] | def guess_type(self, url, strict=1): """Guess the type of a file based on its URL. | 5ccaf8f1298628bea5a4c7442413f2901914f1bc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5ccaf8f1298628bea5a4c7442413f2901914f1bc/mimetypes.py |
elif ext in common_types: return common_types[ext], encoding elif ext.lower() in common_types: return common_types[ext.lower()], encoding | types_map = self.types_map[False] if ext in types_map: return types_map[ext], encoding elif ext.lower() in types_map: return types_map[ext.lower()], encoding | def guess_type(self, url, strict=1): """Guess the type of a file based on its URL. | 5ccaf8f1298628bea5a4c7442413f2901914f1bc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5ccaf8f1298628bea5a4c7442413f2901914f1bc/mimetypes.py |
def guess_extension(self, type, strict=1): | def guess_all_extensions(self, type, strict=True): """Guess the extensions for a file based on its MIME type. Return value is a list of strings giving the possible filename extensions, including the leading dot ('.'). The extension is not guaranteed to have been associated with any particular data stream, but would be mapped to the MIME type `type' by guess_type(). If no extension can be guessed for `type', None is returned. Optional `strict' argument when false adds a bunch of commonly found, but non-standard types. """ type = type.lower() extensions = self.types_map_inv[True].get(type, []) if not strict: for ext in self.types_map_inv[False].get(type, []): if ext not in extensions: extensions.append(ext) if len(extensions): return extensions def guess_extension(self, type, strict=True): | def guess_extension(self, type, strict=1): """Guess the extension for a file based on its MIME type. | 5ccaf8f1298628bea5a4c7442413f2901914f1bc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5ccaf8f1298628bea5a4c7442413f2901914f1bc/mimetypes.py |
type = type.lower() for ext, stype in self.types_map.items(): if type == stype: return ext if not strict: for ext, stype in common_types.items(): if type == stype: return ext return None def read(self, filename): """Read a single mime.types-format file, specified by pathname.""" | extensions = self.guess_all_extensions(type, strict) if extensions is not None: extensions = extensions[0] return extensions def read(self, filename, strict=True): """ Read a single mime.types-format file, specified by pathname. If strict is true, information will be added to list of standard types, else to the list of non-standard types. """ | def guess_extension(self, type, strict=1): """Guess the extension for a file based on its MIME type. | 5ccaf8f1298628bea5a4c7442413f2901914f1bc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5ccaf8f1298628bea5a4c7442413f2901914f1bc/mimetypes.py |
def readfp(self, fp): """Read a single mime.types-format file.""" map = self.types_map | def readfp(self, fp, strict=True): """ Read a single mime.types-format file. If strict is true, information will be added to list of standard types, else to the list of non-standard types. """ | def readfp(self, fp): """Read a single mime.types-format file.""" map = self.types_map while 1: line = fp.readline() if not line: break words = line.split() for i in range(len(words)): if words[i][0] == '#': del words[i:] break if not words: continue type, suffixes = words[0], words[1:] for suff in suffixes: map['.' + suff] = type | 5ccaf8f1298628bea5a4c7442413f2901914f1bc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5ccaf8f1298628bea5a4c7442413f2901914f1bc/mimetypes.py |
map['.' + suff] = type def guess_type(url, strict=1): | self.add_type(type, suff, strict) def guess_type(url, strict=True): | def readfp(self, fp): """Read a single mime.types-format file.""" map = self.types_map while 1: line = fp.readline() if not line: break words = line.split() for i in range(len(words)): if words[i][0] == '#': del words[i:] break if not words: continue type, suffixes = words[0], words[1:] for suff in suffixes: map['.' + suff] = type | 5ccaf8f1298628bea5a4c7442413f2901914f1bc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5ccaf8f1298628bea5a4c7442413f2901914f1bc/mimetypes.py |
def guess_extension(type, strict=1): | def guess_all_extensions(type, strict=True): """Guess the extensions for a file based on its MIME type. Return value is a list of strings giving the possible filename extensions, including the leading dot ('.'). The extension is not guaranteed to have been associated with any particular data stream, but would be mapped to the MIME type `type' by guess_type(). If no extension can be guessed for `type', None is returned. Optional `strict' argument when false adds a bunch of commonly found, but non-standard types. """ init() return guess_all_extensions(type, strict) def guess_extension(type, strict=True): | def guess_extension(type, strict=1): """Guess the extension for a file based on its MIME type. Return value is a string giving a filename extension, including the leading dot ('.'). The extension is not guaranteed to have been associated with any particular data stream, but would be mapped to the MIME type `type' by guess_type(). If no extension can be guessed for `type', None is returned. Optional `strict' argument when false adds a bunch of commonly found, but non-standard types. """ init() return guess_extension(type, strict) | 5ccaf8f1298628bea5a4c7442413f2901914f1bc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5ccaf8f1298628bea5a4c7442413f2901914f1bc/mimetypes.py |
global guess_extension, guess_type | global guess_all_extensions, guess_extension, guess_type | def init(files=None): global guess_extension, guess_type global suffix_map, types_map, encodings_map, common_types global inited inited = 1 db = MimeTypes() if files is None: files = knownfiles for file in files: if os.path.isfile(file): db.readfp(open(file)) encodings_map = db.encodings_map suffix_map = db.suffix_map types_map = db.types_map guess_extension = db.guess_extension guess_type = db.guess_type common_types = db.common_types | 5ccaf8f1298628bea5a4c7442413f2901914f1bc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5ccaf8f1298628bea5a4c7442413f2901914f1bc/mimetypes.py |
global inited inited = 1 | global add_type, inited inited = True | def init(files=None): global guess_extension, guess_type global suffix_map, types_map, encodings_map, common_types global inited inited = 1 db = MimeTypes() if files is None: files = knownfiles for file in files: if os.path.isfile(file): db.readfp(open(file)) encodings_map = db.encodings_map suffix_map = db.suffix_map types_map = db.types_map guess_extension = db.guess_extension guess_type = db.guess_type common_types = db.common_types | 5ccaf8f1298628bea5a4c7442413f2901914f1bc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5ccaf8f1298628bea5a4c7442413f2901914f1bc/mimetypes.py |
types_map = db.types_map | types_map = db.types_map[True] guess_all_extensions = db.guess_all_extensions | def init(files=None): global guess_extension, guess_type global suffix_map, types_map, encodings_map, common_types global inited inited = 1 db = MimeTypes() if files is None: files = knownfiles for file in files: if os.path.isfile(file): db.readfp(open(file)) encodings_map = db.encodings_map suffix_map = db.suffix_map types_map = db.types_map guess_extension = db.guess_extension guess_type = db.guess_type common_types = db.common_types | 5ccaf8f1298628bea5a4c7442413f2901914f1bc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5ccaf8f1298628bea5a4c7442413f2901914f1bc/mimetypes.py |
common_types = db.common_types | add_type = db.add_type common_types = db.types_map[False] | def init(files=None): global guess_extension, guess_type global suffix_map, types_map, encodings_map, common_types global inited inited = 1 db = MimeTypes() if files is None: files = knownfiles for file in files: if os.path.isfile(file): db.readfp(open(file)) encodings_map = db.encodings_map suffix_map = db.suffix_map types_map = db.types_map guess_extension = db.guess_extension guess_type = db.guess_type common_types = db.common_types | 5ccaf8f1298628bea5a4c7442413f2901914f1bc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5ccaf8f1298628bea5a4c7442413f2901914f1bc/mimetypes.py |
zinfo.external_attr = st[0] << 16L | zinfo.external_attr = (st[0] & 0xFFFF) << 16L | def write(self, filename, arcname=None, compress_type=None): """Put the bytes from filename into the archive under the name arcname.""" st = os.stat(filename) mtime = time.localtime(st.st_mtime) date_time = mtime[0:6] # Create ZipInfo instance to store file information if arcname is None: zinfo = ZipInfo(filename, date_time) else: zinfo = ZipInfo(arcname, date_time) zinfo.external_attr = st[0] << 16L # Unix attributes if compress_type is None: zinfo.compress_type = self.compression else: zinfo.compress_type = compress_type self._writecheck(zinfo) fp = open(filename, "rb") zinfo.flag_bits = 0x00 zinfo.header_offset = self.fp.tell() # Start of header bytes # Must overwrite CRC and sizes with correct data later zinfo.CRC = CRC = 0 zinfo.compress_size = compress_size = 0 zinfo.file_size = file_size = 0 self.fp.write(zinfo.FileHeader()) zinfo.file_offset = self.fp.tell() # Start of file bytes if zinfo.compress_type == ZIP_DEFLATED: cmpr = zlib.compressobj(zlib.Z_DEFAULT_COMPRESSION, zlib.DEFLATED, -15) else: cmpr = None while 1: buf = fp.read(1024 * 8) if not buf: break file_size = file_size + len(buf) CRC = binascii.crc32(buf, CRC) if cmpr: buf = cmpr.compress(buf) compress_size = compress_size + len(buf) self.fp.write(buf) fp.close() if cmpr: buf = cmpr.flush() compress_size = compress_size + len(buf) self.fp.write(buf) zinfo.compress_size = compress_size else: zinfo.compress_size = file_size zinfo.CRC = CRC zinfo.file_size = file_size # Seek backwards and write CRC and file sizes position = self.fp.tell() # Preserve current position in file self.fp.seek(zinfo.header_offset + 14, 0) self.fp.write(struct.pack("<lll", zinfo.CRC, zinfo.compress_size, zinfo.file_size)) self.fp.seek(position, 0) self.filelist.append(zinfo) self.NameToInfo[zinfo.filename] = zinfo | 55430213c55b74a256e0b7e3f35234249b574a9b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/55430213c55b74a256e0b7e3f35234249b574a9b/zipfile.py |
def detect_tkinter(self, inc_dirs, lib_dirs): # The _tkinter module. | 3c0aa7e7a2e5bee936d281af3bd9f99b6096325c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3c0aa7e7a2e5bee936d281af3bd9f99b6096325c/setup.py |
||
debian_tcl_include = [ '/usr/include/tcl' + version ] debian_tk_include = [ '/usr/include/tk' + version ] + \ debian_tcl_include tcl_includes = find_file('tcl.h', inc_dirs, debian_tcl_include) tk_includes = find_file('tk.h', inc_dirs, debian_tk_include) | dotversion = version if '.' not in dotversion and "bsd" in sys.platform.lower(): dotversion = dotversion[:-1] + '.' + dotversion[-1] tcl_include_sub = [] tk_include_sub = [] for dir in inc_dirs: tcl_include_sub += [dir + os.sep + "tcl" + dotversion] tk_include_sub += [dir + os.sep + "tk" + dotversion] tk_include_sub += tcl_include_sub tcl_includes = find_file('tcl.h', inc_dirs, tcl_include_sub) tk_includes = find_file('tk.h', inc_dirs, tk_include_sub) | def detect_tkinter(self, inc_dirs, lib_dirs): # The _tkinter module. | 3c0aa7e7a2e5bee936d281af3bd9f99b6096325c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3c0aa7e7a2e5bee936d281af3bd9f99b6096325c/setup.py |
self.announce("INFO: Can't locate Tcl/Tk libs and/or headers", 2) | def detect_tkinter(self, inc_dirs, lib_dirs): # The _tkinter module. | 3c0aa7e7a2e5bee936d281af3bd9f99b6096325c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3c0aa7e7a2e5bee936d281af3bd9f99b6096325c/setup.py |
|
By default, smtplib.SMTP_PORT is used. | By default, smtplib.SMTP_PORT is used. An SMTPConnectError is raised if the specified `host' doesn't respond correctly. | def __init__(self, host = '', port = 0): """Initialize a new instance. | 296e14301a7aa23a5ee2bfaa1210af54e594cbbf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/296e14301a7aa23a5ee2bfaa1210af54e594cbbf/smtplib.py |
if host: self.connect(host, port) | if host: (code, msg) = self.connect(host, port) if code != 220: raise SMTPConnectError(code, msg) | def __init__(self, host = '', port = 0): """Initialize a new instance. | 296e14301a7aa23a5ee2bfaa1210af54e594cbbf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/296e14301a7aa23a5ee2bfaa1210af54e594cbbf/smtplib.py |
return msg | return (code,msg) | def connect(self, host='localhost', port = 0): """Connect to a host on a given port. | 296e14301a7aa23a5ee2bfaa1210af54e594cbbf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/296e14301a7aa23a5ee2bfaa1210af54e594cbbf/smtplib.py |
if self.file is None: self.file = self.sock.makefile('rb') | if self.file is None: self.file = self.sock.makefile('rb') | def getreply(self): """Get a reply from the server. Returns a tuple consisting of: | 296e14301a7aa23a5ee2bfaa1210af54e594cbbf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/296e14301a7aa23a5ee2bfaa1210af54e594cbbf/smtplib.py |
if line == '': self.close() raise SMTPServerDisconnected("Connection unexpectedly closed") | if line == '': self.close() raise SMTPServerDisconnected("Connection unexpectedly closed") | def getreply(self): """Get a reply from the server. Returns a tuple consisting of: | 296e14301a7aa23a5ee2bfaa1210af54e594cbbf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/296e14301a7aa23a5ee2bfaa1210af54e594cbbf/smtplib.py |
try: errcode = string.atoi(code) except ValueError: errcode = -1 break | try: errcode = string.atoi(code) except ValueError: errcode = -1 break | def getreply(self): """Get a reply from the server. Returns a tuple consisting of: | 296e14301a7aa23a5ee2bfaa1210af54e594cbbf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/296e14301a7aa23a5ee2bfaa1210af54e594cbbf/smtplib.py |
(code,msg)=self.getreply() return code | return self.getreply() | def docmd(self, cmd, args=""): """Send a command, and return its response code.""" self.putcmd(cmd,args) (code,msg)=self.getreply() return code | 296e14301a7aa23a5ee2bfaa1210af54e594cbbf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/296e14301a7aa23a5ee2bfaa1210af54e594cbbf/smtplib.py |
return code | return (code,msg) | def helo(self, name=''): """SMTP 'helo' command. Hostname to send for this command defaults to the FQDN of the local host. """ name=string.strip(name) if len(name)==0: name=socket.gethostbyaddr(socket.gethostname())[0] self.putcmd("helo",name) (code,msg)=self.getreply() self.helo_resp=msg return code | 296e14301a7aa23a5ee2bfaa1210af54e594cbbf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/296e14301a7aa23a5ee2bfaa1210af54e594cbbf/smtplib.py |
return code | return (code,msg) | def ehlo(self, name=''): """ SMTP 'ehlo' command. Hostname to send for this command defaults to the FQDN of the local host. """ name=string.strip(name) if len(name)==0: name=socket.gethostbyaddr(socket.gethostname())[0] self.putcmd("ehlo",name) (code,msg)=self.getreply() # According to RFC1869 some (badly written) # MTA's will disconnect on an ehlo. Toss an exception if # that happens -ddm if code == -1 and len(msg) == 0: raise SMTPServerDisconnected("Server not connected") self.ehlo_resp=msg if code<>250: return code self.does_esmtp=1 #parse the ehlo responce -ddm resp=string.split(self.ehlo_resp,'\n') del resp[0] for each in resp: m=re.match(r'(?P<feature>[A-Za-z0-9][A-Za-z0-9\-]*)',each) if m: feature=string.lower(m.group("feature")) params=string.strip(m.string[m.end("feature"):]) self.esmtp_features[feature]=params return code | 296e14301a7aa23a5ee2bfaa1210af54e594cbbf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/296e14301a7aa23a5ee2bfaa1210af54e594cbbf/smtplib.py |
return code | return (code,msg) | def ehlo(self, name=''): """ SMTP 'ehlo' command. Hostname to send for this command defaults to the FQDN of the local host. """ name=string.strip(name) if len(name)==0: name=socket.gethostbyaddr(socket.gethostname())[0] self.putcmd("ehlo",name) (code,msg)=self.getreply() # According to RFC1869 some (badly written) # MTA's will disconnect on an ehlo. Toss an exception if # that happens -ddm if code == -1 and len(msg) == 0: raise SMTPServerDisconnected("Server not connected") self.ehlo_resp=msg if code<>250: return code self.does_esmtp=1 #parse the ehlo responce -ddm resp=string.split(self.ehlo_resp,'\n') del resp[0] for each in resp: m=re.match(r'(?P<feature>[A-Za-z0-9][A-Za-z0-9\-]*)',each) if m: feature=string.lower(m.group("feature")) params=string.strip(m.string[m.end("feature"):]) self.esmtp_features[feature]=params return code | 296e14301a7aa23a5ee2bfaa1210af54e594cbbf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/296e14301a7aa23a5ee2bfaa1210af54e594cbbf/smtplib.py |
(code,msg)=self.getreply() return msg | return self.getreply() | def help(self, args=''): """SMTP 'help' command. Returns help text from server.""" self.putcmd("help", args) (code,msg)=self.getreply() return msg | 296e14301a7aa23a5ee2bfaa1210af54e594cbbf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/296e14301a7aa23a5ee2bfaa1210af54e594cbbf/smtplib.py |
code=self.docmd("rset") return code | return self.docmd("rset") | def rset(self): """SMTP 'rset' command -- resets session.""" code=self.docmd("rset") return code | 296e14301a7aa23a5ee2bfaa1210af54e594cbbf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/296e14301a7aa23a5ee2bfaa1210af54e594cbbf/smtplib.py |
code=self.docmd("noop") return code | return self.docmd("noop") | def noop(self): """SMTP 'noop' command -- doesn't do anything :>""" code=self.docmd("noop") return code | 296e14301a7aa23a5ee2bfaa1210af54e594cbbf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/296e14301a7aa23a5ee2bfaa1210af54e594cbbf/smtplib.py |
return -1 | raise SMTPDataError(code,repl) | def data(self,msg): """SMTP 'DATA' command -- sends message data to server. Automatically quotes lines beginning with a period per rfc821. """ self.putcmd("data") (code,repl)=self.getreply() if self.debuglevel >0 : print "data:", (code,repl) if code <> 354: return -1 else: self.send(quotedata(msg)) self.send("%s.%s" % (CRLF, CRLF)) (code,msg)=self.getreply() if self.debuglevel >0 : print "data:", (code,msg) return code | 296e14301a7aa23a5ee2bfaa1210af54e594cbbf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/296e14301a7aa23a5ee2bfaa1210af54e594cbbf/smtplib.py |
return code | return (code,msg) | def data(self,msg): """SMTP 'DATA' command -- sends message data to server. Automatically quotes lines beginning with a period per rfc821. """ self.putcmd("data") (code,repl)=self.getreply() if self.debuglevel >0 : print "data:", (code,repl) if code <> 354: return -1 else: self.send(quotedata(msg)) self.send("%s.%s" % (CRLF, CRLF)) (code,msg)=self.getreply() if self.debuglevel >0 : print "data:", (code,msg) return code | 296e14301a7aa23a5ee2bfaa1210af54e594cbbf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/296e14301a7aa23a5ee2bfaa1210af54e594cbbf/smtplib.py |
one recipient. Otherwise it will throw an exception (either SMTPSenderRefused, SMTPRecipientsRefused, or SMTPDataError) That is, if this method does not throw an exception, then someone should get your mail. If this method does not throw an exception, it returns a dictionary, with one entry for each recipient that was refused. | one recipient. It returns a dictionary, with one entry for each recipient that was refused. Each entry contains a tuple of the SMTP error code and the accompanying error message sent by the server. This method may raise the following exceptions: SMTPHeloError The server didn't reply properly to the helo greeting. SMTPRecipientsRefused The server rejected for ALL recipients (no mail was sent). SMTPSenderRefused The server didn't accept the from_addr. SMTPDataError The server replied with an unexpected error code (other than a refusal of a recipient). Note: the connection will be open even after an exception is raised. | def sendmail(self, from_addr, to_addrs, msg, mail_options=[], rcpt_options=[]): """This command performs an entire mail transaction. | 296e14301a7aa23a5ee2bfaa1210af54e594cbbf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/296e14301a7aa23a5ee2bfaa1210af54e594cbbf/smtplib.py |
if not self.helo_resp and not self.ehlo_resp: if self.ehlo() >= 400: self.helo() | if self.helo_resp is None and self.ehlo_resp is None: if not (200 <= self.ehlo()[0] <= 299): (code,resp) = self.helo() if not (200 <= code <= 299): raise SMTPHeloError(code, resp) | def sendmail(self, from_addr, to_addrs, msg, mail_options=[], rcpt_options=[]): """This command performs an entire mail transaction. | 296e14301a7aa23a5ee2bfaa1210af54e594cbbf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/296e14301a7aa23a5ee2bfaa1210af54e594cbbf/smtplib.py |
raise SMTPSenderRefused('%s: %s' % (from_addr, resp)) | raise SMTPSenderRefused(code, resp, from_addr) | def sendmail(self, from_addr, to_addrs, msg, mail_options=[], rcpt_options=[]): """This command performs an entire mail transaction. | 296e14301a7aa23a5ee2bfaa1210af54e594cbbf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/296e14301a7aa23a5ee2bfaa1210af54e594cbbf/smtplib.py |
raise SMTPRecipientsRefused(string.join( map(lambda x:"%s: %s" % (x[0], x[1][1]), senderrs.items()), '; ')) code=self.data(msg) if code <>250 : | raise SMTPRecipientsRefused(senderrs) (code,resp)=self.data(msg) if code <> 250: | def sendmail(self, from_addr, to_addrs, msg, mail_options=[], rcpt_options=[]): """This command performs an entire mail transaction. | 296e14301a7aa23a5ee2bfaa1210af54e594cbbf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/296e14301a7aa23a5ee2bfaa1210af54e594cbbf/smtplib.py |
raise SMTPDataError('data transmission error: %s' % code) | raise SMTPDataError(code, resp) | def sendmail(self, from_addr, to_addrs, msg, mail_options=[], rcpt_options=[]): """This command performs an entire mail transaction. | 296e14301a7aa23a5ee2bfaa1210af54e594cbbf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/296e14301a7aa23a5ee2bfaa1210af54e594cbbf/smtplib.py |
def _ipaddress(str): if type(str) == type(1): return str # Already numeric ptr = macdnr.StrToAddr(str) ptr.wait() return ptr.ip0 | cd259d0b401f8cdd859bd55167610230d9a44f5d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/cd259d0b401f8cdd859bd55167610230d9a44f5d/socket.py |
||
def gethostbyname(str): id = _ipaddress(str) return macdnr.AddrToStr(id) | cd259d0b401f8cdd859bd55167610230d9a44f5d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/cd259d0b401f8cdd859bd55167610230d9a44f5d/socket.py |
||
def _gethostaddress(): global _myaddrstr if _myaddrstr == None: id = _myipaddress() _myaddrstr = macdnr.AddrToStr(id) return _myaddrstr | cd259d0b401f8cdd859bd55167610230d9a44f5d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/cd259d0b401f8cdd859bd55167610230d9a44f5d/socket.py |
||
raise my_error, 'Protocol family not supported' | raise my_error, 'Protocol family %d not supported' % type | def socket(family, type, *which): if family <> AF_INET: raise my_error, 'Protocol family not supported' if type == SOCK_DGRAM: return _udpsocket() elif type == SOCK_STREAM: return _tcpsocket() raise my_error, 'Protocol type not supported' | cd259d0b401f8cdd859bd55167610230d9a44f5d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/cd259d0b401f8cdd859bd55167610230d9a44f5d/socket.py |
raise my_error, 'Protocol type not supported' | raise my_error, 'Protocol type %d not supported' % type | def socket(family, type, *which): if family <> AF_INET: raise my_error, 'Protocol family not supported' if type == SOCK_DGRAM: return _udpsocket() elif type == SOCK_STREAM: return _tcpsocket() raise my_error, 'Protocol type not supported' | cd259d0b401f8cdd859bd55167610230d9a44f5d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/cd259d0b401f8cdd859bd55167610230d9a44f5d/socket.py |
def fromfd(*args): raise my_error, 'Operation not supported on a mac' | cd259d0b401f8cdd859bd55167610230d9a44f5d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/cd259d0b401f8cdd859bd55167610230d9a44f5d/socket.py |
||
def accept(self, *args): | def unsupported(self, *args): | def accept(self, *args): raise my_error, 'Operation not supported on this socket' | cd259d0b401f8cdd859bd55167610230d9a44f5d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/cd259d0b401f8cdd859bd55167610230d9a44f5d/socket.py |
bind = accept close = accept connect = accept fileno = accept getpeername = accept getsockname = accept getsockopt = accept listen = accept recv = accept recvfrom = accept send = accept sendto = accept setblocking = accept setsockopt = accept shutdown = accept | accept = unsupported bind = unsupported close = unsupported connect = unsupported fileno = unsupported getpeername = unsupported getsockname = unsupported getsockopt = unsupported listen = unsupported recv = unsupported recvfrom = unsupported send = unsupported sendto = unsupported setblocking = unsupported setsockopt = unsupported shutdown = unsupported | def accept(self, *args): raise my_error, 'Operation not supported on this socket' | cd259d0b401f8cdd859bd55167610230d9a44f5d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/cd259d0b401f8cdd859bd55167610230d9a44f5d/socket.py |
def bind(self, host, port): | def bind(self, a1, a2=None): if a2 is None: host, port = a1 else: host, port = a1, a2 | def accept(self): if not self.listening: raise my_error, 'Not listening' self.listening = 0 self.stream.wait() self.accepted = 1 return self, self.getsockname() | cd259d0b401f8cdd859bd55167610230d9a44f5d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/cd259d0b401f8cdd859bd55167610230d9a44f5d/socket.py |
def connect(self, host, port): | def connect(self, a1, a2=None): if a2 is None: host, port = a1 else: host, port = a1, a2 | def close(self): if self.accepted: self.accepted = 0 return self.stream.Abort() | cd259d0b401f8cdd859bd55167610230d9a44f5d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/cd259d0b401f8cdd859bd55167610230d9a44f5d/socket.py |
def makefile(self, rw): return _socketfile(self) | def makefile(self, rw = 'r'): return _socketfile(self, rw) | def makefile(self, rw): return _socketfile(self) | cd259d0b401f8cdd859bd55167610230d9a44f5d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/cd259d0b401f8cdd859bd55167610230d9a44f5d/socket.py |
def bytes_writeable(self): st = self.stream.Status() return st.sendWindow - st.sendUnacked; | cd259d0b401f8cdd859bd55167610230d9a44f5d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/cd259d0b401f8cdd859bd55167610230d9a44f5d/socket.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.