rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
def doctree(self, tree, modname, classes={}, parent=None):
def formattree(self, tree, modname, classes={}, parent=None):
def doctree(self, tree, modname, classes={}, parent=None): """Produce HTML for a class tree as given by inspect.getclasstree().""" result = '' for entry in tree: if type(entry) is type(()): c, bases = entry result = result + '<dt><font face="helvetica, arial"><small>' result = result + self.classlink(c, modname, classes) if bases and bases != (parent,): parents = [] for base in bases: parents.append(self.classlink(base, modname, classes)) result = result + '(' + join(parents, ', ') + ')' result = result + '\n</small></font></dt>' elif type(entry) is type([]): result = result + \ '<dd>\n%s</dd>\n' % self.doctree(entry, modname, classes, c) return '<dl>\n%s</dl>\n' % result
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
result = result + \ '<dd>\n%s</dd>\n' % self.doctree(entry, modname, classes, c)
result = result + '<dd>\n%s</dd>\n' % self.formattree( entry, modname, classes, c)
def doctree(self, tree, modname, classes={}, parent=None): """Produce HTML for a class tree as given by inspect.getclasstree().""" result = '' for entry in tree: if type(entry) is type(()): c, bases = entry result = result + '<dt><font face="helvetica, arial"><small>' result = result + self.classlink(c, modname, classes) if bases and bases != (parent,): parents = [] for base in bases: parents.append(self.classlink(base, modname, classes)) result = result + '(' + join(parents, ', ') + ')' result = result + '\n</small></font></dt>' elif type(entry) is type([]): result = result + \ '<dd>\n%s</dd>\n' % self.doctree(entry, modname, classes, c) return '<dl>\n%s</dl>\n' % result
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
def docmodule(self, object):
def docmodule(self, object, name=None):
def docmodule(self, object): """Produce HTML documentation for a module object.""" name = object.__name__ parts = split(name, '.') links = [] for i in range(len(parts)-1): links.append( '<a href="%s.html"><font color="#ffffff">%s</font></a>' % (join(parts[:i+1], '.'), parts[i])) linkedname = join(links + parts[-1:], '.') head = '<big><big><strong>%s</strong></big></big>' % linkedname try: path = inspect.getabsfile(object) filelink = '<a href="file:%s">%s</a>' % (path, path) except TypeError: filelink = '(built-in)' info = [] if hasattr(object, '__version__'): version = str(object.__version__) if version[:11] == '$' + 'Revision: ' and version[-1:] == '$': version = strip(version[11:-1]) info.append('version %s' % self.escape(version)) if hasattr(object, '__date__'): info.append(self.escape(str(object.__date__))) if info: head = head + ' (%s)' % join(info, ', ') result = self.heading( head, '#ffffff', '#7799ee', '<a href=".">index</a><br>' + filelink)
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
name = object.__name__
name = object.__name__
def docmodule(self, object): """Produce HTML documentation for a module object.""" name = object.__name__ parts = split(name, '.') links = [] for i in range(len(parts)-1): links.append( '<a href="%s.html"><font color="#ffffff">%s</font></a>' % (join(parts[:i+1], '.'), parts[i])) linkedname = join(links + parts[-1:], '.') head = '<big><big><strong>%s</strong></big></big>' % linkedname try: path = inspect.getabsfile(object) filelink = '<a href="file:%s">%s</a>' % (path, path) except TypeError: filelink = '(built-in)' info = [] if hasattr(object, '__version__'): version = str(object.__version__) if version[:11] == '$' + 'Revision: ' and version[-1:] == '$': version = strip(version[11:-1]) info.append('version %s' % self.escape(version)) if hasattr(object, '__date__'): info.append(self.escape(str(object.__date__))) if info: head = head + ' (%s)' % join(info, ', ') result = self.heading( head, '#ffffff', '#7799ee', '<a href=".">index</a><br>' + filelink)
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
second = lambda list: list[1] modules = map(second, inspect.getmembers(object, inspect.ismodule))
modules = inspect.getmembers(object, inspect.ismodule) if 0 and hasattr(object, '__all__'): visible = lambda key, all=object.__all__: key in all else: visible = lambda key: key[:1] != '_'
def docmodule(self, object): """Produce HTML documentation for a module object.""" name = object.__name__ parts = split(name, '.') links = [] for i in range(len(parts)-1): links.append( '<a href="%s.html"><font color="#ffffff">%s</font></a>' % (join(parts[:i+1], '.'), parts[i])) linkedname = join(links + parts[-1:], '.') head = '<big><big><strong>%s</strong></big></big>' % linkedname try: path = inspect.getabsfile(object) filelink = '<a href="file:%s">%s</a>' % (path, path) except TypeError: filelink = '(built-in)' info = [] if hasattr(object, '__version__'): version = str(object.__version__) if version[:11] == '$' + 'Revision: ' and version[-1:] == '$': version = strip(version[11:-1]) info.append('version %s' % self.escape(version)) if hasattr(object, '__date__'): info.append(self.escape(str(object.__date__))) if info: head = head + ' (%s)' % join(info, ', ') result = self.heading( head, '#ffffff', '#7799ee', '<a href=".">index</a><br>' + filelink)
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
if (inspect.getmodule(value) or object) is object: classes.append(value)
if visible(key) and ( inspect.getmodule(value) or object) is object: classes.append((key, value))
def docmodule(self, object): """Produce HTML documentation for a module object.""" name = object.__name__ parts = split(name, '.') links = [] for i in range(len(parts)-1): links.append( '<a href="%s.html"><font color="#ffffff">%s</font></a>' % (join(parts[:i+1], '.'), parts[i])) linkedname = join(links + parts[-1:], '.') head = '<big><big><strong>%s</strong></big></big>' % linkedname try: path = inspect.getabsfile(object) filelink = '<a href="file:%s">%s</a>' % (path, path) except TypeError: filelink = '(built-in)' info = [] if hasattr(object, '__version__'): version = str(object.__version__) if version[:11] == '$' + 'Revision: ' and version[-1:] == '$': version = strip(version[11:-1]) info.append('version %s' % self.escape(version)) if hasattr(object, '__date__'): info.append(self.escape(str(object.__date__))) if info: head = head + ' (%s)' % join(info, ', ') result = self.heading( head, '#ffffff', '#7799ee', '<a href=".">index</a><br>' + filelink)
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
if inspect.isbuiltin(value) or inspect.getmodule(value) is object: funcs.append(value)
if visible(key) and (inspect.isbuiltin(value) or inspect.getmodule(value) is object): funcs.append((key, value))
def docmodule(self, object): """Produce HTML documentation for a module object.""" name = object.__name__ parts = split(name, '.') links = [] for i in range(len(parts)-1): links.append( '<a href="%s.html"><font color="#ffffff">%s</font></a>' % (join(parts[:i+1], '.'), parts[i])) linkedname = join(links + parts[-1:], '.') head = '<big><big><strong>%s</strong></big></big>' % linkedname try: path = inspect.getabsfile(object) filelink = '<a href="file:%s">%s</a>' % (path, path) except TypeError: filelink = '(built-in)' info = [] if hasattr(object, '__version__'): version = str(object.__version__) if version[:11] == '$' + 'Revision: ' and version[-1:] == '$': version = strip(version[11:-1]) info.append('version %s' % self.escape(version)) if hasattr(object, '__date__'): info.append(self.escape(str(object.__date__))) if info: head = head + ' (%s)' % join(info, ', ') result = self.heading( head, '#ffffff', '#7799ee', '<a href=".">index</a><br>' + filelink)
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
for c in classes: for base in c.__bases__: key, modname = base.__name__, base.__module__ if modname != name and sys.modules.has_key(modname): module = sys.modules[modname] if hasattr(module, key) and getattr(module, key) is base: if not cdict.has_key(key): cdict[key] = cdict[base] = modname + '.html
def docmodule(self, object): """Produce HTML documentation for a module object.""" name = object.__name__ parts = split(name, '.') links = [] for i in range(len(parts)-1): links.append( '<a href="%s.html"><font color="#ffffff">%s</font></a>' % (join(parts[:i+1], '.'), parts[i])) linkedname = join(links + parts[-1:], '.') head = '<big><big><strong>%s</strong></big></big>' % linkedname try: path = inspect.getabsfile(object) filelink = '<a href="file:%s">%s</a>' % (path, path) except TypeError: filelink = '(built-in)' info = [] if hasattr(object, '__version__'): version = str(object.__version__) if version[:11] == '$' + 'Revision: ' and version[-1:] == '$': version = strip(version[11:-1]) info.append('version %s' % self.escape(version)) if hasattr(object, '__date__'): info.append(self.escape(str(object.__date__))) if info: head = head + ' (%s)' % join(info, ', ') result = self.heading( head, '#ffffff', '#7799ee', '<a href=".">index</a><br>' + filelink)
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
if key[:1] != '_':
if visible(key):
def docmodule(self, object): """Produce HTML documentation for a module object.""" name = object.__name__ parts = split(name, '.') links = [] for i in range(len(parts)-1): links.append( '<a href="%s.html"><font color="#ffffff">%s</font></a>' % (join(parts[:i+1], '.'), parts[i])) linkedname = join(links + parts[-1:], '.') head = '<big><big><strong>%s</strong></big></big>' % linkedname try: path = inspect.getabsfile(object) filelink = '<a href="file:%s">%s</a>' % (path, path) except TypeError: filelink = '(built-in)' info = [] if hasattr(object, '__version__'): version = str(object.__version__) if version[:11] == '$' + 'Revision: ' and version[-1:] == '$': version = strip(version[11:-1]) info.append('version %s' % self.escape(version)) if hasattr(object, '__date__'): info.append(self.escape(str(object.__date__))) if info: head = head + ' (%s)' % join(info, ', ') result = self.heading( head, '#ffffff', '#7799ee', '<a href=".">index</a><br>' + filelink)
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
result = result + '<p><small>%s</small></p>\n' % doc
result = result + '<p>%s\n' % self.small(doc)
def docmodule(self, object): """Produce HTML documentation for a module object.""" name = object.__name__ parts = split(name, '.') links = [] for i in range(len(parts)-1): links.append( '<a href="%s.html"><font color="#ffffff">%s</font></a>' % (join(parts[:i+1], '.'), parts[i])) linkedname = join(links + parts[-1:], '.') head = '<big><big><strong>%s</strong></big></big>' % linkedname try: path = inspect.getabsfile(object) filelink = '<a href="file:%s">%s</a>' % (path, path) except TypeError: filelink = '(built-in)' info = [] if hasattr(object, '__version__'): version = str(object.__version__) if version[:11] == '$' + 'Revision: ' and version[-1:] == '$': version = strip(version[11:-1]) info.append('version %s' % self.escape(version)) if hasattr(object, '__date__'): info.append(self.escape(str(object.__date__))) if info: head = head + ' (%s)' % join(info, ', ') result = self.heading( head, '#ffffff', '#7799ee', '<a href=".">index</a><br>' + filelink)
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
def docmodule(self, object): """Produce HTML documentation for a module object.""" name = object.__name__ parts = split(name, '.') links = [] for i in range(len(parts)-1): links.append( '<a href="%s.html"><font color="#ffffff">%s</font></a>' % (join(parts[:i+1], '.'), parts[i])) linkedname = join(links + parts[-1:], '.') head = '<big><big><strong>%s</strong></big></big>' % linkedname try: path = inspect.getabsfile(object) filelink = '<a href="file:%s">%s</a>' % (path, path) except TypeError: filelink = '(built-in)' info = [] if hasattr(object, '__version__'): version = str(object.__version__) if version[:11] == '$' + 'Revision: ' and version[-1:] == '$': version = strip(version[11:-1]) info.append('version %s' % self.escape(version)) if hasattr(object, '__date__'): info.append(self.escape(str(object.__date__))) if info: head = head + ' (%s)' % join(info, ', ') result = self.heading( head, '#ffffff', '#7799ee', '<a href=".">index</a><br>' + filelink)
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
contents = self.multicolumn(modules, self.modulelink)
contents = self.multicolumn( modules, lambda (key, value), s=self: s.modulelink(value))
def docmodule(self, object): """Produce HTML documentation for a module object.""" name = object.__name__ parts = split(name, '.') links = [] for i in range(len(parts)-1): links.append( '<a href="%s.html"><font color="#ffffff">%s</font></a>' % (join(parts[:i+1], '.'), parts[i])) linkedname = join(links + parts[-1:], '.') head = '<big><big><strong>%s</strong></big></big>' % linkedname try: path = inspect.getabsfile(object) filelink = '<a href="file:%s">%s</a>' % (path, path) except TypeError: filelink = '(built-in)' info = [] if hasattr(object, '__version__'): version = str(object.__version__) if version[:11] == '$' + 'Revision: ' and version[-1:] == '$': version = strip(version[11:-1]) info.append('version %s' % self.escape(version)) if hasattr(object, '__date__'): info.append(self.escape(str(object.__date__))) if info: head = head + ' (%s)' % join(info, ', ') result = self.heading( head, '#ffffff', '#7799ee', '<a href=".">index</a><br>' + filelink)
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
contents = self.doctree( inspect.getclasstree(classes, 1), name, cdict) for item in classes: contents = contents + self.document(item, fdict, cdict)
classlist = map(lambda (key, value): value, classes) contents = [self.formattree( inspect.getclasstree(classlist, 1), name, cdict)] for key, value in classes: contents.append(self.document(value, key, fdict, cdict))
def docmodule(self, object): """Produce HTML documentation for a module object.""" name = object.__name__ parts = split(name, '.') links = [] for i in range(len(parts)-1): links.append( '<a href="%s.html"><font color="#ffffff">%s</font></a>' % (join(parts[:i+1], '.'), parts[i])) linkedname = join(links + parts[-1:], '.') head = '<big><big><strong>%s</strong></big></big>' % linkedname try: path = inspect.getabsfile(object) filelink = '<a href="file:%s">%s</a>' % (path, path) except TypeError: filelink = '(built-in)' info = [] if hasattr(object, '__version__'): version = str(object.__version__) if version[:11] == '$' + 'Revision: ' and version[-1:] == '$': version = strip(version[11:-1]) info.append('version %s' % self.escape(version)) if hasattr(object, '__date__'): info.append(self.escape(str(object.__date__))) if info: head = head + ' (%s)' % join(info, ', ') result = self.heading( head, '#ffffff', '#7799ee', '<a href=".">index</a><br>' + filelink)
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
'Classes', '
'Classes', '
def docmodule(self, object): """Produce HTML documentation for a module object.""" name = object.__name__ parts = split(name, '.') links = [] for i in range(len(parts)-1): links.append( '<a href="%s.html"><font color="#ffffff">%s</font></a>' % (join(parts[:i+1], '.'), parts[i])) linkedname = join(links + parts[-1:], '.') head = '<big><big><strong>%s</strong></big></big>' % linkedname try: path = inspect.getabsfile(object) filelink = '<a href="file:%s">%s</a>' % (path, path) except TypeError: filelink = '(built-in)' info = [] if hasattr(object, '__version__'): version = str(object.__version__) if version[:11] == '$' + 'Revision: ' and version[-1:] == '$': version = strip(version[11:-1]) info.append('version %s' % self.escape(version)) if hasattr(object, '__date__'): info.append(self.escape(str(object.__date__))) if info: head = head + ' (%s)' % join(info, ', ') result = self.heading( head, '#ffffff', '#7799ee', '<a href=".">index</a><br>' + filelink)
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
contents = '' for item in funcs: contents = contents + self.document(item, fdict, cdict)
contents = [] for key, value in funcs: contents.append(self.document(value, key, fdict, cdict))
def docmodule(self, object): """Produce HTML documentation for a module object.""" name = object.__name__ parts = split(name, '.') links = [] for i in range(len(parts)-1): links.append( '<a href="%s.html"><font color="#ffffff">%s</font></a>' % (join(parts[:i+1], '.'), parts[i])) linkedname = join(links + parts[-1:], '.') head = '<big><big><strong>%s</strong></big></big>' % linkedname try: path = inspect.getabsfile(object) filelink = '<a href="file:%s">%s</a>' % (path, path) except TypeError: filelink = '(built-in)' info = [] if hasattr(object, '__version__'): version = str(object.__version__) if version[:11] == '$' + 'Revision: ' and version[-1:] == '$': version = strip(version[11:-1]) info.append('version %s' % self.escape(version)) if hasattr(object, '__date__'): info.append(self.escape(str(object.__date__))) if info: head = head + ' (%s)' % join(info, ', ') result = self.heading( head, '#ffffff', '#7799ee', '<a href=".">index</a><br>' + filelink)
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
'Functions', '
'Functions', '
def docmodule(self, object): """Produce HTML documentation for a module object.""" name = object.__name__ parts = split(name, '.') links = [] for i in range(len(parts)-1): links.append( '<a href="%s.html"><font color="#ffffff">%s</font></a>' % (join(parts[:i+1], '.'), parts[i])) linkedname = join(links + parts[-1:], '.') head = '<big><big><strong>%s</strong></big></big>' % linkedname try: path = inspect.getabsfile(object) filelink = '<a href="file:%s">%s</a>' % (path, path) except TypeError: filelink = '(built-in)' info = [] if hasattr(object, '__version__'): version = str(object.__version__) if version[:11] == '$' + 'Revision: ' and version[-1:] == '$': version = strip(version[11:-1]) info.append('version %s' % self.escape(version)) if hasattr(object, '__date__'): info.append(self.escape(str(object.__date__))) if info: head = head + ' (%s)' % join(info, ', ') result = self.heading( head, '#ffffff', '#7799ee', '<a href=".">index</a><br>' + filelink)
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
contents = ''
contents = []
def docmodule(self, object): """Produce HTML documentation for a module object.""" name = object.__name__ parts = split(name, '.') links = [] for i in range(len(parts)-1): links.append( '<a href="%s.html"><font color="#ffffff">%s</font></a>' % (join(parts[:i+1], '.'), parts[i])) linkedname = join(links + parts[-1:], '.') head = '<big><big><strong>%s</strong></big></big>' % linkedname try: path = inspect.getabsfile(object) filelink = '<a href="file:%s">%s</a>' % (path, path) except TypeError: filelink = '(built-in)' info = [] if hasattr(object, '__version__'): version = str(object.__version__) if version[:11] == '$' + 'Revision: ' and version[-1:] == '$': version = strip(version[11:-1]) info.append('version %s' % self.escape(version)) if hasattr(object, '__date__'): info.append(self.escape(str(object.__date__))) if info: head = head + ' (%s)' % join(info, ', ') result = self.heading( head, '#ffffff', '#7799ee', '<a href=".">index</a><br>' + filelink)
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
contents = contents + ('<br><strong>%s</strong> = %s' % (key, self.repr(value)))
contents.append(self.document(value, key))
def docmodule(self, object): """Produce HTML documentation for a module object.""" name = object.__name__ parts = split(name, '.') links = [] for i in range(len(parts)-1): links.append( '<a href="%s.html"><font color="#ffffff">%s</font></a>' % (join(parts[:i+1], '.'), parts[i])) linkedname = join(links + parts[-1:], '.') head = '<big><big><strong>%s</strong></big></big>' % linkedname try: path = inspect.getabsfile(object) filelink = '<a href="file:%s">%s</a>' % (path, path) except TypeError: filelink = '(built-in)' info = [] if hasattr(object, '__version__'): version = str(object.__version__) if version[:11] == '$' + 'Revision: ' and version[-1:] == '$': version = strip(version[11:-1]) info.append('version %s' % self.escape(version)) if hasattr(object, '__date__'): info.append(self.escape(str(object.__date__))) if info: head = head + ' (%s)' % join(info, ', ') result = self.heading( head, '#ffffff', '#7799ee', '<a href=".">index</a><br>' + filelink)
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
'Constants', '
'Constants', '
def docmodule(self, object): """Produce HTML documentation for a module object.""" name = object.__name__ parts = split(name, '.') links = [] for i in range(len(parts)-1): links.append( '<a href="%s.html"><font color="#ffffff">%s</font></a>' % (join(parts[:i+1], '.'), parts[i])) linkedname = join(links + parts[-1:], '.') head = '<big><big><strong>%s</strong></big></big>' % linkedname try: path = inspect.getabsfile(object) filelink = '<a href="file:%s">%s</a>' % (path, path) except TypeError: filelink = '(built-in)' info = [] if hasattr(object, '__version__'): version = str(object.__version__) if version[:11] == '$' + 'Revision: ' and version[-1:] == '$': version = strip(version[11:-1]) info.append('version %s' % self.escape(version)) if hasattr(object, '__date__'): info.append(self.escape(str(object.__date__))) if info: head = head + ' (%s)' % join(info, ', ') result = self.heading( head, '#ffffff', '#7799ee', '<a href=".">index</a><br>' + filelink)
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
def docmodule(self, object): """Produce HTML documentation for a module object.""" name = object.__name__ parts = split(name, '.') links = [] for i in range(len(parts)-1): links.append( '<a href="%s.html"><font color="#ffffff">%s</font></a>' % (join(parts[:i+1], '.'), parts[i])) linkedname = join(links + parts[-1:], '.') head = '<big><big><strong>%s</strong></big></big>' % linkedname try: path = inspect.getabsfile(object) filelink = '<a href="file:%s">%s</a>' % (path, path) except TypeError: filelink = '(built-in)' info = [] if hasattr(object, '__version__'): version = str(object.__version__) if version[:11] == '$' + 'Revision: ' and version[-1:] == '$': version = strip(version[11:-1]) info.append('version %s' % self.escape(version)) if hasattr(object, '__date__'): info.append(self.escape(str(object.__date__))) if info: head = head + ' (%s)' % join(info, ', ') result = self.heading( head, '#ffffff', '#7799ee', '<a href=".">index</a><br>' + filelink)
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
def docclass(self, object, funcs={}, classes={}):
def docclass(self, object, name=None, funcs={}, classes={}):
def docclass(self, object, funcs={}, classes={}): """Produce HTML documentation for a class object.""" name = object.__name__ bases = object.__bases__ contents = ''
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
name = object.__name__
realname = object.__name__ name = name or realname
def docclass(self, object, funcs={}, classes={}): """Produce HTML documentation for a class object.""" name = object.__name__ bases = object.__bases__ contents = ''
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
methods.append(value)
methods.append((key, value))
def docclass(self, object, funcs={}, classes={}): """Produce HTML documentation for a class object.""" name = object.__name__ bases = object.__bases__ contents = ''
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
for item in methods:
for key, value in methods:
def docclass(self, object, funcs={}, classes={}): """Produce HTML documentation for a class object.""" name = object.__name__ bases = object.__bases__ contents = ''
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
item, funcs, classes, mdict, name) title = '<a name="%s">class <strong>%s</strong></a>' % (name, name)
value, key, funcs, classes, mdict, name) if name == realname: title = '<a name="%s">class <strong>%s</strong></a>' % ( name, realname) else: title = '<strong>%s</strong> = <a name="%s">class %s</a>' % ( name, name, realname)
def docclass(self, object, funcs={}, classes={}): """Produce HTML documentation for a class object.""" name = object.__name__ bases = object.__bases__ contents = ''
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
parents.append(self.classlink(base, object.__module__, classes))
parents.append( self.classlink(base, object.__module__, classes))
def docclass(self, object, funcs={}, classes={}): """Produce HTML documentation for a class object.""" name = object.__name__ bases = object.__bases__ contents = ''
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
doc = self.markup(getdoc(object), self.preformat, funcs, classes, mdict) if doc: doc = '<small><tt>' + doc + '</tt></small>'
doc = self.markup( getdoc(object), self.preformat, funcs, classes, mdict) if doc: doc = self.small('<tt>%s</tt>' % doc)
def docclass(self, object, funcs={}, classes={}): """Produce HTML documentation for a class object.""" name = object.__name__ bases = object.__bases__ contents = ''
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
return ('<small><font color=" self.repr(object)) def docroutine(self, object, funcs={}, classes={}, methods={}, clname=''):
return self.small(self.grey('=' + self.repr(object))) def docroutine(self, object, name=None, funcs={}, classes={}, methods={}, clname=''):
def formatvalue(self, object): """Format an argument default value as text.""" return ('<small><font color="#909090">=%s</font></small>' % self.repr(object))
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
if inspect.ismethod(object): object = object.im_func
realname = object.__name__ name = name or realname anchor = clname + '-' + realname note = '' if inspect.ismethod(object): if not clname: note = self.small(self.grey( object.im_self and 'method of ' + self.repr(object.im_self) or ' unbound %s method' % object.im_class.__name__)) object = object.im_func if name == realname: title = '<a name="%s"><strong>%s</strong></a>' % (anchor, realname) else: title = '<strong>%s</strong> = <a name="%s">%s</a>' % ( name, anchor, realname)
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.__name__) else: args, varargs, varkw, defaults = inspect.getargspec(object) argspec = inspect.formatargspec( args, varargs, varkw, defaults, formatvalue=self.formatvalue)
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
decl = '<a name="%s"><strong>%s</strong>(...)</a>\n' % ( clname + '-' + object.__name__, object.__name__)
argspec = '(...)'
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.__name__) else: args, varargs, varkw, defaults = inspect.getargspec(object) argspec = inspect.formatargspec( args, varargs, varkw, defaults, formatvalue=self.formatvalue)
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
if object.__name__ == '<lambda>': decl = '<em>lambda</em> ' + argspec[1:-1] else: anchor = clname + '-' + object.__name__ decl = '<a name="%s"\n><strong>%s</strong>%s</a>\n' % ( anchor, object.__name__, argspec) doc = self.markup(getdoc(object), self.preformat, funcs, classes, methods)
if realname == '<lambda>': decl = '<em>lambda</em>' argspec = argspec[1:-1] decl = title + argspec + note doc = self.markup( getdoc(object), self.preformat, funcs, classes, methods)
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.__name__) else: args, varargs, varkw, defaults = inspect.getargspec(object) argspec = inspect.formatargspec( args, varargs, varkw, defaults, formatvalue=self.formatvalue)
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
return '<dl><dt>%s<dd><small>%s</small></dl>' % (decl, doc) 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"> <html><title>Python: %s</title><body bgcolor=" %s </body></html> ''' % (describe(object), self.document(object))
return '<dl><dt>%s<dd>%s</dl>' % (decl, self.small(doc)) def docother(self, object, name=None): """Produce HTML documentation for a data object.""" return '<strong>%s</strong> = %s' % (name, self.repr(object))
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.__name__) else: args, varargs, varkw, defaults = inspect.getargspec(object) argspec = inspect.formatargspec( args, varargs, varkw, defaults, formatvalue=self.formatvalue)
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
self.maxstring = self.maxother = 50
self.maxstring = self.maxother = 100
def __init__(self): Repr.__init__(self) self.maxlist = self.maxtuple = self.maxdict = 10 self.maxstring = self.maxother = 50
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
def doctree(self, tree, modname, parent=None, prefix=''):
def formattree(self, tree, modname, parent=None, prefix=''):
def doctree(self, tree, modname, parent=None, prefix=''): """Render in text a class tree as returned by inspect.getclasstree().""" result = '' for entry in tree: if type(entry) is type(()): cl, bases = entry result = result + prefix + classname(cl, modname) if bases and bases != (parent,): parents = map(lambda cl, m=modname: classname(cl, m), bases) result = result + '(%s)' % join(parents, ', ') result = result + '\n' elif type(entry) is type([]): result = result + self.doctree( entry, modname, cl, prefix + ' ') return result
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
cl, bases = entry result = result + prefix + classname(cl, modname)
c, bases = entry result = result + prefix + classname(c, modname)
def doctree(self, tree, modname, parent=None, prefix=''): """Render in text a class tree as returned by inspect.getclasstree().""" result = '' for entry in tree: if type(entry) is type(()): cl, bases = entry result = result + prefix + classname(cl, modname) if bases and bases != (parent,): parents = map(lambda cl, m=modname: classname(cl, m), bases) result = result + '(%s)' % join(parents, ', ') result = result + '\n' elif type(entry) is type([]): result = result + self.doctree( entry, modname, cl, prefix + ' ') return result
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
parents = map(lambda cl, m=modname: classname(cl, m), bases)
parents = map(lambda c, m=modname: classname(c, m), bases)
def doctree(self, tree, modname, parent=None, prefix=''): """Render in text a class tree as returned by inspect.getclasstree().""" result = '' for entry in tree: if type(entry) is type(()): cl, bases = entry result = result + prefix + classname(cl, modname) if bases and bases != (parent,): parents = map(lambda cl, m=modname: classname(cl, m), bases) result = result + '(%s)' % join(parents, ', ') result = result + '\n' elif type(entry) is type([]): result = result + self.doctree( entry, modname, cl, prefix + ' ') return result
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
result = result + self.doctree( entry, modname, cl, prefix + ' ')
result = result + self.formattree( entry, modname, c, prefix + ' ')
def doctree(self, tree, modname, parent=None, prefix=''): """Render in text a class tree as returned by inspect.getclasstree().""" result = '' for entry in tree: if type(entry) is type(()): cl, bases = entry result = result + prefix + classname(cl, modname) if bases and bases != (parent,): parents = map(lambda cl, m=modname: classname(cl, m), bases) result = result + '(%s)' % join(parents, ', ') result = result + '\n' elif type(entry) is type([]): result = result + self.doctree( entry, modname, cl, prefix + ' ') return result
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
def docmodule(self, object):
def docmodule(self, object, name=None):
def docmodule(self, object): """Produce text documentation for a given module object.""" result = ''
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
result = '' name = object.__name__
name = object.__name__
def docmodule(self, object): """Produce text documentation for a given module object.""" result = ''
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
result = result + self.section('NAME', name) try: file = inspect.getabsfile(object) except TypeError: file = '(built-in)'
result = self.section('NAME', name) try: file = inspect.getabsfile(object) except TypeError: file = '(built-in)'
def docmodule(self, object): """Produce text documentation for a given module object.""" result = ''
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
classes.append(value)
classes.append((key, value))
def docmodule(self, object): """Produce text documentation for a given module object.""" result = ''
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
funcs.append(value)
funcs.append((key, value))
def docmodule(self, object): """Produce text documentation for a given module object.""" result = ''
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
contents = self.doctree( inspect.getclasstree(classes, 1), object.__name__) + '\n' for item in classes: contents = contents + self.document(item) + '\n' result = result + self.section('CLASSES', contents)
classlist = map(lambda (key, value): value, classes) contents = [self.formattree( inspect.getclasstree(classlist, 1), name)] for key, value in classes: contents.append(self.document(value, key)) result = result + self.section('CLASSES', join(contents, '\n'))
def docmodule(self, object): """Produce text documentation for a given module object.""" result = ''
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
contents = '' for item in funcs: contents = contents + self.document(item) + '\n' result = result + self.section('FUNCTIONS', contents)
contents = [] for key, value in funcs: contents.append(self.document(value, key)) result = result + self.section('FUNCTIONS', join(contents, '\n'))
def docmodule(self, object): """Produce text documentation for a given module object.""" result = ''
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
contents = ''
contents = []
def docmodule(self, object): """Produce text documentation for a given module object.""" result = ''
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
line = key + ' = ' + self.repr(value) chop = 70 - len(line) line = self.bold(key) + ' = ' + self.repr(value) if chop < 0: line = line[:chop] + '...' contents = contents + line + '\n' result = result + self.section('CONSTANTS', contents)
contents.append(self.docother(value, key, 70)) result = result + self.section('CONSTANTS', join(contents, '\n'))
def docmodule(self, object): """Produce text documentation for a given module object.""" result = ''
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
def docclass(self, object):
def docclass(self, object, name=None):
def docclass(self, object): """Produce text documentation for a given class object.""" name = object.__name__ bases = object.__bases__
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
name = object.__name__
realname = object.__name__ name = name or realname
def docclass(self, object): """Produce text documentation for a given class object.""" name = object.__name__ bases = object.__bases__
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
title = 'class ' + self.bold(name)
if name == realname: title = 'class ' + self.bold(realname) else: title = self.bold(name) + ' = class ' + realname
def docclass(self, object): """Produce text documentation for a given class object.""" name = object.__name__ bases = object.__bases__
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
methods = map(lambda (key, value): value, inspect.getmembers(object, inspect.ismethod)) for item in methods: contents = contents + '\n' + self.document(item)
for key, value in inspect.getmembers(object, inspect.ismethod): contents = contents + '\n' + self.document(value, key, name)
def docclass(self, object): """Produce text documentation for a given class object.""" name = object.__name__ bases = object.__bases__
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
def docroutine(self, object):
def docroutine(self, object, name=None, clname=None):
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: args, varargs, varkw, defaults = inspect.getargspec(object) argspec = inspect.formatargspec( args, varargs, varkw, defaults, formatvalue=self.formatvalue) if object.__name__ == '<lambda>': decl = '<lambda> ' + argspec[1:-1] else: decl = self.bold(object.__name__) + argspec doc = getdoc(object) if doc: return decl + '\n' + rstrip(self.indent(doc)) + '\n' else: return decl + '\n'
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
if inspect.ismethod(object): object = object.im_func
realname = object.__name__ name = name or realname note = '' if inspect.ismethod(object): if not clname: if object.im_self: note = ' method of %s' % self.repr(object.im_self) else: note = ' unbound %s method' % object.im_class.__name__ object = object.im_func if name == realname: title = self.bold(realname) else: title = self.bold(name) + ' = ' + realname
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: args, varargs, varkw, defaults = inspect.getargspec(object) argspec = inspect.formatargspec( args, varargs, varkw, defaults, formatvalue=self.formatvalue) if object.__name__ == '<lambda>': decl = '<lambda> ' + argspec[1:-1] else: decl = self.bold(object.__name__) + argspec doc = getdoc(object) if doc: return decl + '\n' + rstrip(self.indent(doc)) + '\n' else: return decl + '\n'
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
decl = self.bold(object.__name__) + '(...)'
argspec = '(...)'
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: args, varargs, varkw, defaults = inspect.getargspec(object) argspec = inspect.formatargspec( args, varargs, varkw, defaults, formatvalue=self.formatvalue) if object.__name__ == '<lambda>': decl = '<lambda> ' + argspec[1:-1] else: decl = self.bold(object.__name__) + argspec doc = getdoc(object) if doc: return decl + '\n' + rstrip(self.indent(doc)) + '\n' else: return decl + '\n'
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
if object.__name__ == '<lambda>': decl = '<lambda> ' + argspec[1:-1] else: decl = self.bold(object.__name__) + argspec
if realname == '<lambda>': title = 'lambda' argspec = argspec[1:-1] decl = title + argspec + note
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: args, varargs, varkw, defaults = inspect.getargspec(object) argspec = inspect.formatargspec( args, varargs, varkw, defaults, formatvalue=self.formatvalue) if object.__name__ == '<lambda>': decl = '<lambda> ' + argspec[1:-1] else: decl = self.bold(object.__name__) + argspec doc = getdoc(object) if doc: return decl + '\n' + rstrip(self.indent(doc)) + '\n' else: return decl + '\n'
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
return repr(thing)
if type(thing) is types.InstanceType: return 'instance of ' + thing.__class__.__name__ return type(thing).__name__ def freshimp(path, cache={}): """Import a module, reloading it if the source file has changed.""" module = __import__(path) if hasattr(module, '__file__'): file = module.__file__ info = (file, os.path.getmtime(file), os.path.getsize(file)) if cache.has_key(path): if cache[path] != info: module = reload(module) cache[path] = info return module
def describe(thing): """Produce a short description of the given kind of thing.""" if inspect.ismodule(thing): if thing.__name__ in sys.builtin_module_names: return 'built-in module ' + thing.__name__ if hasattr(thing, '__path__'): return 'package ' + thing.__name__ else: return 'module ' + thing.__name__ if inspect.isbuiltin(thing): return 'built-in function ' + thing.__name__ if inspect.isclass(thing): return 'class ' + thing.__name__ if inspect.isfunction(thing): return 'function ' + thing.__name__ if inspect.ismethod(thing): return 'method ' + thing.__name__ return repr(thing)
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
module = __import__(path) module = reload(module)
module = freshimp(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 parts = split(path, '.') n = 1 while n <= len(parts): path = join(parts[:n], '.') try: module = __import__(path) module = reload(module) except: # determine if error occurred before or after module was found if sys.modules.has_key(path): filename = sys.modules[path].__file__ elif sys.exc_type is SyntaxError: filename = sys.exc_value.filename else: # module not found, so stop looking break # error occurred in the imported module, so report it raise DocImportError(filename, sys.exc_type, sys.exc_value) try: x = module for p in parts[1:]: x = getattr(x, p) return join(parts[:-1], '.'), x except AttributeError: n = n + 1 continue if hasattr(__builtins__, path): return None, getattr(__builtins__, path) return None, None
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
raise DocImportError(filename, sys.exc_type, sys.exc_value)
raise DocImportError(filename, sys.exc_info())
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 parts = split(path, '.') n = 1 while n <= len(parts): path = join(parts[:n], '.') try: module = __import__(path) module = reload(module) except: # determine if error occurred before or after module was found if sys.modules.has_key(path): filename = sys.modules[path].__file__ elif sys.exc_type is SyntaxError: filename = sys.exc_value.filename else: # module not found, so stop looking break # error occurred in the imported module, so report it raise DocImportError(filename, sys.exc_type, sys.exc_value) try: x = module for p in parts[1:]: x = getattr(x, p) return join(parts[:-1], '.'), x except AttributeError: n = n + 1 continue if hasattr(__builtins__, path): return None, getattr(__builtins__, path) return None, None
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
print 'Problem in %s - %s' % (value.filename, value.args)
print value
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 'No Python documentation found for %s.' % repr(thing) return desc = describe(thing) module = inspect.getmodule(thing) if module and module is not thing: desc = desc + ' in module ' + module.__name__ pager('Help on %s:\n\n' % desc + text.document(thing))
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
print 'No Python documentation found for %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 'No Python documentation found for %s.' % repr(thing) return desc = describe(thing) module = inspect.getmodule(thing) if module and module is not thing: desc = desc + ' in module ' + module.__name__ pager('Help on %s:\n\n' % desc + text.document(thing))
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
path, object = locate(key) if object: file = open(key + '.html', 'w') file.write(html.page(object)) file.close() print 'wrote', key + '.html'
try: path, object = locate(key) except DocImportError, value: print value else: if object: page = html.page('Python: ' + describe(object), html.document(object, object.__name__)) file = open(key + '.html', 'w') file.write(page) file.close() print 'wrote', key + '.html' else: print 'no Python documentation found for %s' % repr(key) def writedocs(dir, pkgpath='', done={}): """Write out HTML documentation for all modules in a directory tree.""" for file in os.listdir(dir): path = os.path.join(dir, file) if ispackage(path): writedocs(path, pkgpath + file + '.') elif os.path.isfile(path): modname = modulename(path) if modname: modname = pkgpath + modname if not done.has_key(modname): done[modname] = 1 writedoc(modname)
def writedoc(key): """Write HTML documentation to a file in the current directory.""" path, object = locate(key) if object: file = open(key + '.html', 'w') file.write(html.page(object)) file.close() print 'wrote', key + '.html'
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
return """To get help on a Python object, call help(object).
return '''To get help on a Python object, call help(object).
def __repr__(self): return """To get help on a Python object, call help(object).
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
help(module) or call help('modulename')."""
help(module) or call help('modulename').'''
def __repr__(self): return """To get help on a Python object, call help(object).
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
pager('\n' + title + '\n\n' + text.document(object))
pager('\n' + title + '\n\n' + text.document(object, key))
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 'No Python documentation found for %s.' % repr(key)
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
print 'No Python documentation found for %s.' % repr(key)
print 'no Python documentation found for %s' % repr(key)
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 'No Python documentation found for %s.' % repr(key)
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
desc = split(__import__(modname).__doc__ or '', '\n')[0]
desc = split(freshimp(modname).__doc__ or '', '\n')[0]
def run(self, key, callback, completer=None): self.quit = 0 seen = {}
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
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))
self.wfile.write(html.page(title, contents))
def send_document(self, title, contents): try: self.send_response(200) self.send_header('Content-Type', 'text/html') self.end_headers() self.wfile.write('''
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
self.send_document(path, html.escape( 'Problem in %s - %s' % (value.filename, value.args)))
self.send_document(path, html.escape(str(value)))
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 in %s - %s' % (value.filename, value.args))) return if x: self.send_document(describe(x), html.document(x)) else: self.send_document(path,
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
self.send_document(describe(x), html.document(x))
self.send_document(describe(x), html.document(x, 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 in %s - %s' % (value.filename, value.args))) return if x: self.send_document(describe(x), html.document(x)) else: self.send_document(path,
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
'No Python documentation found for %s.' % repr(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 in %s - %s' % (value.filename, value.args))) return if x: self.send_document(describe(x), html.document(x)) else: self.send_document(path,
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
contents = heading + join(indices) + """<p align=right>
contents = heading + join(indices) + '''<p align=right>
def bltinlink(name): return '<a href="%s.html">%s</a>' % (name, name)
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
pydoc</strong> by Ka-Ping Yee &lt;[email protected]&gt;</font></small></small>"""
pydoc</strong> by Ka-Ping Yee &lt;[email protected]&gt;</font></small></small>'''
def bltinlink(name): return '<a href="%s.html">%s</a>' % (name, name)
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
self.address = (host, port)
self.address = ('', port)
def __init__(self, port, callback): host = (sys.platform == 'mac') and '127.0.0.1' or 'localhost' self.address = (host, port) self.url = 'http://%s:%d/' % (host, port) self.callback = callback self.base.__init__(self, self.address, self.handler)
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
if find(arg, os.sep) >= 0 and os.path.isfile(arg):
if ispath(arg) and os.path.isfile(arg):
def ready(server): print 'server ready at %s' % server.url
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
if writing: writedoc(arg) else: man(arg)
if writing: if ispath(arg) and os.path.isdir(arg): writedocs(arg) else: writedoc(arg) else: man(arg)
def ready(server): print 'server ready at %s' % server.url
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
print 'Problem in %s - %s' % (value.filename, value.args)
print value
def ready(server): print 'server ready at %s' % server.url
37f7b38eb6247564c00c8a355ab12268e8486c4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/37f7b38eb6247564c00c8a355ab12268e8486c4e/pydoc.py
XXX When wrapping around and failing to find anything, the portion of the text after the selection is searched twice :-(
def search_text(self, text, prog=None, ok=0): """Search a text widget for the pattern.
cfb819ee5168dd2d5c9c1bd237d8ac7d0e2278e2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/cfb819ee5168dd2d5c9c1bd237d8ac7d0e2278e2/SearchEngine.py
i, j = m.span()
def search_backward(self, text, prog, line, col, wrap, ok=0): chars = text.get("%d.0" % line, "%d.0" % (line+1)) while 1: m = search_reverse(prog, chars[:-1], col) if m: i, j = m.span() if ok or m.start() < col: return line, m line = line - 1 ok = 1 if line <= 0: if not wrap: break wrap = 0 pos = text.index("end-1c") line, col = map(int, string.split(pos, ".")) chars = text.get("%d.0" % line, "%d.0" % (line+1)) col = len(chars) - 1 return None
cfb819ee5168dd2d5c9c1bd237d8ac7d0e2278e2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/cfb819ee5168dd2d5c9c1bd237d8ac7d0e2278e2/SearchEngine.py
rep = self__repr(object, context, level - 1)
rep = self.__repr(object, context, level - 1)
def __format(self, object, stream, indent, allowance, context, level):
5fd026dc5eb993c703d6f76c5aa0ff81dd1d1753 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5fd026dc5eb993c703d6f76c5aa0ff81dd1d1753/pprint.py
pprint(object[0], stream, indent, allowance + 1)
self.__format(object[0], stream, indent, allowance + 1, context, level)
def __format(self, object, stream, indent, allowance, context, level):
5fd026dc5eb993c703d6f76c5aa0ff81dd1d1753 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5fd026dc5eb993c703d6f76c5aa0ff81dd1d1753/pprint.py
pp_opts = _gen_preprocess_options (self.macros + macros, self.include_dirs + includes)
pp_opts = gen_preprocess_options (self.macros + macros, self.include_dirs + includes)
def compile (self, sources, macros=None, includes=None):
c294113f180cd0deb66857432463f21ead92392a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c294113f180cd0deb66857432463f21ead92392a/unixccompiler.py
def compile (self, sources, macros=None, includes=None):
c294113f180cd0deb66857432463f21ead92392a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c294113f180cd0deb66857432463f21ead92392a/unixccompiler.py
return self.object_filenames (sources)
def compile (self, sources, macros=None, includes=None):
c294113f180cd0deb66857432463f21ead92392a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c294113f180cd0deb66857432463f21ead92392a/unixccompiler.py
lib_opts = _gen_lib_options (self.libraries + libraries, self.library_dirs + library_dirs)
lib_opts = gen_lib_options (self.libraries + libraries, self.library_dirs + library_dirs, "-l%s", "-L%s")
def link_shared_object (self, objects, output_filename, libraries=None, library_dirs=None, build_info=None):
c294113f180cd0deb66857432463f21ead92392a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c294113f180cd0deb66857432463f21ead92392a/unixccompiler.py
def link_shared_object (self, objects, output_filename, libraries=None, library_dirs=None, build_info=None):
c294113f180cd0deb66857432463f21ead92392a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c294113f180cd0deb66857432463f21ead92392a/unixccompiler.py
def shared_library_filename (self, libname): return "lib%s%s" % (libname, self._shared_lib_ext )
c294113f180cd0deb66857432463f21ead92392a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c294113f180cd0deb66857432463f21ead92392a/unixccompiler.py
def _gen_preprocess_options (macros, includes): pp_opts = [] for macro in macros: if len (macro) == 1: pp_opts.append ("-U%s" % macro[0]) elif len (macro) == 2: if macro[1] is None: pp_opts.append ("-D%s" % macro[0]) else: pp_opts.append ("-D%s=%s" % macro) for dir in includes: pp_opts.append ("-I%s" % dir) return pp_opts def _gen_lib_options (libraries, library_dirs): lib_opts = [] for dir in library_dirs: lib_opts.append ("-L%s" % dir) for lib in libraries: lib_opts.append ("-l%s" % lib) return lib_opts
def _split_command (cmd): """Split a command string up into the progam to run (a string) and the list of arguments; return them as (cmd, arglist).""" args = string.split (cmd) return (args[0], args[1:])
c294113f180cd0deb66857432463f21ead92392a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c294113f180cd0deb66857432463f21ead92392a/unixccompiler.py
emit((av[0]-1)*2)
emit(av[0]-1)
def fixup(literal, flags=flags): return _sre.getlower(literal, flags)
c30faa812c507c94d744419bce7c497f1a283d95 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c30faa812c507c94d744419bce7c497f1a283d95/sre_compile.py
class Element( Node ):
class Element(Node):
def __delitem__(self, attname_or_tuple): node = self[attname_or_tuple] node.unlink() del self._attrs[node.name] del self._attrsNS[(node.namespaceURI, node.localName)]
a2fda0dfaba89162e11b969622663ae4c00fa7c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a2fda0dfaba89162e11b969622663ae4c00fa7c1/minidom.py
print "open", askopenfilename(filetypes=[("all files", "*")]).encode(enc) print "saveas", asksaveasfilename().encode(enc)
def askdirectory (**options): "Ask for a directory, and return the file name" return Directory(**options).show()
8509ebc8f7f5ba7a5691e890179225ba5457a688 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8509ebc8f7f5ba7a5691e890179225ba5457a688/tkFileDialog.py
if __debug__: stderr = re.sub(r"\[\d+ refs\]\r?\n?$", "", stderr) return stderr
return re.sub(r"\[\d+ refs\]\r?\n?$", "", stderr)
def remove_stderr_debug_decorations(stderr): if __debug__: stderr = re.sub(r"\[\d+ refs\]\r?\n?$", "", stderr) return stderr
1dbf2434d57566f831122b781d90c67536552548 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1dbf2434d57566f831122b781d90c67536552548/test_subprocess.py
def _(s): return s
try: import fintl _ = fintl.gettext except ImportError: def _(s): return s
def _(s): return s
c8f0892d1236df81af1811cf182692f28c85f916 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c8f0892d1236df81af1811cf182692f28c85f916/pygettext.py
for i in range(256): if i < 32 or i > 127: escapes.append("\\%03o" % i) else: escapes.append(chr(i)) escapes[ord('\\')] = '\\\\' escapes[ord('\t')] = '\\t' escapes[ord('\r')] = '\\r' escapes[ord('\n')] = '\\n' escapes[ord('\"')] = '\\"'
def make_escapes(pass_iso8859): global escapes for i in range(256): if pass_iso8859: i = i % 128 if 32 <= i <= 126: escapes.append(chr(i)) else: escapes.append("\\%03o" % i) escapes[ord('\\')] = '\\\\' escapes[ord('\t')] = '\\t' escapes[ord('\r')] = '\\r' escapes[ord('\n')] = '\\n' escapes[ord('\"')] = '\\"'
def usage(code, msg=''): print __doc__ % globals() if msg: print msg sys.exit(code)
c8f0892d1236df81af1811cf182692f28c85f916 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c8f0892d1236df81af1811cf182692f28c85f916/pygettext.py
entry = (self.__curfile, self.__lineno) linenos = self.__messages.get(msg) if linenos is None: self.__messages[msg] = [entry] else: linenos.append(entry)
if not msg in self.__options.toexclude: entry = (self.__curfile, self.__lineno) linenos = self.__messages.get(msg) if linenos is None: self.__messages[msg] = [entry] else: linenos.append(entry)
def __openseen(self, ttype, tstring, lineno): if ttype == tokenize.OP and tstring == ')': # We've seen the last of the translatable strings. Record the # line number of the first line of the strings and update the list # of messages seen. Reset state for the next batch. If there # were no strings inside _(), then just ignore this entry. if self.__data: msg = string.join(self.__data, '') entry = (self.__curfile, self.__lineno) linenos = self.__messages.get(msg) if linenos is None: self.__messages[msg] = [entry] else: linenos.append(entry) self.__state = self.__waiting elif ttype == tokenize.STRING: self.__data.append(safe_eval(tstring)) # TBD: should we warn if we seen anything else?
c8f0892d1236df81af1811cf182692f28c85f916 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c8f0892d1236df81af1811cf182692f28c85f916/pygettext.py
print pot_header % {'time': timestamp, 'version':__version__}
print pot_header % {'time': timestamp, 'version': __version__}
def write(self, fp): options = self.__options timestamp = time.ctime(time.time()) # common header try: sys.stdout = fp # The time stamp in the header doesn't have the same format # as that generated by xgettext... print pot_header % {'time': timestamp, 'version':__version__} for k, v in self.__messages.items(): for filename, lineno in v: # location comments are different b/w Solaris and GNU d = {'filename': filename, 'lineno': lineno} if options.location == options.SOLARIS: print _('# File: %(filename)s, line: %(lineno)d') % d elif options.location == options.GNU: print _('#: %(filename)s:%(lineno)d') % d # TBD: sorting, normalizing print 'msgid', normalize(k) print 'msgstr ""' print finally: sys.stdout = sys.__stdout__
c8f0892d1236df81af1811cf182692f28c85f916 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c8f0892d1236df81af1811cf182692f28c85f916/pygettext.py
for filename, lineno in v: d = {'filename': filename, 'lineno': lineno} if options.location == options.SOLARIS:
if options.location == options.SOLARIS: for filename, lineno in v: d = {'filename': filename, 'lineno': lineno}
def write(self, fp): options = self.__options timestamp = time.ctime(time.time()) # common header try: sys.stdout = fp # The time stamp in the header doesn't have the same format # as that generated by xgettext... print pot_header % {'time': timestamp, 'version':__version__} for k, v in self.__messages.items(): for filename, lineno in v: # location comments are different b/w Solaris and GNU d = {'filename': filename, 'lineno': lineno} if options.location == options.SOLARIS: print _('# File: %(filename)s, line: %(lineno)d') % d elif options.location == options.GNU: print _('#: %(filename)s:%(lineno)d') % d # TBD: sorting, normalizing print 'msgid', normalize(k) print 'msgstr ""' print finally: sys.stdout = sys.__stdout__
c8f0892d1236df81af1811cf182692f28c85f916 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c8f0892d1236df81af1811cf182692f28c85f916/pygettext.py
elif options.location == options.GNU: print _('
elif options.location == options.GNU: locline = ' for filename, lineno in v: d = {'filename': filename, 'lineno': lineno} s = _(' %(filename)s:%(lineno)d') % d if len(locline) + len(s) <= options.width: locline = locline + s else: print locline locline = " if len(locline) > 2: print locline
def write(self, fp): options = self.__options timestamp = time.ctime(time.time()) # common header try: sys.stdout = fp # The time stamp in the header doesn't have the same format # as that generated by xgettext... print pot_header % {'time': timestamp, 'version':__version__} for k, v in self.__messages.items(): for filename, lineno in v: # location comments are different b/w Solaris and GNU d = {'filename': filename, 'lineno': lineno} if options.location == options.SOLARIS: print _('# File: %(filename)s, line: %(lineno)d') % d elif options.location == options.GNU: print _('#: %(filename)s:%(lineno)d') % d # TBD: sorting, normalizing print 'msgid', normalize(k) print 'msgstr ""' print finally: sys.stdout = sys.__stdout__
c8f0892d1236df81af1811cf182692f28c85f916 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c8f0892d1236df81af1811cf182692f28c85f916/pygettext.py
print 'msgstr ""' print
print 'msgstr ""\n'
def write(self, fp): options = self.__options timestamp = time.ctime(time.time()) # common header try: sys.stdout = fp # The time stamp in the header doesn't have the same format # as that generated by xgettext... print pot_header % {'time': timestamp, 'version':__version__} for k, v in self.__messages.items(): for filename, lineno in v: # location comments are different b/w Solaris and GNU d = {'filename': filename, 'lineno': lineno} if options.location == options.SOLARIS: print _('# File: %(filename)s, line: %(lineno)d') % d elif options.location == options.GNU: print _('#: %(filename)s:%(lineno)d') % d # TBD: sorting, normalizing print 'msgid', normalize(k) print 'msgstr ""' print finally: sys.stdout = sys.__stdout__
c8f0892d1236df81af1811cf182692f28c85f916 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c8f0892d1236df81af1811cf182692f28c85f916/pygettext.py
'k:d:n:hv', ['keyword', 'default-domain', 'help', 'add-location=', 'no-location', 'verbose'])
'ad:Ehk:n:o:p:Vvw:x:', ['extract-all', 'default-domain', 'escape', 'help', 'keyword', 'add-location', 'no-location', 'output=', 'output-dir=', 'verbose', 'version', 'width=', 'exclude-file=', ])
def main(): default_keywords = ['_'] try: opts, args = getopt.getopt( sys.argv[1:], 'k:d:n:hv', ['keyword', 'default-domain', 'help', 'add-location=', 'no-location', 'verbose']) except getopt.error, msg: usage(1, msg) # for holding option values class Options: # constants GNU = 1 SOLARIS = 2 # defaults keywords = [] outfile = 'messages.pot' location = GNU verbose = 0 options = Options() locations = {'gnu' : options.GNU, 'solaris' : options.SOLARIS, } # parse options for opt, arg in opts: if opt in ('-h', '--help'): usage(0) elif opt in ('-k', '--keyword'): if arg is None: default_keywords = [] options.keywords.append(arg) elif opt in ('-d', '--default-domain'): options.outfile = arg + '.pot' elif opt in ('-n', '--add-location'): if arg is None: arg = 'gnu' try: options.location = locations[string.lower(arg)] except KeyError: d = {'arg':arg} usage(1, _('Invalid value for --add-location: %(arg)s') % d) elif opt in ('--no-location',): options.location = 0 elif opt in ('-v', '--verbose'): options.verbose = 1 # calculate all keywords options.keywords.extend(default_keywords) # slurp through all the files eater = TokenEater(options) for filename in args: if options.verbose: print _('Working on %(filename)s') % {'filename':filename} fp = open(filename) eater.set_filename(filename) tokenize.tokenize(fp.readline, eater) fp.close() fp = open(options.outfile, 'w') eater.write(fp) fp.close()
c8f0892d1236df81af1811cf182692f28c85f916 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c8f0892d1236df81af1811cf182692f28c85f916/pygettext.py
elif opt in ('-d', '--default-domain'): options.outfile = arg + '.pot'
def main(): default_keywords = ['_'] try: opts, args = getopt.getopt( sys.argv[1:], 'k:d:n:hv', ['keyword', 'default-domain', 'help', 'add-location=', 'no-location', 'verbose']) except getopt.error, msg: usage(1, msg) # for holding option values class Options: # constants GNU = 1 SOLARIS = 2 # defaults keywords = [] outfile = 'messages.pot' location = GNU verbose = 0 options = Options() locations = {'gnu' : options.GNU, 'solaris' : options.SOLARIS, } # parse options for opt, arg in opts: if opt in ('-h', '--help'): usage(0) elif opt in ('-k', '--keyword'): if arg is None: default_keywords = [] options.keywords.append(arg) elif opt in ('-d', '--default-domain'): options.outfile = arg + '.pot' elif opt in ('-n', '--add-location'): if arg is None: arg = 'gnu' try: options.location = locations[string.lower(arg)] except KeyError: d = {'arg':arg} usage(1, _('Invalid value for --add-location: %(arg)s') % d) elif opt in ('--no-location',): options.location = 0 elif opt in ('-v', '--verbose'): options.verbose = 1 # calculate all keywords options.keywords.extend(default_keywords) # slurp through all the files eater = TokenEater(options) for filename in args: if options.verbose: print _('Working on %(filename)s') % {'filename':filename} fp = open(filename) eater.set_filename(filename) tokenize.tokenize(fp.readline, eater) fp.close() fp = open(options.outfile, 'w') eater.write(fp) fp.close()
c8f0892d1236df81af1811cf182692f28c85f916 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c8f0892d1236df81af1811cf182692f28c85f916/pygettext.py
login = account = password = None
login = '' account = password = None
# Look for a machine, default, or macdef top-level keyword
b34ef94d460ec0dcf8bdd12da8834bf097f826f6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b34ef94d460ec0dcf8bdd12da8834bf097f826f6/netrc.py