blob: 8e89fcfbf9ab373147b47cca50e7d6be50d90d7e [file] [log] [blame]
Fred Drake6b103f11999-02-18 21:06:50 +00001\section{\module{pyclbr} ---
Fred Drake7ceb5771999-04-20 18:18:53 +00002 Python class browser support}
Fred Drake6b103f11999-02-18 21:06:50 +00003
4\declaremodule{standard}{pyclbr}
5\modulesynopsis{Supports information extraction for a Python class
Fred Drake7ceb5771999-04-20 18:18:53 +00006 browser.}
Fred Drake6b103f11999-02-18 21:06:50 +00007\sectionauthor{Fred L. Drake, Jr.}{fdrake@acm.org}
8
9
10The \module{pyclbr} can be used to determine some limited information
11about the classes and methods defined in a module. The information
12provided is sufficient to implement a traditional three-pane class
13browser. The information is extracted from the source code rather
14than from an imported module, so this module is safe to use with
Fred Drakeef1a0291999-06-29 15:43:02 +000015untrusted source code. This restriction makes it impossible to use
16this module with modules not implemented in Python, including many
17standard and optional extension modules.
Fred Drake6b103f11999-02-18 21:06:50 +000018
19
20\begin{funcdesc}{readmodule}{module\optional{, path}}
21 % The 'inpackage' parameter appears to be for internal use only....
22 Read a module and return a dictionary mapping class names to class
23 descriptor objects. The parameter \var{module} should be the name
24 of a module as a string; it may be the name of a module within a
25 package. The \var{path} parameter should be a sequence, and is used
26 to augment the value of \code{sys.path}, which is used to locate
27 module source code.
28\end{funcdesc}
29
30
31\subsection{Class Descriptor Objects \label{pyclbr-class-objects}}
32
33The class descriptor objects used as values in the dictionary returned
34by \function{readmodule()} provide the following data members:
35
36
Fred Drake7ceb5771999-04-20 18:18:53 +000037\begin{memberdesc}[class descriptor]{module}
38 The name of the module defining the class described by the class
39 descriptor.
40\end{memberdesc}
41
Fred Drake6b103f11999-02-18 21:06:50 +000042\begin{memberdesc}[class descriptor]{name}
43 The name of the class.
44\end{memberdesc}
45
46\begin{memberdesc}[class descriptor]{super}
47 A list of class descriptors which describe the immediate base
48 classes of the class being described. Classes which are named as
49 superclasses but which are not discoverable by
50 \function{readmodule()} are listed as a string with the class name
51 instead of class descriptors.
52\end{memberdesc}
53
54\begin{memberdesc}[class descriptor]{methods}
55 A dictionary mapping method names to line numbers.
56\end{memberdesc}
57
58\begin{memberdesc}[class descriptor]{file}
59 Name of the file containing the class statement defining the class.
60\end{memberdesc}
61
62\begin{memberdesc}[class descriptor]{lineno}
63 The line number of the class statement within the file named by
64 \member{file}.
65\end{memberdesc}