Back to index

python3.2  3.2.2
Public Member Functions | Static Public Attributes
pydoc.Doc Class Reference
Inheritance diagram for pydoc.Doc:
Inheritance graph
[legend]

List of all members.

Public Member Functions

def document
def fail
def getdocloc

Static Public Attributes

tuple PYTHONDOCS
 docmodule = docclassdocroutinedocotherdocpropertydocdatafail

Detailed Description

Definition at line 322 of file pydoc.py.


Member Function Documentation

def pydoc.Doc.document (   self,
  object,
  name = None,
  args 
)
Generate documentation for an object.

Definition at line 328 of file pydoc.py.

00328 
00329     def document(self, object, name=None, *args):
00330         """Generate documentation for an object."""
00331         args = (object, name) + args
00332         # 'try' clause is to attempt to handle the possibility that inspect
00333         # identifies something in a way that pydoc itself has issues handling;
00334         # think 'super' and how it is a descriptor (which raises the exception
00335         # by lacking a __name__ attribute) and an instance.
00336         if inspect.isgetsetdescriptor(object): return self.docdata(*args)
00337         if inspect.ismemberdescriptor(object): return self.docdata(*args)
00338         try:
00339             if inspect.ismodule(object): return self.docmodule(*args)
00340             if inspect.isclass(object): return self.docclass(*args)
00341             if inspect.isroutine(object): return self.docroutine(*args)
00342         except AttributeError:
00343             pass
00344         if isinstance(object, property): return self.docproperty(*args)
00345         return self.docother(*args)

Here is the call graph for this function:

Here is the caller graph for this function:

def pydoc.Doc.fail (   self,
  object,
  name = None,
  args 
)
Raise an exception for unimplemented types.

Definition at line 346 of file pydoc.py.

00346 
00347     def fail(self, object, name=None, *args):
00348         """Raise an exception for unimplemented types."""
00349         message = "don't know how to document object%s of type %s" % (
00350             name and ' ' + repr(name), type(object).__name__)
00351         raise TypeError(message)

def pydoc.Doc.getdocloc (   self,
  object 
)
Return the location of module docs or None

Definition at line 354 of file pydoc.py.

00354 
00355     def getdocloc(self, object):
00356         """Return the location of module docs or None"""
00357 
00358         try:
00359             file = inspect.getabsfile(object)
00360         except TypeError:
00361             file = '(built-in)'
00362 
00363         docloc = os.environ.get("PYTHONDOCS", self.PYTHONDOCS)
00364 
00365         basedir = os.path.join(sys.exec_prefix, "lib",
00366                                "python%d.%d" %  sys.version_info[:2])
00367         if (isinstance(object, type(os)) and
00368             (object.__name__ in ('errno', 'exceptions', 'gc', 'imp',
00369                                  'marshal', 'posix', 'signal', 'sys',
00370                                  '_thread', 'zipimport') or
00371              (file.startswith(basedir) and
00372               not file.startswith(os.path.join(basedir, 'site-packages')))) and
00373             object.__name__ not in ('xml.etree', 'test.pydoc_mod')):
00374             if docloc.startswith("http://"):
00375                 docloc = "%s/%s" % (docloc.rstrip("/"), object.__name__)
00376             else:
00377                 docloc = os.path.join(docloc, object.__name__ + ".html")
00378         else:
00379             docloc = None
00380         return docloc
00381 
00382 # -------------------------------------------- HTML documentation generator

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

pydoc.Doc.docmodule = docclassdocroutinedocotherdocpropertydocdatafail [static]

Definition at line 352 of file pydoc.py.

tuple pydoc.Doc.PYTHONDOCS [static]
Initial value:
os.environ.get("PYTHONDOCS",
                                "http://docs.python.org/%d.%d/library"
                                % sys.version_info[:2])

Definition at line 324 of file pydoc.py.


The documentation for this class was generated from the following file: