blob: aba83f8c3378389a9d10a2a1b757c369ccfceebf [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
15untrusted source code.
16
17
18\begin{funcdesc}{readmodule}{module\optional{, path}}
19 % The 'inpackage' parameter appears to be for internal use only....
20 Read a module and return a dictionary mapping class names to class
21 descriptor objects. The parameter \var{module} should be the name
22 of a module as a string; it may be the name of a module within a
23 package. The \var{path} parameter should be a sequence, and is used
24 to augment the value of \code{sys.path}, which is used to locate
25 module source code.
26\end{funcdesc}
27
28
29\subsection{Class Descriptor Objects \label{pyclbr-class-objects}}
30
31The class descriptor objects used as values in the dictionary returned
32by \function{readmodule()} provide the following data members:
33
34
Fred Drake7ceb5771999-04-20 18:18:53 +000035\begin{memberdesc}[class descriptor]{module}
36 The name of the module defining the class described by the class
37 descriptor.
38\end{memberdesc}
39
Fred Drake6b103f11999-02-18 21:06:50 +000040\begin{memberdesc}[class descriptor]{name}
41 The name of the class.
42\end{memberdesc}
43
44\begin{memberdesc}[class descriptor]{super}
45 A list of class descriptors which describe the immediate base
46 classes of the class being described. Classes which are named as
47 superclasses but which are not discoverable by
48 \function{readmodule()} are listed as a string with the class name
49 instead of class descriptors.
50\end{memberdesc}
51
52\begin{memberdesc}[class descriptor]{methods}
53 A dictionary mapping method names to line numbers.
54\end{memberdesc}
55
56\begin{memberdesc}[class descriptor]{file}
57 Name of the file containing the class statement defining the class.
58\end{memberdesc}
59
60\begin{memberdesc}[class descriptor]{lineno}
61 The line number of the class statement within the file named by
62 \member{file}.
63\end{memberdesc}