rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
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)
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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)
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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)
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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)
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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)
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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)
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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)
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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)
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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)
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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)
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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)
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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)
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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 = ''
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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 = ''
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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 = ''
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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 = ''
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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 = ''
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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 = ''
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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 = ''
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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))
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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)
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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)
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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)
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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)
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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 = ''
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/pydoc.py
result = '' name = object.__name__
name = object.__name__
def docmodule(self, object): """Produce text documentation for a given module object.""" result = ''
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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 = ''
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/pydoc.py
classes.append(value)
classes.append((key, value))
def docmodule(self, object): """Produce text documentation for a given module object.""" result = ''
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/pydoc.py
funcs.append(value)
funcs.append((key, value))
def docmodule(self, object): """Produce text documentation for a given module object.""" result = ''
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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 = ''
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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 = ''
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/pydoc.py
contents = ''
contents = []
def docmodule(self, object): """Produce text documentation for a given module object.""" result = ''
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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 = ''
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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__
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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__
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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__
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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__
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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'
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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'
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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'
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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'
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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)
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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))
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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))
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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'
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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).
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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).
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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)
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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)
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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 = {}
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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('''
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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,
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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,
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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,
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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)
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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)
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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)
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/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
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/pydoc.py
print 'Problem in %s - %s' % (value.filename, value.args)
print value
def ready(server): print 'server ready at %s' % server.url
54a838fe1421d6e6829cabc42e7f398722140804 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/54a838fe1421d6e6829cabc42e7f398722140804/pydoc.py
sys.stderr.write("WARNING: %s can not be found - standard extensions may not be found" % mapFileName)
sys.stderr.write("WARNING: %s can not be found - standard extensions may not be found\n" % defaultMapName)
def checkextensions(unknown, extra_inis, prefix): # Create a table of frozen extensions defaultMapName = os.path.join( os.path.split(sys.argv[0])[0], "extensions_win32.ini") if not os.path.isfile(defaultMapName): sys.stderr.write("WARNING: %s can not be found - standard extensions may not be found" % mapFileName) else: # must go on end, so other inis can override. extra_inis.append(defaultMapName) ret = [] for mod in unknown: for ini in extra_inis:
dbbf956351e4ff4e4a209068c2dbcfb929a1ad19 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/dbbf956351e4ff4e4a209068c2dbcfb929a1ad19/checkextensions_win32.py
nodes = []
nodesl = []
def expr_stmt(self, nodelist): # augassign testlist | testlist ('=' testlist)* en = nodelist[-1] exprNode = self.lookup_node(en)(en[1:]) if len(nodelist) == 1: n = Discard(exprNode) n.lineno = exprNode.lineno return n if nodelist[1][0] == token.EQUAL: nodes = [] for i in range(0, len(nodelist) - 2, 2): nodes.append(self.com_assign(nodelist[i], OP_ASSIGN)) n = Assign(nodes, exprNode) n.lineno = nodelist[1][2] else: lval = self.com_augassign(nodelist[0]) op = self.com_augassign_op(nodelist[1]) n = AugAssign(lval, op[1], exprNode) n.lineno = op[2] return n
2ef304c322664332896e51f878e74a6fd728abed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2ef304c322664332896e51f878e74a6fd728abed/transformer.py
nodes.append(self.com_assign(nodelist[i], OP_ASSIGN)) n = Assign(nodes, exprNode)
nodesl.append(self.com_assign(nodelist[i], OP_ASSIGN)) n = Assign(nodesl, exprNode)
def expr_stmt(self, nodelist): # augassign testlist | testlist ('=' testlist)* en = nodelist[-1] exprNode = self.lookup_node(en)(en[1:]) if len(nodelist) == 1: n = Discard(exprNode) n.lineno = exprNode.lineno return n if nodelist[1][0] == token.EQUAL: nodes = [] for i in range(0, len(nodelist) - 2, 2): nodes.append(self.com_assign(nodelist[i], OP_ASSIGN)) n = Assign(nodes, exprNode) n.lineno = nodelist[1][2] else: lval = self.com_augassign(nodelist[0]) op = self.com_augassign_op(nodelist[1]) n = AugAssign(lval, op[1], exprNode) n.lineno = op[2] return n
2ef304c322664332896e51f878e74a6fd728abed /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/2ef304c322664332896e51f878e74a6fd728abed/transformer.py
import sys, os, tempfile
import sys, os, tempfile, time
def test_bug737473(self): import sys, os, tempfile savedpath = sys.path[:] testdir = tempfile.mkdtemp() try: sys.path.insert(0, testdir) testfile = os.path.join(testdir, 'test_bug737473.py') print >> open(testfile, 'w'), """\
7eb8d9c4c6cd92ab0a3f003264d94884882bcd31 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/7eb8d9c4c6cd92ab0a3f003264d94884882bcd31/test_traceback.py
os.utime(testfile, (0, 0))
past = time.time() - 3 os.utime(testfile, (past, past))
def test(): raise ValueError""" if hasattr(os, 'utime'): os.utime(testfile, (0, 0)) else: import time time.sleep(3) # not to stay in same mtime. if 'test_bug737473' in sys.modules: del sys.modules['test_bug737473'] import test_bug737473 try: test_bug737473.test() except ValueError: # this loads source code to linecache traceback.extract_tb(sys.exc_traceback) print >> open(testfile, 'w'), """\
7eb8d9c4c6cd92ab0a3f003264d94884882bcd31 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/7eb8d9c4c6cd92ab0a3f003264d94884882bcd31/test_traceback.py
if os.name !='riscos': TESTFN = '@test'
if os.name == 'java': TESTFN = '$test' elif os.name != 'riscos': TESTFN = '@test'
def fcmp(x, y): # fuzzy comparison function if type(x) == type(0.0) or type(y) == type(0.0): try: x, y = coerce(x, y) fuzz = (abs(x) + abs(y)) * FUZZ if abs(x-y) <= fuzz: return 0 except: pass elif type(x) == type(y) and type(x) in (type(()), type([])): for i in range(min(len(x), len(y))): outcome = fcmp(x[i], y[i]) if outcome != 0: return outcome return cmp(len(x), len(y)) return cmp(x, y)
74088a54d012c6d9dbf6e164d0f7e81de0f12a83 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/74088a54d012c6d9dbf6e164d0f7e81de0f12a83/test_support.py
TESTFN = 'test'
TESTFN = 'test'
def fcmp(x, y): # fuzzy comparison function if type(x) == type(0.0) or type(y) == type(0.0): try: x, y = coerce(x, y) fuzz = (abs(x) + abs(y)) * FUZZ if abs(x-y) <= fuzz: return 0 except: pass elif type(x) == type(y) and type(x) in (type(()), type([])): for i in range(min(len(x), len(y))): outcome = fcmp(x[i], y[i]) if outcome != 0: return outcome return cmp(len(x), len(y)) return cmp(x, y)
74088a54d012c6d9dbf6e164d0f7e81de0f12a83 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/74088a54d012c6d9dbf6e164d0f7e81de0f12a83/test_support.py
if os.path.isdir (name):
if os.path.isdir (name) or name == '':
def mkpath (name, mode=0777, verbose=0, dry_run=0): """Create a directory and any missing ancestor directories. If the directory already exists, return silently. Raise DistutilsFileError if unable to create some directory along the way (eg. some sub-path exists, but is a file rather than a directory). If 'verbose' is true, print a one-line summary of each mkdir to stdout.""" global PATH_CREATED # XXX what's the better way to handle verbosity? print as we create # each directory in the path (the current behaviour), or only announce # the creation of the whole path? (quite easy to do the latter since # we're not using a recursive algorithm) name = os.path.normpath (name) if os.path.isdir (name): return if PATH_CREATED.get (name): return (head, tail) = os.path.split (name) tails = [tail] # stack of lone dirs to create while head and tail and not os.path.isdir (head): #print "splitting '%s': " % head, (head, tail) = os.path.split (head) #print "to ('%s','%s')" % (head, tail) tails.insert (0, tail) # push next higher dir onto stack #print "stack of tails:", tails # now 'head' contains the deepest directory that already exists # (that is, the child of 'head' in 'name' is the highest directory # that does *not* exist) for d in tails: #print "head = %s, d = %s: " % (head, d), head = os.path.join (head, d) if PATH_CREATED.get (head): continue if verbose: print "creating", head if not dry_run: try: os.mkdir (head) except os.error, (errno, errstr): raise DistutilsFileError, "%s: %s" % (head, errstr) PATH_CREATED[head] = 1
031994d923a677aa78f425f5289409ea94321872 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/031994d923a677aa78f425f5289409ea94321872/util.py
raise DistutilsFileError, "%s: %s" % (head, errstr)
raise DistutilsFileError, "'%s': %s" % (head, errstr)
def mkpath (name, mode=0777, verbose=0, dry_run=0): """Create a directory and any missing ancestor directories. If the directory already exists, return silently. Raise DistutilsFileError if unable to create some directory along the way (eg. some sub-path exists, but is a file rather than a directory). If 'verbose' is true, print a one-line summary of each mkdir to stdout.""" global PATH_CREATED # XXX what's the better way to handle verbosity? print as we create # each directory in the path (the current behaviour), or only announce # the creation of the whole path? (quite easy to do the latter since # we're not using a recursive algorithm) name = os.path.normpath (name) if os.path.isdir (name): return if PATH_CREATED.get (name): return (head, tail) = os.path.split (name) tails = [tail] # stack of lone dirs to create while head and tail and not os.path.isdir (head): #print "splitting '%s': " % head, (head, tail) = os.path.split (head) #print "to ('%s','%s')" % (head, tail) tails.insert (0, tail) # push next higher dir onto stack #print "stack of tails:", tails # now 'head' contains the deepest directory that already exists # (that is, the child of 'head' in 'name' is the highest directory # that does *not* exist) for d in tails: #print "head = %s, d = %s: " % (head, d), head = os.path.join (head, d) if PATH_CREATED.get (head): continue if verbose: print "creating", head if not dry_run: try: os.mkdir (head) except os.error, (errno, errstr): raise DistutilsFileError, "%s: %s" % (head, errstr) PATH_CREATED[head] = 1
031994d923a677aa78f425f5289409ea94321872 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/031994d923a677aa78f425f5289409ea94321872/util.py
raise DistutilsFileError, "could not open %s: %s" % (src, errstr)
raise DistutilsFileError, \ "could not open '%s': %s" % (src, errstr)
def _copy_file_contents (src, dst, buffer_size=16*1024): """Copy the file 'src' to 'dst'; both must be filenames. Any error opening either file, reading from 'src', or writing to 'dst', raises DistutilsFileError. Data is read/written in chunks of 'buffer_size' bytes (default 16k). No attempt is made to handle anything apart from regular files.""" # Stolen from shutil module in the standard library, but with # custom error-handling added. fsrc = None fdst = None try: try: fsrc = open(src, 'rb') except os.error, (errno, errstr): raise DistutilsFileError, "could not open %s: %s" % (src, errstr) try: fdst = open(dst, 'wb') except os.error, (errno, errstr): raise DistutilsFileError, "could not create %s: %s" % (dst, errstr) while 1: try: buf = fsrc.read (buffer_size) except os.error, (errno, errstr): raise DistutilsFileError, \ "could not read from %s: %s" % (src, errstr) if not buf: break try: fdst.write(buf) except os.error, (errno, errstr): raise DistutilsFileError, \ "could not write to %s: %s" % (dst, errstr) finally: if fdst: fdst.close() if fsrc: fsrc.close()
031994d923a677aa78f425f5289409ea94321872 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/031994d923a677aa78f425f5289409ea94321872/util.py
raise DistutilsFileError, "could not create %s: %s" % (dst, errstr)
raise DistutilsFileError, \ "could not create '%s': %s" % (dst, errstr)
def _copy_file_contents (src, dst, buffer_size=16*1024): """Copy the file 'src' to 'dst'; both must be filenames. Any error opening either file, reading from 'src', or writing to 'dst', raises DistutilsFileError. Data is read/written in chunks of 'buffer_size' bytes (default 16k). No attempt is made to handle anything apart from regular files.""" # Stolen from shutil module in the standard library, but with # custom error-handling added. fsrc = None fdst = None try: try: fsrc = open(src, 'rb') except os.error, (errno, errstr): raise DistutilsFileError, "could not open %s: %s" % (src, errstr) try: fdst = open(dst, 'wb') except os.error, (errno, errstr): raise DistutilsFileError, "could not create %s: %s" % (dst, errstr) while 1: try: buf = fsrc.read (buffer_size) except os.error, (errno, errstr): raise DistutilsFileError, \ "could not read from %s: %s" % (src, errstr) if not buf: break try: fdst.write(buf) except os.error, (errno, errstr): raise DistutilsFileError, \ "could not write to %s: %s" % (dst, errstr) finally: if fdst: fdst.close() if fsrc: fsrc.close()
031994d923a677aa78f425f5289409ea94321872 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/031994d923a677aa78f425f5289409ea94321872/util.py
"could not read from %s: %s" % (src, errstr)
"could not read from '%s': %s" % (src, errstr)
def _copy_file_contents (src, dst, buffer_size=16*1024): """Copy the file 'src' to 'dst'; both must be filenames. Any error opening either file, reading from 'src', or writing to 'dst', raises DistutilsFileError. Data is read/written in chunks of 'buffer_size' bytes (default 16k). No attempt is made to handle anything apart from regular files.""" # Stolen from shutil module in the standard library, but with # custom error-handling added. fsrc = None fdst = None try: try: fsrc = open(src, 'rb') except os.error, (errno, errstr): raise DistutilsFileError, "could not open %s: %s" % (src, errstr) try: fdst = open(dst, 'wb') except os.error, (errno, errstr): raise DistutilsFileError, "could not create %s: %s" % (dst, errstr) while 1: try: buf = fsrc.read (buffer_size) except os.error, (errno, errstr): raise DistutilsFileError, \ "could not read from %s: %s" % (src, errstr) if not buf: break try: fdst.write(buf) except os.error, (errno, errstr): raise DistutilsFileError, \ "could not write to %s: %s" % (dst, errstr) finally: if fdst: fdst.close() if fsrc: fsrc.close()
031994d923a677aa78f425f5289409ea94321872 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/031994d923a677aa78f425f5289409ea94321872/util.py
"could not write to %s: %s" % (dst, errstr)
"could not write to '%s': %s" % (dst, errstr)
def _copy_file_contents (src, dst, buffer_size=16*1024): """Copy the file 'src' to 'dst'; both must be filenames. Any error opening either file, reading from 'src', or writing to 'dst', raises DistutilsFileError. Data is read/written in chunks of 'buffer_size' bytes (default 16k). No attempt is made to handle anything apart from regular files.""" # Stolen from shutil module in the standard library, but with # custom error-handling added. fsrc = None fdst = None try: try: fsrc = open(src, 'rb') except os.error, (errno, errstr): raise DistutilsFileError, "could not open %s: %s" % (src, errstr) try: fdst = open(dst, 'wb') except os.error, (errno, errstr): raise DistutilsFileError, "could not create %s: %s" % (dst, errstr) while 1: try: buf = fsrc.read (buffer_size) except os.error, (errno, errstr): raise DistutilsFileError, \ "could not read from %s: %s" % (src, errstr) if not buf: break try: fdst.write(buf) except os.error, (errno, errstr): raise DistutilsFileError, \ "could not write to %s: %s" % (dst, errstr) finally: if fdst: fdst.close() if fsrc: fsrc.close()
031994d923a677aa78f425f5289409ea94321872 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/031994d923a677aa78f425f5289409ea94321872/util.py
"can't copy %s: not a regular file" % src
"can't copy '%s': not a regular file" % src
def copy_file (src, dst, preserve_mode=1, preserve_times=1, update=0, verbose=0, dry_run=0): """Copy a file 'src' to 'dst'. If 'dst' is a directory, then 'src' is copied there with the same name; otherwise, it must be a filename. (If the file exists, it will be ruthlessly clobbered.) If 'preserve_mode' is true (the default), the file's mode (type and permission bits, or whatever is analogous on the current platform) is copied. If 'preserve_times' is true (the default), the last-modified and last-access times are copied as well. If 'update' is true, 'src' will only be copied if 'dst' does not exist, or if 'dst' does exist but is older than 'src'. If 'verbose' is true, then a one-line summary of the copy will be printed to stdout. Return true if the file was copied (or would have been copied), false otherwise (ie. 'update' was true and the destination is up-to-date).""" # XXX doesn't copy Mac-specific metadata from stat import * if not os.path.isfile (src): raise DistutilsFileError, \ "can't copy %s: not a regular file" % src if os.path.isdir (dst): dir = dst dst = os.path.join (dst, os.path.basename (src)) else: dir = os.path.dirname (dst) if update and not newer (src, dst): if verbose: print "not copying %s (output up-to-date)" % src return 0 if verbose: print "copying %s -> %s" % (src, dir) if dry_run: return 1 _copy_file_contents (src, dst) if preserve_mode or preserve_times: st = os.stat (src) # According to David Ascher <[email protected]>, utime() should be done # before chmod() (at least under NT). if preserve_times: os.utime (dst, (st[ST_ATIME], st[ST_MTIME])) if preserve_mode: os.chmod (dst, S_IMODE (st[ST_MODE])) return 1
031994d923a677aa78f425f5289409ea94321872 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/031994d923a677aa78f425f5289409ea94321872/util.py
"cannot copy tree %s: not a directory" % src
"cannot copy tree '%s': not a directory" % src
def copy_tree (src, dst, preserve_mode=1, preserve_times=1, preserve_symlinks=0, update=0, verbose=0, dry_run=0): """Copy an entire directory tree 'src' to a new location 'dst'. Both 'src' and 'dst' must be directory names. If 'src' is not a directory, raise DistutilsFileError. If 'dst' does not exist, it is created with 'mkpath()'. The end result of the copy is that every file in 'src' is copied to 'dst', and directories under 'src' are recursively copied to 'dst'. Return the list of files copied (under their output names) -- note that if 'update' is true, this might be less than the list of files considered. Return value is not affected by 'dry_run'. 'preserve_mode' and 'preserve_times' are the same as for 'copy_file'; note that they only apply to regular files, not to directories. If 'preserve_symlinks' is true, symlinks will be copied as symlinks (on platforms that support them!); otherwise (the default), the destination of the symlink will be copied. 'update' and 'verbose' are the same as for 'copy_file'.""" if not dry_run and not os.path.isdir (src): raise DistutilsFileError, \ "cannot copy tree %s: not a directory" % src try: names = os.listdir (src) except os.error, (errno, errstr): if dry_run: names = [] else: raise DistutilsFileError, \ "error listing files in %s: %s" % (src, errstr) if not dry_run: mkpath (dst, verbose=verbose) outputs = [] for n in names: src_name = os.path.join (src, n) dst_name = os.path.join (dst, n) if preserve_symlinks and os.path.islink (src_name): link_dest = os.readlink (src_name) if verbose: print "linking %s -> %s" % (dst_name, link_dest) if not dry_run: os.symlink (link_dest, dst_name) outputs.append (dst_name) elif os.path.isdir (src_name): outputs.extend ( copy_tree (src_name, dst_name, preserve_mode, preserve_times, preserve_symlinks, update, verbose, dry_run)) else: if (copy_file (src_name, dst_name, preserve_mode, preserve_times, update, verbose, dry_run)): outputs.append (dst_name) return outputs
031994d923a677aa78f425f5289409ea94321872 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/031994d923a677aa78f425f5289409ea94321872/util.py
"error listing files in %s: %s" % (src, errstr)
"error listing files in '%s': %s" % (src, errstr)
def copy_tree (src, dst, preserve_mode=1, preserve_times=1, preserve_symlinks=0, update=0, verbose=0, dry_run=0): """Copy an entire directory tree 'src' to a new location 'dst'. Both 'src' and 'dst' must be directory names. If 'src' is not a directory, raise DistutilsFileError. If 'dst' does not exist, it is created with 'mkpath()'. The end result of the copy is that every file in 'src' is copied to 'dst', and directories under 'src' are recursively copied to 'dst'. Return the list of files copied (under their output names) -- note that if 'update' is true, this might be less than the list of files considered. Return value is not affected by 'dry_run'. 'preserve_mode' and 'preserve_times' are the same as for 'copy_file'; note that they only apply to regular files, not to directories. If 'preserve_symlinks' is true, symlinks will be copied as symlinks (on platforms that support them!); otherwise (the default), the destination of the symlink will be copied. 'update' and 'verbose' are the same as for 'copy_file'.""" if not dry_run and not os.path.isdir (src): raise DistutilsFileError, \ "cannot copy tree %s: not a directory" % src try: names = os.listdir (src) except os.error, (errno, errstr): if dry_run: names = [] else: raise DistutilsFileError, \ "error listing files in %s: %s" % (src, errstr) if not dry_run: mkpath (dst, verbose=verbose) outputs = [] for n in names: src_name = os.path.join (src, n) dst_name = os.path.join (dst, n) if preserve_symlinks and os.path.islink (src_name): link_dest = os.readlink (src_name) if verbose: print "linking %s -> %s" % (dst_name, link_dest) if not dry_run: os.symlink (link_dest, dst_name) outputs.append (dst_name) elif os.path.isdir (src_name): outputs.extend ( copy_tree (src_name, dst_name, preserve_mode, preserve_times, preserve_symlinks, update, verbose, dry_run)) else: if (copy_file (src_name, dst_name, preserve_mode, preserve_times, update, verbose, dry_run)): outputs.append (dst_name) return outputs
031994d923a677aa78f425f5289409ea94321872 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/031994d923a677aa78f425f5289409ea94321872/util.py
try:
def __repr__ (self): try: status = [self.__class__.__module__+"."+self.__class__.__name__] if self.accepting and self.addr: status.append ('listening') elif self.connected: status.append ('connected') if self.addr: if type(self.addr) == types.TupleType: status.append ('%s:%d' % self.addr) else: status.append (self.addr) return '<%s at %#x>' % (' '.join (status), id (self)) except: pass
8c78ff4da0a516b57cb5882531d99104f951b057 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8c78ff4da0a516b57cb5882531d99104f951b057/asyncore.py
if self.addr: if type(self.addr) == types.TupleType:
if self.addr is not None: try:
def __repr__ (self): try: status = [self.__class__.__module__+"."+self.__class__.__name__] if self.accepting and self.addr: status.append ('listening') elif self.connected: status.append ('connected') if self.addr: if type(self.addr) == types.TupleType: status.append ('%s:%d' % self.addr) else: status.append (self.addr) return '<%s at %#x>' % (' '.join (status), id (self)) except: pass
8c78ff4da0a516b57cb5882531d99104f951b057 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8c78ff4da0a516b57cb5882531d99104f951b057/asyncore.py
else: status.append (self.addr)
except TypeError: status.append (repr(self.addr))
def __repr__ (self): try: status = [self.__class__.__module__+"."+self.__class__.__name__] if self.accepting and self.addr: status.append ('listening') elif self.connected: status.append ('connected') if self.addr: if type(self.addr) == types.TupleType: status.append ('%s:%d' % self.addr) else: status.append (self.addr) return '<%s at %#x>' % (' '.join (status), id (self)) except: pass
8c78ff4da0a516b57cb5882531d99104f951b057 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8c78ff4da0a516b57cb5882531d99104f951b057/asyncore.py
except: pass try: ar = repr (self.addr) except AttributeError: ar = 'no self.addr!' return '<__repr__() failed for %s instance at %x (addr=%s)>' % \ (self.__class__.__name__, id (self), ar)
def __repr__ (self): try: status = [self.__class__.__module__+"."+self.__class__.__name__] if self.accepting and self.addr: status.append ('listening') elif self.connected: status.append ('connected') if self.addr: if type(self.addr) == types.TupleType: status.append ('%s:%d' % self.addr) else: status.append (self.addr) return '<%s at %#x>' % (' '.join (status), id (self)) except: pass
8c78ff4da0a516b57cb5882531d99104f951b057 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/8c78ff4da0a516b57cb5882531d99104f951b057/asyncore.py
self._parser = expat.ParserCreate(None, " ",
self._parser = expat.ParserCreate(self._source.getEncoding(), " ",
def reset(self): if self._namespaces: self._parser = expat.ParserCreate(None, " ", intern=self._interning) self._parser.namespace_prefixes = 1 self._parser.StartElementHandler = self.start_element_ns self._parser.EndElementHandler = self.end_element_ns else: self._parser = expat.ParserCreate(intern = self._interning) self._parser.StartElementHandler = self.start_element self._parser.EndElementHandler = self.end_element
9207f3e9ba8dff8fc0d111f8e73d4c505aab0b54 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9207f3e9ba8dff8fc0d111f8e73d4c505aab0b54/expatreader.py
self._parser = expat.ParserCreate(intern = self._interning)
self._parser = expat.ParserCreate(self._source.getEncoding(), intern = self._interning)
def reset(self): if self._namespaces: self._parser = expat.ParserCreate(None, " ", intern=self._interning) self._parser.namespace_prefixes = 1 self._parser.StartElementHandler = self.start_element_ns self._parser.EndElementHandler = self.end_element_ns else: self._parser = expat.ParserCreate(intern = self._interning) self._parser.StartElementHandler = self.start_element self._parser.EndElementHandler = self.end_element
9207f3e9ba8dff8fc0d111f8e73d4c505aab0b54 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/9207f3e9ba8dff8fc0d111f8e73d4c505aab0b54/expatreader.py
try: temp = open(tempname, 'w') except IOError: print '*** Cannot create temp file', `tempname` return
temp = open(tempname, 'w')
def pipethrough(input, command, output): tempname = tempfile.mktemp() try: temp = open(tempname, 'w') except IOError: print '*** Cannot create temp file', `tempname` return copyliteral(input, temp) temp.close() pipe = os.popen(command + ' <' + tempname, 'r') copybinary(pipe, output) pipe.close() os.unlink(tempname)
c9c2c3a74d7c593259898f8c80113d71cffefabe /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c9c2c3a74d7c593259898f8c80113d71cffefabe/mimetools.py
def __init__(self, filename):
def __init__(self, filename, config={}):
def __init__(self, filename): self.items = {} self.filename = filename self.fp = open(filename) self.lineno = 0 self.resolving = {} self.resolved = {} self.pushback = None
24ad536efd2df16be0b70e331446b693b987e1c8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/24ad536efd2df16be0b70e331446b693b987e1c8/unweave.py
rv.append((lineno, pre+'\n'))
rv.append((lineno, pre))
def _readitem(self): """Read the definition of an item. Insert #line where needed. """ rv = [] while 1: lineno, line = self._readline() if not line: break if ENDDEFINITION.search(line): break if BEGINDEFINITION.match(line): self.pushback = lineno, line break mo = USEDEFINITION.match(line) if mo: pre = mo.group('pre') if pre: rv.append((lineno, pre+'\n')) rv.append((lineno, line)) # For simplicity we add #line directives now, if # needed. if mo: post = mo.group('post') if post and post != '\n': rv.append((lineno, post)) return rv
24ad536efd2df16be0b70e331446b693b987e1c8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/24ad536efd2df16be0b70e331446b693b987e1c8/unweave.py
def _readitem(self): """Read the definition of an item. Insert #line where needed. """ rv = [] while 1: lineno, line = self._readline() if not line: break if ENDDEFINITION.search(line): break if BEGINDEFINITION.match(line): self.pushback = lineno, line break mo = USEDEFINITION.match(line) if mo: pre = mo.group('pre') if pre: rv.append((lineno, pre+'\n')) rv.append((lineno, line)) # For simplicity we add #line directives now, if # needed. if mo: post = mo.group('post') if post and post != '\n': rv.append((lineno, post)) return rv
24ad536efd2df16be0b70e331446b693b987e1c8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/24ad536efd2df16be0b70e331446b693b987e1c8/unweave.py
pass
if self.gencomments: if savedcomment or line.strip(): savedcomment.append((lineno, '// '+line)) def _extendlines(self, comment): rv = [] for lineno, line in comment: line = line[:-1] if len(line) < 75: line = line + (75-len(line))*' ' line = line + '\n' rv.append((lineno, line)) return rv
def read(self): """Read the source file and store all definitions""" while 1: lineno, line = self._readline() if not line: break mo = BEGINDEFINITION.search(line) if mo: name = mo.group('name') value = self._readitem() self._define(name, value) else: pass # We could output the TeX code but we don't bother.
24ad536efd2df16be0b70e331446b693b987e1c8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/24ad536efd2df16be0b70e331446b693b987e1c8/unweave.py
if line and line != '\n' and lineno != curlineno:
if self.genlinedirectives and line and line != '\n' and lineno != curlineno:
def _addlinedirectives(self, data): curlineno = -100 rv = [] for lineno, line in data: curlineno = curlineno + 1 if line and line != '\n' and lineno != curlineno: rv.append(self._linedirective(lineno)) curlineno = lineno rv.append(line) return rv
24ad536efd2df16be0b70e331446b693b987e1c8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/24ad536efd2df16be0b70e331446b693b987e1c8/unweave.py
pr = Processor(file)
pr = Processor(file, config)
def process(file, config): pr = Processor(file) pr.read() pr.resolve() for pattern, folder in config: pr.save(folder, pattern)
24ad536efd2df16be0b70e331446b693b987e1c8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/24ad536efd2df16be0b70e331446b693b987e1c8/unweave.py
for pattern, folder in config:
for pattern, folder in config['config']:
def process(file, config): pr = Processor(file) pr.read() pr.resolve() for pattern, folder in config: pr.save(folder, pattern)
24ad536efd2df16be0b70e331446b693b987e1c8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/24ad536efd2df16be0b70e331446b693b987e1c8/unweave.py
confstr = """config = [ ("^.*\.cp$", ":unweave-src"), ("^.*\.h$", ":unweave-include"), ]"""
confstr = DEFAULT_CONFIG
def readconfig(): """Read a configuration file, if it doesn't exist create it.""" configname = sys.argv[0] + '.config' if not os.path.exists(configname): confstr = """config = [ ("^.*\.cp$", ":unweave-src"), ("^.*\.h$", ":unweave-include"),
24ad536efd2df16be0b70e331446b693b987e1c8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/24ad536efd2df16be0b70e331446b693b987e1c8/unweave.py
return namespace['config']
return namespace
def readconfig(): """Read a configuration file, if it doesn't exist create it.""" configname = sys.argv[0] + '.config' if not os.path.exists(configname): confstr = """config = [ ("^.*\.cp$", ":unweave-src"), ("^.*\.h$", ":unweave-include"),
24ad536efd2df16be0b70e331446b693b987e1c8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/24ad536efd2df16be0b70e331446b693b987e1c8/unweave.py
process(fss.as_pathname())
process(fss.as_pathname(), config)
def main(): config = readconfig() if len(sys.argv) > 1: for file in sys.argv[1:]: if file[-3:] == '.nw': print "Processing", file process(file, config) else: print "Skipping", file else: fss, ok = macfs.PromptGetFile("Select .nw source file", "TEXT") if not ok: sys.exit(0) process(fss.as_pathname())
24ad536efd2df16be0b70e331446b693b987e1c8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/24ad536efd2df16be0b70e331446b693b987e1c8/unweave.py