rem stringlengths 1 322k | add stringlengths 0 2.05M | context stringlengths 4 228k | meta stringlengths 156 215 |
|---|---|---|---|
best = shift, bin1, bin2 | best = t1, t2, shift | def splitbins(bins): # split a sparse integer table into two tables, such as: # value = t2[(t1[char>>shift]<<shift)+(char&mask)] # and value == 0 means no data bytes = sys.maxint for shift in range(16): bin1 = [] bin2 = [] size = 2**shift bincache = {} for i in range(0, len(bins), size): bin = bins[i:i+size] index = ... | ba0a5af15315f108f3e529a396b83d1a2395f027 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ba0a5af15315f108f3e529a396b83d1a2395f027/makeunicodedata.py |
shift, bin1, bin2 = best return bin1, bin2, shift | t1, t2, shift = best if trace: print >>sys.stderr, "Best:", dump(t1, t2, shift, bytes) if __debug__: mask = ~((~0) << shift) for i in xrange(len(t)): assert t[i] == t2[(t1[i >> shift] << shift) + (i & mask)] return best | def splitbins(bins): # split a sparse integer table into two tables, such as: # value = t2[(t1[char>>shift]<<shift)+(char&mask)] # and value == 0 means no data bytes = sys.maxint for shift in range(16): bin1 = [] bin2 = [] size = 2**shift bincache = {} for i in range(0, len(bins), size): bin = bins[i:i+size] index = ... | ba0a5af15315f108f3e529a396b83d1a2395f027 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/ba0a5af15315f108f3e529a396b83d1a2395f027/makeunicodedata.py |
def check_close(x, y): | def check_close_real(x, y, eps=1e-9): """Return true iff floats x and y "are close\"""" if abs(x) > abs(y): x, y = y, x if y == 0: return abs(x) < eps if x == 0: return abs(y) < eps return abs((x-y)/y) < eps def check_close(x, y, eps=1e-9): | def check_close(x, y): """Return true iff complexes x and y "are close\"""" return fcmp(x.real, y.real) == 0 == fcmp(x.imag, y.imag) | 1be4d329953096d55ee7b70f044795d9a2f0defc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1be4d329953096d55ee7b70f044795d9a2f0defc/test_complex.py |
return fcmp(x.real, y.real) == 0 == fcmp(x.imag, y.imag) | return check_close_real(x.real, y.real, eps) and \ check_close_real(x.imag, y.imag, eps) | def check_close(x, y): """Return true iff complexes x and y "are close\"""" return fcmp(x.real, y.real) == 0 == fcmp(x.imag, y.imag) | 1be4d329953096d55ee7b70f044795d9a2f0defc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/1be4d329953096d55ee7b70f044795d9a2f0defc/test_complex.py |
parent and parent.__path__) | parent and parent.__path__, parent) | def import_module(self, partname, fqname, parent): self.msgin(3, "import_module", partname, fqname, parent) try: m = self.modules[fqname] except KeyError: pass else: self.msgout(3, "import_module ->", m) return m if self.badmodules.has_key(fqname): self.msgout(3, "import_module -> None") return None try: fp, pathname, ... | 266dd121094987f18949fbd2a6ecd90f70464bd6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/266dd121094987f18949fbd2a6ecd90f70464bd6/modulefinder.py |
def find_module(self, name, path): if path: fullname = '.'.join(path)+'.'+name | def find_module(self, name, path, parent=None): if parent is not None: fullname = parent.__name__+'.'+name | def find_module(self, name, path): if path: fullname = '.'.join(path)+'.'+name else: fullname = name if fullname in self.excludes: self.msgout(3, "find_module -> Excluded", fullname) raise ImportError, name | 266dd121094987f18949fbd2a6ecd90f70464bd6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/266dd121094987f18949fbd2a6ecd90f70464bd6/modulefinder.py |
print 'ParsedDate:', time.asctime(date[:-1]), hhmmss = date[-1] | print 'ParsedDate:', time.asctime(date), hhmmss = tz | def formatdate(timeval=None): """Returns time format preferred for Internet standards. Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123 """ if timeval is None: timeval = time.time() return "%s" % time.strftime('%a, %d %b %Y %H:%M:%S GMT', time.gmtime(timeval)) | a7fee7e7d95fb72ea092bb114661f5cae51b8d41 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a7fee7e7d95fb72ea092bb114661f5cae51b8d41/rfc822.py |
r'(?P<option>[-\w_.*,(){}]+)' | r'(?P<option>[]\-[\w_.*,(){}]+)' | def remove_section(self, section): """Remove a file section.""" if self.__sections.has_key(section): del self.__sections[section] return 1 else: return 0 | f644844a0264ba314ef8689e5a0f3a924b6e7bc0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f644844a0264ba314ef8689e5a0f3a924b6e7bc0/ConfigParser.py |
super(TimeRE,self).__init__({ | base = super(TimeRE, self) base.__init__({ | def __init__(self, locale_time=LocaleTime()): """Init inst with non-locale regexes and store LocaleTime object.""" # XXX: should 0 be valid for: # day (d), julian day (j), month (m), and hour12 (I)? super(TimeRE,self).__init__({ # The " \d" option is to make %c from ANSI C work 'd': r"(?P<d>3[0-1]|[0-2]\d|\d| ... | b674d2225fd4b2252f0b400204bb7667857bc9ef /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b674d2225fd4b2252f0b400204bb7667857bc9ef/_strptime.py |
'd': r"(?P<d>3[0-1]|[0-2]\d|\d| \d)", | 'd': r"(?P<d>3[0-1]|[1-2]\d|0[1-9]|[1-9]| [1-9])", | def __init__(self, locale_time=LocaleTime()): """Init inst with non-locale regexes and store LocaleTime object.""" # XXX: should 0 be valid for: # day (d), julian day (j), month (m), and hour12 (I)? super(TimeRE,self).__init__({ # The " \d" option is to make %c from ANSI C work 'd': r"(?P<d>3[0-1]|[0-2]\d|\d| ... | b674d2225fd4b2252f0b400204bb7667857bc9ef /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b674d2225fd4b2252f0b400204bb7667857bc9ef/_strptime.py |
'I': r"(?P<I>0\d|1[0-2]|\d)", 'j': r"(?P<j>(?:3[0-5]\d|36[0-6])|[0-2]\d\d|\d\d|\d)", 'm': r"(?P<m>0\d|1[0-2]|\d)", | 'I': r"(?P<I>1[0-2]|0[1-9]|[1-9])", 'j': r"(?P<j>36[0-6]|3[0-5]\d|[1-2]\d\d|0[1-9]\d|00[1-9]|[1-9]\d|0[1-9]|[1-9])", 'm': r"(?P<m>1[0-2]|0[1-9]|[1-9])", | def __init__(self, locale_time=LocaleTime()): """Init inst with non-locale regexes and store LocaleTime object.""" # XXX: should 0 be valid for: # day (d), julian day (j), month (m), and hour12 (I)? super(TimeRE,self).__init__({ # The " \d" option is to make %c from ANSI C work 'd': r"(?P<d>3[0-1]|[0-2]\d|\d| ... | b674d2225fd4b2252f0b400204bb7667857bc9ef /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b674d2225fd4b2252f0b400204bb7667857bc9ef/_strptime.py |
'W': r"(?P<W>5[0-3]|[0-4]\d|\d)", | def __init__(self, locale_time=LocaleTime()): """Init inst with non-locale regexes and store LocaleTime object.""" # XXX: should 0 be valid for: # day (d), julian day (j), month (m), and hour12 (I)? super(TimeRE,self).__init__({ # The " \d" option is to make %c from ANSI C work 'd': r"(?P<d>3[0-1]|[0-2]\d|\d| ... | b674d2225fd4b2252f0b400204bb7667857bc9ef /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b674d2225fd4b2252f0b400204bb7667857bc9ef/_strptime.py | |
c = cmp(dict1, dict2) | if random.random() < 0.5: c = cmp(dict1, dict2) else: c = dict1 == dict2 | def test_one(n): global mutate, dict1, dict2, dict1keys, dict2keys # Fill the dicts without mutating them. mutate = 0 dict1keys = fill_dict(dict1, range(n), n) dict2keys = fill_dict(dict2, range(n), n) # Enable mutation, then compare the dicts so long as they have the # same size. mutate = 1 if verbose: print "trying... | fd24e02b0349c9933ec566a46681a4d25d9a2605 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/fd24e02b0349c9933ec566a46681a4d25d9a2605/test_mutants.py |
try: class C(object, Classic): pass except TypeError: pass else: verify(0, "inheritance from object and Classic should be illegal") | def errors(): if verbose: print "Testing errors..." try: class C(list, dict): pass except TypeError: pass else: verify(0, "inheritance from both list and dict should be illegal") try: class C(object, None): pass except TypeError: pass else: verify(0, "inheritance from non-type should be illegal") class Classic: pass ... | f45c9e0c5648c523a02313ccb2f245e392ab0ad2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f45c9e0c5648c523a02313ccb2f245e392ab0ad2/test_descr.py | |
posix = True | posix = False | def isdev(self): return self.type in (CHRTYPE, BLKTYPE, FIFOTYPE) | a0045b98e354c48e89faa826a5a35db79a0ed363 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a0045b98e354c48e89faa826a5a35db79a0ed363/tarfile.py |
tarinfo.size = statres.st_size | tarinfo.size = not stat.S_ISDIR(stmd) and statres.st_size or 0 | def gettarinfo(self, name=None, arcname=None, fileobj=None): """Create a TarInfo object for either the file `name' or the file object `fileobj' (using os.fstat on its file descriptor). You can modify some of the TarInfo's attributes before you add it using addfile(). If given, `arcname' specifies an alternative name fo... | a0045b98e354c48e89faa826a5a35db79a0ed363 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a0045b98e354c48e89faa826a5a35db79a0ed363/tarfile.py |
m235 to share a single generator". Unfortunately, using generators this way creates a reference-cycle that the garbage collector (currently) can't clean up, so we have to explicitly break the cycle (by calling the inner generator's close() method) | m235 to share a single generator". | ... def tail(g): | 79d08acd5bd9202d73755c1c590660d0a80b44f5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/79d08acd5bd9202d73755c1c590660d0a80b44f5/test_generators.py |
... return m1.close, mRes >>> closer, it = m235() | ... return mRes >>> it = m235() | ... def _m235(): | 79d08acd5bd9202d73755c1c590660d0a80b44f5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/79d08acd5bd9202d73755c1c590660d0a80b44f5/test_generators.py |
>>> closer() | ... def _m235(): | 79d08acd5bd9202d73755c1c590660d0a80b44f5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/79d08acd5bd9202d73755c1c590660d0a80b44f5/test_generators.py | |
are quite straightforwardly expressed with this Python idiom. The problem is that this creates an uncollectable reference cycle, and we have to explicitly close the innermost generator to clean up the cycle. XXX As of 14-Apr-2006, Tim doubts that anyone understands _why_ some cycle XXX is uncollectable here. | are quite straightforwardly expressed with this Python idiom. | ... def _m235(): | 79d08acd5bd9202d73755c1c590660d0a80b44f5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/79d08acd5bd9202d73755c1c590660d0a80b44f5/test_generators.py |
... return realfib.close, fibRes >>> closer, fibber = fib() >>> firstn(fibber, 17) | ... return fibRes >>> firstn(fib(), 17) | ... def _fib(): | 79d08acd5bd9202d73755c1c590660d0a80b44f5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/79d08acd5bd9202d73755c1c590660d0a80b44f5/test_generators.py |
>>> closer() XXX Again the tee-based approach leaks without an explicit close(). | ... def _fib(): | 79d08acd5bd9202d73755c1c590660d0a80b44f5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/79d08acd5bd9202d73755c1c590660d0a80b44f5/test_generators.py | |
elif self.header_encoding is QP: | elif self.body_encoding is QP: | def body_encode(self, s, convert=True): """Body-encode a string and convert it to output_charset. | c50b5bd2a01efe645d4ca529c61f690cfd094bda /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c50b5bd2a01efe645d4ca529c61f690cfd094bda/Charset.py |
for (extension_name, build_info) in extensions: | for (extension_name, build_info) in self.extensions: | def get_source_files (self): | b2539c8971ee7e652d1b9fea5072b920da313f2a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b2539c8971ee7e652d1b9fea5072b920da313f2a/build_ext.py |
if sources is None or type (sources) is not ListType: | if sources is None or type (sources) not in (ListType, TupleType): | def build_extensions (self, extensions): | b2539c8971ee7e652d1b9fea5072b920da313f2a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b2539c8971ee7e652d1b9fea5072b920da313f2a/build_ext.py |
includes=include_dirs) | include_dirs=include_dirs) | def build_extensions (self, extensions): | b2539c8971ee7e652d1b9fea5072b920da313f2a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/b2539c8971ee7e652d1b9fea5072b920da313f2a/build_ext.py |
mro_err_msg = """Cannot create class.The superclasses have conflicting inheritance trees which leave the method resolution order (MRO) undefined for bases """ | mro_err_msg = """Cannot create a consistent method resolution order (MRO) for bases """ | def consistency_with_epg(): if verbose: print "Testing consistentcy with EPG..." class Pane(object): pass class ScrollingMixin(object): pass class EditingMixin(object): pass class ScrollablePane(Pane,ScrollingMixin): pass class EditablePane(Pane,EditingMixin): pass class EditableScrollablePane(ScrollablePane,EditablePa... | e4b01131ec0f5230cc5625421c4e7ef105bea6e0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e4b01131ec0f5230cc5625421c4e7ef105bea6e0/test_descr.py |
pass return '?' | if not self.lseen: if not self.rseen: return '0' else: return 'N' else: if not self.rseen: return '?' if self.lsum == self.rsum: return 'c' else: return 'C' else: if not self.lseen: if self.eremoved: if self.rseen: return 'R' else: return 'r' else: if self.rseen: print "warning:", print self.file, print "was lost" ret... | def action(self): """Return a code indicating the update status of this file. | 5a1b248749b50df288abfb5e14debdf65076f3c4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5a1b248749b50df288abfb5e14debdf65076f3c4/rcvs.py |
self.cvs.report() | for file in files: print self.cvs.entries[file].action(), file | def default(self): files = [] if self.cvs.checkfiles(files): return 1 self.cvs.report() | 5a1b248749b50df288abfb5e14debdf65076f3c4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5a1b248749b50df288abfb5e14debdf65076f3c4/rcvs.py |
if not self.entries[file].commitcheck(): | if not self.cvs.entries[file].commitcheck(): | def do_commit(self, opts, files): """commit [file] ...""" if self.cvs.checkfiles(files): return 1 sts = 0 for file in files: if not self.entries[file].commitcheck(): sts = 1 if sts: return sts message = raw_input("One-liner: ") for file in files: self.entries[file].commit(message) | 5a1b248749b50df288abfb5e14debdf65076f3c4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5a1b248749b50df288abfb5e14debdf65076f3c4/rcvs.py |
self.entries[file].commit(message) | self.cvs.entries[file].commit(message) self.cvs.putentries() | def do_commit(self, opts, files): """commit [file] ...""" if self.cvs.checkfiles(files): return 1 sts = 0 for file in files: if not self.entries[file].commitcheck(): sts = 1 if sts: return sts message = raw_input("One-liner: ") for file in files: self.entries[file].commit(message) | 5a1b248749b50df288abfb5e14debdf65076f3c4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5a1b248749b50df288abfb5e14debdf65076f3c4/rcvs.py |
nframes = self.calcnframes() | nframes = self.calcnframes(memsize) | def burst_capture(self): self.setwatch() gl.winset(self.window) x, y = gl.getsize() if self.use_24: fl.show_message('Sorry, no 24 bit continuous capture yet', '', '') return vformat = SV.RGB8_FRAMES nframes = self.getint(self.in_nframes, 0) if nframes == 0: maxmem = self.getint(self.in_maxmem, 1.0) memsize = int(maxmem... | af1258bd3d8b05060c959b503e0ffd2f70a20d23 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/af1258bd3d8b05060c959b503e0ffd2f70a20d23/Vb.py |
def calcnframes(self): | def calcnframes(self, memsize): | def calcnframes(self): gl.winset(self.window) x, y = gl.getsize() pixels = x*y pixels = pixels/2 # XXX always assume fields if self.mono or self.grey: n = memsize/pixels else: n = memsize/(4*pixels) return max(1, n) | af1258bd3d8b05060c959b503e0ffd2f70a20d23 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/af1258bd3d8b05060c959b503e0ffd2f70a20d23/Vb.py |
size = stats[stat.ST_SIZE] modified = rfc822.formatdate(stats[stat.ST_MTIME]) | size = stats.st_size modified = rfc822.formatdate(stats.st_mtime) | def open_local_file(self, req): host = req.get_host() file = req.get_selector() localfile = url2pathname(file) stats = os.stat(localfile) size = stats[stat.ST_SIZE] modified = rfc822.formatdate(stats[stat.ST_MTIME]) mtype = mimetypes.guess_type(file)[0] stats = os.stat(localfile) headers = mimetools.Message(StringIO( '... | 3a533c1943898d1de5ca8ff60efaa1d1ec72aa64 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/3a533c1943898d1de5ca8ff60efaa1d1ec72aa64/urllib2.py |
stats = os.stat(localfile) | def open_local_file(self, req): host = req.get_host() file = req.get_selector() localfile = url2pathname(file) stats = os.stat(localfile) size = stats[stat.ST_SIZE] modified = rfc822.formatdate(stats[stat.ST_MTIME]) mtype = mimetypes.guess_type(file)[0] stats = os.stat(localfile) headers = mimetools.Message(StringIO( '... | 3a533c1943898d1de5ca8ff60efaa1d1ec72aa64 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/3a533c1943898d1de5ca8ff60efaa1d1ec72aa64/urllib2.py | |
def index(dir): """Return a list of (module-name, synopsis) pairs for a directory tree.""" results = [] for entry in os.listdir(dir): path = os.path.join(dir, entry) if ispackage(path): results.extend(map( lambda (m, s), pkg=entry: (pkg + '.' + m, s), index(path))) elif os.path.isfile(path) and entry[-3:] == '.py': res... | def index(dir): """Return a list of (module-name, synopsis) pairs for a directory tree.""" results = [] for entry in os.listdir(dir): path = os.path.join(dir, entry) if ispackage(path): results.extend(map( lambda (m, s), pkg=entry: (pkg + '.' + m, s), index(path))) elif os.path.isfile(path) and entry[-3:] == '.py': res... | c8867551cbacbd399ba1d7b4ce3738d629629967 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c8867551cbacbd399ba1d7b4ce3738d629629967/pydoc.py | |
elif lower(filename[-4:]) == '.pyc': | elif lower(filename[-4:]) in ['.pyc', '.pyd', '.pyo']: | def modulename(path): """Return the Python module name for a given path, or None.""" filename = os.path.basename(path) if lower(filename[-3:]) == '.py': return filename[:-3] elif lower(filename[-4:]) == '.pyc': return filename[:-4] elif lower(filename[-11:]) == 'module.so': return filename[:-11] elif lower(filename[-13... | c8867551cbacbd399ba1d7b4ce3738d629629967 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c8867551cbacbd399ba1d7b4ce3738d629629967/pydoc.py |
if inspect.ismethod(object): return apply(self.docmethod, args) if inspect.isbuiltin(object): return apply(self.docbuiltin, args) if inspect.isfunction(object): return apply(self.docfunction, args) | if inspect.isroutine(object): return apply(self.docroutine, args) | def document(self, object, *args): """Generate documentation for an object.""" args = (object,) + args if inspect.ismodule(object): return apply(self.docmodule, args) if inspect.isclass(object): return apply(self.docclass, args) if inspect.ismethod(object): return apply(self.docmethod, args) if inspect.isbuiltin(object... | c8867551cbacbd399ba1d7b4ce3738d629629967 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c8867551cbacbd399ba1d7b4ce3738d629629967/pydoc.py |
<tr bgcolor="%s"><td colspan=3 valign=bottom><small><small><br></small></small ><font color="%s" face="helvetica, arial"> %s</font></td | <tr bgcolor="%s"><td> </td> <td valign=bottom><small><small><br></small></small ><font color="%s" face="helvetica"><br> %s</font></td | def heading(self, title, fgcol, bgcol, extras=''): """Format a page heading.""" return """ | c8867551cbacbd399ba1d7b4ce3738d629629967 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c8867551cbacbd399ba1d7b4ce3738d629629967/pydoc.py |
><font color="%s" face="helvetica, arial"> %s</font></td></tr></table> """ % (bgcol, fgcol, title, fgcol, extras) | ><font color="%s" face="helvetica">%s</font></td><td> </td></tr></table> """ % (bgcol, fgcol, title, fgcol, extras or ' ') | def heading(self, title, fgcol, bgcol, extras=''): """Format a page heading.""" return """ | c8867551cbacbd399ba1d7b4ce3738d629629967 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c8867551cbacbd399ba1d7b4ce3738d629629967/pydoc.py |
<tr bgcolor="%s"><td colspan=3 valign=bottom><small><small><br></small></small | <tr bgcolor="%s"><td rowspan=2> </td> <td colspan=3 valign=bottom><small><small><br></small></small | def section(self, title, fgcol, bgcol, contents, width=20, prelude='', marginalia=None, gap=' '): """Format a section with a heading.""" if marginalia is None: marginalia = ' ' * width result = """ | c8867551cbacbd399ba1d7b4ce3738d629629967 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c8867551cbacbd399ba1d7b4ce3738d629629967/pydoc.py |
def footer(self): return """ <table width="100%"><tr><td align=right> <font face="helvetica, arial"><small><small>generated with <strong>htmldoc</strong> by Ka-Ping Yee</a></small></small></font> </td></tr></table> """ | def bigsection(self, title, *args): """Format a section with a big heading.""" title = '<big><strong>%s</strong></big>' % title return apply(self.section, (title,) + args) | c8867551cbacbd399ba1d7b4ce3738d629629967 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c8867551cbacbd399ba1d7b4ce3738d629629967/pydoc.py | |
result = '' head = '<br><big><big><strong> %s</strong></big></big>' % name | parts = split(name, '.') links = [] for i in range(len(parts)-1): links.append( '<a href="%s.html"><font color=" (join(parts[:i+1], '.'), parts[i])) linkedname = join(links + parts[-1:], '.') head = '<big><big><strong>%s</strong></big></big>' % linkedname | def docmodule(self, object): """Produce HTML documentation for a module object.""" name = object.__name__ result = '' head = '<br><big><big><strong> %s</strong></big></big>' % name try: path = os.path.abspath(inspect.getfile(object)) filelink = '<a href="file:%s">%s</a>' % (path, path) except TypeError: filelink =... | c8867551cbacbd399ba1d7b4ce3738d629629967 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c8867551cbacbd399ba1d7b4ce3738d629629967/pydoc.py |
result = result + self.heading( | result = self.heading( | def docmodule(self, object): """Produce HTML documentation for a module object.""" name = object.__name__ result = '' head = '<br><big><big><strong> %s</strong></big></big>' % name try: path = os.path.abspath(inspect.getfile(object)) filelink = '<a href="file:%s">%s</a>' % (path, path) except TypeError: filelink =... | c8867551cbacbd399ba1d7b4ce3738d629629967 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c8867551cbacbd399ba1d7b4ce3738d629629967/pydoc.py |
if doc: doc = '<small><tt>' + doc + '<br> </tt></small>' | if doc: doc = '<small><tt>' + doc + '</tt></small>' | def docclass(self, object, funcs={}, classes={}): """Produce HTML documentation for a class object.""" name = object.__name__ bases = object.__bases__ contents = '' | c8867551cbacbd399ba1d7b4ce3738d629629967 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c8867551cbacbd399ba1d7b4ce3738d629629967/pydoc.py |
def docmethod(self, object, funcs={}, classes={}, methods={}, clname=''): """Produce HTML documentation for a method object.""" return self.document( object.im_func, funcs, classes, methods, clname) | def docclass(self, object, funcs={}, classes={}): """Produce HTML documentation for a class object.""" name = object.__name__ bases = object.__bases__ contents = '' | c8867551cbacbd399ba1d7b4ce3738d629629967 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c8867551cbacbd399ba1d7b4ce3738d629629967/pydoc.py | |
def docfunction(self, object, funcs={}, classes={}, methods={}, clname=''): """Produce HTML documentation for a function object.""" args, varargs, varkw, defaults = inspect.getargspec(object) argspec = inspect.formatargspec( args, varargs, varkw, defaults, formatvalue=self.formatvalue) if object.__name__ == '<lambda>'... | def docroutine(self, object, funcs={}, classes={}, methods={}, clname=''): """Produce HTML documentation for a function or method object.""" if inspect.ismethod(object): object = object.im_func if inspect.isbuiltin(object): decl = '<a name="%s"><strong>%s</strong>(...)</a>\n' % ( clname + '-' + object.__name__, object.... | def docfunction(self, object, funcs={}, classes={}, methods={}, clname=''): """Produce HTML documentation for a function object.""" args, varargs, varkw, defaults = inspect.getargspec(object) argspec = inspect.formatargspec( args, varargs, varkw, defaults, formatvalue=self.formatvalue) | c8867551cbacbd399ba1d7b4ce3738d629629967 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c8867551cbacbd399ba1d7b4ce3738d629629967/pydoc.py |
anchor = clname + '-' + object.__name__ decl = '<a name="%s"\n><strong>%s</strong>%s</a>\n' % ( anchor, object.__name__, argspec) | args, varargs, varkw, defaults = inspect.getargspec(object) argspec = inspect.formatargspec( args, varargs, varkw, defaults, formatvalue=self.formatvalue) if object.__name__ == '<lambda>': decl = '<em>lambda</em> ' + argspec[1:-1] else: anchor = clname + '-' + object.__name__ decl = '<a name="%s"\n><strong>%s</strong>... | def docfunction(self, object, funcs={}, classes={}, methods={}, clname=''): """Produce HTML documentation for a function object.""" args, varargs, varkw, defaults = inspect.getargspec(object) argspec = inspect.formatargspec( args, varargs, varkw, defaults, formatvalue=self.formatvalue) | c8867551cbacbd399ba1d7b4ce3738d629629967 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c8867551cbacbd399ba1d7b4ce3738d629629967/pydoc.py |
def docbuiltin(self, object, *extras): """Produce HTML documentation for a built-in function.""" return '<dl><dt><strong>%s</strong>(...)</dl>' % object.__name__ | def docbuiltin(self, object, *extras): """Produce HTML documentation for a built-in function.""" return '<dl><dt><strong>%s</strong>(...)</dl>' % object.__name__ | c8867551cbacbd399ba1d7b4ce3738d629629967 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c8867551cbacbd399ba1d7b4ce3738d629629967/pydoc.py | |
return '''<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><title>Python: %s</title> <body bgcolor=" | return ''' <!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><title>Python: %s</title><body bgcolor=" | def page(self, object): """Produce a complete HTML page of documentation for an object.""" return '''<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN"> | c8867551cbacbd399ba1d7b4ce3738d629629967 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c8867551cbacbd399ba1d7b4ce3738d629629967/pydoc.py |
def docmethod(self, object): """Produce text documentation for a method object.""" return self.document(object.im_func) | def docmethod(self, object): """Produce text documentation for a method object.""" return self.document(object.im_func) | c8867551cbacbd399ba1d7b4ce3738d629629967 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c8867551cbacbd399ba1d7b4ce3738d629629967/pydoc.py | |
def docfunction(self, object): """Produce text documentation for a function object.""" try: | def docroutine(self, object): """Produce text documentation for a function or method object.""" if inspect.ismethod(object): object = object.im_func if inspect.isbuiltin(object): decl = self.bold(object.__name__) + '(...)' else: | def docfunction(self, object): """Produce text documentation for a function object.""" try: args, varargs, varkw, defaults = inspect.getargspec(object) argspec = inspect.formatargspec( args, varargs, varkw, defaults, formatvalue=self.formatvalue) except TypeError: argspec = '(...)' | c8867551cbacbd399ba1d7b4ce3738d629629967 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c8867551cbacbd399ba1d7b4ce3738d629629967/pydoc.py |
except TypeError: argspec = '(...)' if object.__name__ == '<lambda>': decl = '<lambda> ' + argspec[1:-1] else: decl = self.bold(object.__name__) + argspec | if object.__name__ == '<lambda>': decl = '<lambda> ' + argspec[1:-1] else: decl = self.bold(object.__name__) + argspec | def docfunction(self, object): """Produce text documentation for a function object.""" try: args, varargs, varkw, defaults = inspect.getargspec(object) argspec = inspect.formatargspec( args, varargs, varkw, defaults, formatvalue=self.formatvalue) except TypeError: argspec = '(...)' | c8867551cbacbd399ba1d7b4ce3738d629629967 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c8867551cbacbd399ba1d7b4ce3738d629629967/pydoc.py |
def docbuiltin(self, object): """Produce text documentation for a built-in function object.""" return (self.bold(object.__name__) + '(...)\n' + rstrip(self.indent(object.__doc__)) + '\n') | def docfunction(self, object): """Produce text documentation for a function object.""" try: args, varargs, varkw, defaults = inspect.getargspec(object) argspec = inspect.formatargspec( args, varargs, varkw, defaults, formatvalue=self.formatvalue) except TypeError: argspec = '(...)' | c8867551cbacbd399ba1d7b4ce3738d629629967 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c8867551cbacbd399ba1d7b4ce3738d629629967/pydoc.py | |
if hasattr(__builtins__, path): return None, getattr(__builtins__, path) | def locate(path): """Locate an object by name (or dotted path), importing as necessary.""" if not path: # special case: imp.find_module('') strangely succeeds return None, None if type(path) is not types.StringType: return None, path if hasattr(__builtins__, path): return None, getattr(__builtins__, path) parts = split... | c8867551cbacbd399ba1d7b4ce3738d629629967 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c8867551cbacbd399ba1d7b4ce3738d629629967/pydoc.py | |
def locate(path): """Locate an object by name (or dotted path), importing as necessary.""" if not path: # special case: imp.find_module('') strangely succeeds return None, None if type(path) is not types.StringType: return None, path if hasattr(__builtins__, path): return None, getattr(__builtins__, path) parts = split... | c8867551cbacbd399ba1d7b4ce3738d629629967 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c8867551cbacbd399ba1d7b4ce3738d629629967/pydoc.py | ||
print 'problem in %s - %s' % (value.filename, value.args) | print 'Problem in %s - %s' % (value.filename, value.args) | def doc(thing): """Display documentation on an object (for interactive use).""" if type(thing) is type(""): try: path, x = locate(thing) except DocImportError, value: print 'problem in %s - %s' % (value.filename, value.args) return if x: thing = x else: print 'could not find or import %s' % repr(thing) return desc = d... | c8867551cbacbd399ba1d7b4ce3738d629629967 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c8867551cbacbd399ba1d7b4ce3738d629629967/pydoc.py |
print 'could not find or import %s' % repr(thing) | print 'No Python documentation found for %s.' % repr(thing) | def doc(thing): """Display documentation on an object (for interactive use).""" if type(thing) is type(""): try: path, x = locate(thing) except DocImportError, value: print 'problem in %s - %s' % (value.filename, value.args) return if x: thing = x else: print 'could not find or import %s' % repr(thing) return desc = d... | c8867551cbacbd399ba1d7b4ce3738d629629967 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c8867551cbacbd399ba1d7b4ce3738d629629967/pydoc.py |
def writedocs(path, pkgpath=''): if os.path.isdir(path): dir = path for file in os.listdir(dir): path = os.path.join(dir, file) if os.path.isdir(path): writedocs(path, file + '.' + pkgpath) if os.path.isfile(path): writedocs(path, pkgpath) if os.path.isfile(path): modname = modulename(path) if modname: writedoc(pkgpat... | def doc(thing): """Display documentation on an object (for interactive use).""" if type(thing) is type(""): try: path, x = locate(thing) except DocImportError, value: print 'problem in %s - %s' % (value.filename, value.args) return if x: thing = x else: print 'could not find or import %s' % repr(thing) return desc = d... | c8867551cbacbd399ba1d7b4ce3738d629629967 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c8867551cbacbd399ba1d7b4ce3738d629629967/pydoc.py | |
print 'could not find or import %s' % repr(key) | print 'No Python documentation found for %s.' % repr(key) class Scanner: """A generic tree iterator.""" def __init__(self, roots, children, recurse): self.roots = roots[:] self.state = [] self.children = children self.recurse = recurse def next(self): if not self.state: if not self.roots: return None root = self.root... | def man(key): """Display documentation on an object in a form similar to man(1).""" path, object = locate(key) if object: title = 'Python Library Documentation: ' + describe(object) if path: title = title + ' in ' + path pager('\n' + title + '\n\n' + text.document(object)) found = 1 else: print 'could not find or impor... | c8867551cbacbd399ba1d7b4ce3738d629629967 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c8867551cbacbd399ba1d7b4ce3738d629629967/pydoc.py |
key = lower(key) for module in sys.builtin_module_names: desc = __import__(module).__doc__ or '' desc = split(desc, '\n')[0] if find(lower(module + ' ' + desc), key) >= 0: print module, '-', desc or '(no description)' modules = [] for dir in pathdirs(): for module, desc in index(dir): desc = desc or '' if module not in... | def callback(path, modname, desc): if modname[-9:] == '.__init__': modname = modname[:-9] + ' (package)' print modname, '-', desc or '(no description)' ModuleScanner().run(key, callback) | def apropos(key): """Print all the one-line module summaries that contain a substring.""" key = lower(key) for module in sys.builtin_module_names: desc = __import__(module).__doc__ or '' desc = split(desc, '\n')[0] if find(lower(module + ' ' + desc), key) >= 0: print module, '-', desc or '(no description)' modules = []... | c8867551cbacbd399ba1d7b4ce3738d629629967 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c8867551cbacbd399ba1d7b4ce3738d629629967/pydoc.py |
def serve(address, callback=None): import BaseHTTPServer, mimetools | def serve(port, callback=None): import BaseHTTPServer, mimetools, select | def serve(address, callback=None): import BaseHTTPServer, mimetools # Patch up mimetools.Message so it doesn't break if rfc822 is reloaded. class Message(mimetools.Message): def __init__(self, fp, seekable=1): Message = self.__class__ Message.__bases__[0].__bases__[0].__init__(self, fp, seekable) self.encodingheader =... | c8867551cbacbd399ba1d7b4ce3738d629629967 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c8867551cbacbd399ba1d7b4ce3738d629629967/pydoc.py |
self.send_response(200) self.send_header('Content-Type', 'text/html') self.end_headers() self.wfile.write( '''<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><title>Python: %s</title><body bgcolor=" self.wfile.write(contents) self.wfile.write('</body></html>') | try: self.send_response(200) self.send_header('Content-Type', 'text/html') self.end_headers() self.wfile.write(''' <!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><title>Python: %s</title><body bgcolor=" %s </body></html>''' % (title, contents)) except IOError: pass | def send_document(self, title, contents): self.send_response(200) self.send_header('Content-Type', 'text/html') self.end_headers() self.wfile.write( | c8867551cbacbd399ba1d7b4ce3738d629629967 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c8867551cbacbd399ba1d7b4ce3738d629629967/pydoc.py |
'problem with %s - %s' % (value.filename, value.args))) | 'Problem in %s - %s' % (value.filename, value.args))) | def do_GET(self): path = self.path if path[-5:] == '.html': path = path[:-5] if path[:1] == '/': path = path[1:] if path and path != '.': try: p, x = locate(path) except DocImportError, value: self.send_document(path, html.escape( 'problem with %s - %s' % (value.filename, value.args))) return if x: self.send_document(d... | c8867551cbacbd399ba1d7b4ce3738d629629967 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c8867551cbacbd399ba1d7b4ce3738d629629967/pydoc.py |
'There is no Python module or object named "%s".' % path) | 'No Python documentation found for %s.' % repr(path)) | def do_GET(self): path = self.path if path[-5:] == '.html': path = path[:-5] if path[:1] == '/': path = path[1:] if path and path != '.': try: p, x = locate(path) except DocImportError, value: self.send_document(path, html.escape( 'problem with %s - %s' % (value.filename, value.args))) return if x: self.send_document(d... | c8867551cbacbd399ba1d7b4ce3738d629629967 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c8867551cbacbd399ba1d7b4ce3738d629629967/pydoc.py |
'<br><big><big><strong> ' 'Python: Index of Modules' '</strong></big></big>', ' | '<big><big><strong>Python: Index of Modules</strong></big></big>', ' | def do_GET(self): path = self.path if path[-5:] == '.html': path = path[:-5] if path[:1] == '/': path = path[1:] if path and path != '.': try: p, x = locate(path) except DocImportError, value: self.send_document(path, html.escape( 'problem with %s - %s' % (value.filename, value.args))) return if x: self.send_document(d... | c8867551cbacbd399ba1d7b4ce3738d629629967 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c8867551cbacbd399ba1d7b4ce3738d629629967/pydoc.py |
self.send_document('Index of Modules', heading + join(indices)) | contents = heading + join(indices) + """<p align=right> <small><small><font color=" pydoc</strong> by Ka-Ping Yee <ping@lfw.org></font></small></small>""" self.send_document('Index of Modules', contents) | def do_GET(self): path = self.path if path[-5:] == '.html': path = path[:-5] if path[:1] == '/': path = path[1:] if path and path != '.': try: p, x = locate(path) except DocImportError, value: self.send_document(path, html.escape( 'problem with %s - %s' % (value.filename, value.args))) return if x: self.send_document(d... | c8867551cbacbd399ba1d7b4ce3738d629629967 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c8867551cbacbd399ba1d7b4ce3738d629629967/pydoc.py |
def __init__(self, address, callback): | def __init__(self, port, callback): self.address = ('127.0.0.1', port) self.url = 'http://127.0.0.1:%d/' % port | def __init__(self, address, callback): self.callback = callback self.base.__init__(self, address, self.handler) | c8867551cbacbd399ba1d7b4ce3738d629629967 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c8867551cbacbd399ba1d7b4ce3738d629629967/pydoc.py |
self.base.__init__(self, address, self.handler) | self.base.__init__(self, self.address, self.handler) def serve_until_quit(self): import select self.quit = 0 while not self.quit: rd, wr, ex = select.select([self.socket.fileno()], [], [], 1) if rd: self.handle_request() | def __init__(self, address, callback): self.callback = callback self.base.__init__(self, address, self.handler) | c8867551cbacbd399ba1d7b4ce3738d629629967 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c8867551cbacbd399ba1d7b4ce3738d629629967/pydoc.py |
if self.callback: self.callback() | if self.callback: self.callback(self) | def server_activate(self): self.base.server_activate(self) if self.callback: self.callback() | c8867551cbacbd399ba1d7b4ce3738d629629967 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c8867551cbacbd399ba1d7b4ce3738d629629967/pydoc.py |
DocServer(address, callback).serve_forever() | DocServer(port, callback).serve_until_quit() except (KeyboardInterrupt, select.error): pass print 'server stopped' def gui(): """Graphical interface (starts web server and pops up a control window).""" class GUI: def __init__(self, window, port=7464): self.window = window self.server = None self.scanner = None impo... | def server_activate(self): self.base.server_activate(self) if self.callback: self.callback() | c8867551cbacbd399ba1d7b4ce3738d629629967 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c8867551cbacbd399ba1d7b4ce3738d629629967/pydoc.py |
print 'server stopped' | pass | def server_activate(self): self.base.server_activate(self) if self.callback: self.callback() | c8867551cbacbd399ba1d7b4ce3738d629629967 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c8867551cbacbd399ba1d7b4ce3738d629629967/pydoc.py |
opts, args = getopt.getopt(sys.argv[1:], 'k:p:w') | if sys.platform in ['mac', 'win', 'win32', 'nt'] and not sys.argv[1:]: gui() return opts, args = getopt.getopt(sys.argv[1:], 'gk:p:w') | def cli(): import getopt class BadUsage: pass try: opts, args = getopt.getopt(sys.argv[1:], 'k:p:w') writing = 0 for opt, val in opts: if opt == '-k': apropos(lower(val)) break if opt == '-p': try: port = int(val) except ValueError: raise BadUsage def ready(port=port): print 'server ready at http://127.0.0.1:%d/' % p... | c8867551cbacbd399ba1d7b4ce3738d629629967 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c8867551cbacbd399ba1d7b4ce3738d629629967/pydoc.py |
apropos(lower(val)) break | apropos(val) return | def cli(): import getopt class BadUsage: pass try: opts, args = getopt.getopt(sys.argv[1:], 'k:p:w') writing = 0 for opt, val in opts: if opt == '-k': apropos(lower(val)) break if opt == '-p': try: port = int(val) except ValueError: raise BadUsage def ready(port=port): print 'server ready at http://127.0.0.1:%d/' % p... | c8867551cbacbd399ba1d7b4ce3738d629629967 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c8867551cbacbd399ba1d7b4ce3738d629629967/pydoc.py |
def ready(port=port): print 'server ready at http://127.0.0.1:%d/' % port serve(('127.0.0.1', port), ready) break | def ready(server): print 'server ready at %s' % server.url serve(port, ready) return | def ready(port=port): print 'server ready at http://127.0.0.1:%d/' % port | c8867551cbacbd399ba1d7b4ce3738d629629967 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c8867551cbacbd399ba1d7b4ce3738d629629967/pydoc.py |
if not args: raise BadUsage | def ready(port=port): print 'server ready at http://127.0.0.1:%d/' % port | c8867551cbacbd399ba1d7b4ce3738d629629967 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c8867551cbacbd399ba1d7b4ce3738d629629967/pydoc.py | |
else: if args: for arg in args: try: if os.path.isfile(arg): arg = importfile(arg) if writing: if os.path.isdir(arg): writedocs(arg) else: writedoc(arg) else: man(arg) except DocImportError, value: print 'problem in %s - %s' % ( value.filename, value.args) else: if sys.platform in ['mac', 'win', 'win32', 'nt']: import... | if not args: raise BadUsage for arg in args: try: if find(arg, os.sep) >= 0 and os.path.isfile(arg): arg = importfile(arg) if writing: writedoc(arg) else: man(arg) except DocImportError, value: print 'Problem in %s - %s' % (value.filename, value.args) | def ready(port=port): print 'server ready at http://127.0.0.1:%d/' % port | c8867551cbacbd399ba1d7b4ce3738d629629967 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c8867551cbacbd399ba1d7b4ce3738d629629967/pydoc.py |
print """%s <name> ... Show documentation on something. <name> may be the name of a Python function, module, or package, or a dotted reference to a class or function within a module or module in a package, or the filename of a Python module to import. | cmd = sys.argv[0] print """pydoc - the Python documentation tool %s <name> ... Show text documentation on something. <name> may be the name of a 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 Py... | def ready(port=port): print 'server ready at http://127.0.0.1:%d/' % port | c8867551cbacbd399ba1d7b4ce3738d629629967 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c8867551cbacbd399ba1d7b4ce3738d629629967/pydoc.py |
Search for a keyword in the synopsis lines of all modules. | Search for a keyword in the synopsis lines of all available modules. | def ready(port=port): print 'server ready at http://127.0.0.1:%d/' % port | c8867551cbacbd399ba1d7b4ce3738d629629967 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c8867551cbacbd399ba1d7b4ce3738d629629967/pydoc.py |
%s -w <module> ... Write out the HTML documentation for a module to a file. %s -w <moduledir> Write out the HTML documentation for all modules in the tree under a given directory to files in the current directory. """ % ((sys.argv[0],) * 5) if __name__ == '__main__': cli() | %s -g Pop up a graphical interface for serving and finding documentation. %s -w <name> ... Write out the HTML documentation for a module to a file in the current directory. If <name> contains a '%s', it is treated as a filename. """ % (cmd, os.sep, cmd, cmd, cmd, cmd, os.sep) if __name__ == '__main__': cli() | def ready(port=port): print 'server ready at http://127.0.0.1:%d/' % port | c8867551cbacbd399ba1d7b4ce3738d629629967 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c8867551cbacbd399ba1d7b4ce3738d629629967/pydoc.py |
sys.stderr.write("*** %s\n" % s) | ewrite("*** %s\n" % s) | def para_msg(s): sys.stderr.write("*** %s\n" % s) | 304ebb260c7d5886ccb4a4738c3e4f83f60820f6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/304ebb260c7d5886ccb4a4738c3e4f83f60820f6/docfixer.py |
def find_all_elements_from_set(doc, gi_set, nodes=None): if nodes is None: nodes = [] | def find_all_child_elements(doc, gi): nodes = [] for child in doc.childNodes: if child.nodeType == ELEMENT: if child.tagName == gi: nodes.append(child) return nodes def find_all_elements_from_set(doc, gi_set): return __find_all_elements_from_set(doc, gi_set, []) def __find_all_elements_from_set(doc, gi_set, nodes): | def find_all_elements_from_set(doc, gi_set, nodes=None): if nodes is None: nodes = [] if doc.nodeType == ELEMENT and doc.tagName in gi_set: nodes.append(doc) for child in doc.childNodes: if child.nodeType == ELEMENT: find_all_elements_from_set(child, gi_set, nodes) return nodes | 304ebb260c7d5886ccb4a4738c3e4f83f60820f6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/304ebb260c7d5886ccb4a4738c3e4f83f60820f6/docfixer.py |
find_all_elements_from_set(child, gi_set, nodes) | __find_all_elements_from_set(child, gi_set, nodes) | def find_all_elements_from_set(doc, gi_set, nodes=None): if nodes is None: nodes = [] if doc.nodeType == ELEMENT and doc.tagName in gi_set: nodes.append(doc) for child in doc.childNodes: if child.nodeType == ELEMENT: find_all_elements_from_set(child, gi_set, nodes) return nodes | 304ebb260c7d5886ccb4a4738c3e4f83f60820f6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/304ebb260c7d5886ccb4a4738c3e4f83f60820f6/docfixer.py |
def rewrite_descriptor(doc, descriptor): # # Do these things: # 1. Add an "index=noindex" attribute to the element if the tagName # ends in 'ni', removing the 'ni' from the name. # 2. Create a <signature> from the name attribute and <args>. # 3. Create additional <signature>s from <*line{,ni}> elements, # ... | 304ebb260c7d5886ccb4a4738c3e4f83f60820f6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/304ebb260c7d5886ccb4a4738c3e4f83f60820f6/docfixer.py | ||
descriptor.setAttribute("index", "noindex") | descriptor.setAttribute("index", "no") | def rewrite_descriptor(doc, descriptor): # # Do these things: # 1. Add an "index=noindex" attribute to the element if the tagName # ends in 'ni', removing the 'ni' from the name. # 2. Create a <signature> from the name attribute and <args>. # 3. Create additional <signature>s from <*line{,ni}> elements, # ... | 304ebb260c7d5886ccb4a4738c3e4f83f60820f6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/304ebb260c7d5886ccb4a4738c3e4f83f60820f6/docfixer.py |
sys.stderr.write( "module name in title doesn't match" " <declaremodule>; no <short-synopsis>\n") | ewrite("module name in title doesn't match" " <declaremodule/>; no <short-synopsis/>\n") | def create_module_info(doc, section): # Heavy. node = extract_first_element(section, "modulesynopsis") if node is None: return node._node.name = "synopsis" lastchild = node.childNodes[-1] if lastchild.nodeType == TEXT \ and lastchild.data[-1:] == ".": lastchild.data = lastchild.data[:-1] modauthor = extract_first_eleme... | 304ebb260c7d5886ccb4a4738c3e4f83f60820f6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/304ebb260c7d5886ccb4a4738c3e4f83f60820f6/docfixer.py |
sys.stderr.write( "Unexpected condition: <section> without <title>\n") | ewrite("Unexpected condition: <section/> without <title/>\n") | def create_module_info(doc, section): # Heavy. node = extract_first_element(section, "modulesynopsis") if node is None: return node._node.name = "synopsis" lastchild = node.childNodes[-1] if lastchild.nodeType == TEXT \ and lastchild.data[-1:] == ".": lastchild.data = lastchild.data[:-1] modauthor = extract_first_eleme... | 304ebb260c7d5886ccb4a4738c3e4f83f60820f6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/304ebb260c7d5886ccb4a4738c3e4f83f60820f6/docfixer.py |
def create_module_info(doc, section): # Heavy. node = extract_first_element(section, "modulesynopsis") if node is None: return node._node.name = "synopsis" lastchild = node.childNodes[-1] if lastchild.nodeType == TEXT \ and lastchild.data[-1:] == ".": lastchild.data = lastchild.data[:-1] modauthor = extract_first_eleme... | 304ebb260c7d5886ccb4a4738c3e4f83f60820f6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/304ebb260c7d5886ccb4a4738c3e4f83f60820f6/docfixer.py | ||
def cleanup_synopses(doc): for node in find_all_elements(doc, "section"): | def cleanup_synopses(doc, fragment): for node in find_all_elements(fragment, "section"): | def cleanup_synopses(doc): for node in find_all_elements(doc, "section"): create_module_info(doc, node) | 304ebb260c7d5886ccb4a4738c3e4f83f60820f6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/304ebb260c7d5886ccb4a4738c3e4f83f60820f6/docfixer.py |
"moduleauthor", | "moduleauthor", "indexterm", | def move_elements_by_name(doc, source, dest, name, sep=None): nodes = [] for child in source.childNodes: if child.nodeType == ELEMENT and child.tagName == name: nodes.append(child) for node in nodes: source.removeChild(node) dest.appendChild(node) if sep: dest.appendChild(doc.createTextNode(sep)) | 304ebb260c7d5886ccb4a4738c3e4f83f60820f6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/304ebb260c7d5886ccb4a4738c3e4f83f60820f6/docfixer.py |
parent.insertBefore(para, parent.childNodes[start]) | nextnode = parent.childNodes[start] if nextnode.nodeType == TEXT: if nextnode.data and nextnode.data[0] != "\n": nextnode.data = "\n" + nextnode.data else: newnode = doc.createTextNode("\n") parent.insertBefore(newnode, nextnode) nextnode = newnode start = start + 1 parent.insertBefore(para, nextnode) | def build_para(doc, parent, start, i): children = parent.childNodes after = start + 1 have_last = 0 BREAK_ELEMENTS = PARA_LEVEL_ELEMENTS + RECURSE_INTO_PARA_CONTAINERS # Collect all children until \n\n+ is found in a text node or a # member of BREAK_ELEMENTS is found. for j in range(start, i): after = j + 1 child = chi... | 304ebb260c7d5886ccb4a4738c3e4f83f60820f6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/304ebb260c7d5886ccb4a4738c3e4f83f60820f6/docfixer.py |
sys.stderr.write("--- fixup_refmodindexes_chunk(%s)\n" % container) | bwrite("--- fixup_refmodindexes_chunk(%s)\n" % container) | def fixup_refmodindexes_chunk(container): # node is probably a <para>; let's see how often it isn't: if container.tagName != PARA_ELEMENT: sys.stderr.write("--- fixup_refmodindexes_chunk(%s)\n" % container) module_entries = find_all_elements(container, "module") if not module_entries: return index_entries = find_all_el... | 304ebb260c7d5886ccb4a4738c3e4f83f60820f6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/304ebb260c7d5886ccb4a4738c3e4f83f60820f6/docfixer.py |
sys.stderr.write( "--- unexpected number of children for %s node:\n" % entry.tagName) sys.stderr.write(entry.toxml() + "\n") | bwrite("--- unexpected number of children for %s node:\n" % entry.tagName) ewrite(entry.toxml() + "\n") | def fixup_refmodindexes_chunk(container): # node is probably a <para>; let's see how often it isn't: if container.tagName != PARA_ELEMENT: sys.stderr.write("--- fixup_refmodindexes_chunk(%s)\n" % container) module_entries = find_all_elements(container, "module") if not module_entries: return index_entries = find_all_el... | 304ebb260c7d5886ccb4a4738c3e4f83f60820f6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/304ebb260c7d5886ccb4a4738c3e4f83f60820f6/docfixer.py |
node.setAttribute("index", "index") | node.setAttribute("index", "yes") | def fixup_refmodindexes_chunk(container): # node is probably a <para>; let's see how often it isn't: if container.tagName != PARA_ELEMENT: sys.stderr.write("--- fixup_refmodindexes_chunk(%s)\n" % container) module_entries = find_all_elements(container, "module") if not module_entries: return index_entries = find_all_el... | 304ebb260c7d5886ccb4a4738c3e4f83f60820f6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/304ebb260c7d5886ccb4a4738c3e4f83f60820f6/docfixer.py |
entries = find_all_elements(container, "bifuncindex") function_entries = find_all_elements(container, "function") | entries = find_all_child_elements(container, "bifuncindex") function_entries = find_all_child_elements(container, "function") | def fixup_bifuncindexes_chunk(container): removes = [] entries = find_all_elements(container, "bifuncindex") function_entries = find_all_elements(container, "function") for entry in entries: function_name = entry.getAttribute("name") found = 0 for func_entry in function_entries: t2 = func_entry.childNodes[0].data if t2... | 304ebb260c7d5886ccb4a4738c3e4f83f60820f6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/304ebb260c7d5886ccb4a4738c3e4f83f60820f6/docfixer.py |
func_entry.setAttribute("index", "index") | func_entry.setAttribute("index", "yes") | def fixup_bifuncindexes_chunk(container): removes = [] entries = find_all_elements(container, "bifuncindex") function_entries = find_all_elements(container, "function") for entry in entries: function_name = entry.getAttribute("name") found = 0 for func_entry in function_entries: t2 = func_entry.childNodes[0].data if t2... | 304ebb260c7d5886ccb4a4738c3e4f83f60820f6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/304ebb260c7d5886ccb4a4738c3e4f83f60820f6/docfixer.py |
found = 1 | def fixup_bifuncindexes_chunk(container): removes = [] entries = find_all_elements(container, "bifuncindex") function_entries = find_all_elements(container, "function") for entry in entries: function_name = entry.getAttribute("name") found = 0 for func_entry in function_entries: t2 = func_entry.childNodes[0].data if t2... | 304ebb260c7d5886ccb4a4738c3e4f83f60820f6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/304ebb260c7d5886ccb4a4738c3e4f83f60820f6/docfixer.py | |
cleanup_trailing_parens(doc, ["function", "method", "cfunction"]) cleanup_synopses(doc) | cleanup_trailing_parens(fragment, ["function", "method", "cfunction"]) cleanup_synopses(doc, fragment) | def convert(ifp, ofp): p = esistools.ExtendedEsisBuilder() p.feed(ifp.read()) doc = p.document fragment = p.fragment normalize(fragment) simplify(doc, fragment) handle_labels(doc, fragment) handle_appendix(doc, fragment) fixup_trailing_whitespace(doc, { "abstract": "\n", "title": "", "chapter": "\n\n", "section": "\n\n... | 304ebb260c7d5886ccb4a4738c3e4f83f60820f6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/304ebb260c7d5886ccb4a4738c3e4f83f60820f6/docfixer.py |
self.check_extension_list() | def get_source_files (self): | 8f4eaf8823adfa25fa93c4287b14da0d8c74e713 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8f4eaf8823adfa25fa93c4287b14da0d8c74e713/build_ext.py | |
if len (words) != 2: | if len (words) < 2: | def read_template (self): """Read and parse the manifest template file named by 'self.template' (usually "MANIFEST.in"). Process all file specifications (include and exclude) in the manifest template and add the resulting filenames to 'self.files'.""" | 7785de8f7220463bede0b151e88ccf05497d6802 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/7785de8f7220463bede0b151e88ccf05497d6802/sdist.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.