blob: 7381e4e9976860523ddf4fb53b87d3cb82f0ab3b [file] [log] [blame]
Fred Drake6b103f11999-02-18 21:06:50 +00001\section{\module{pyclbr} ---
2 Python class browser information}
3
4\declaremodule{standard}{pyclbr}
5\modulesynopsis{Supports information extraction for a Python class
6browser.}
7\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
35\begin{memberdesc}[class descriptor]{name}
36 The name of the class.
37\end{memberdesc}
38
39\begin{memberdesc}[class descriptor]{super}
40 A list of class descriptors which describe the immediate base
41 classes of the class being described. Classes which are named as
42 superclasses but which are not discoverable by
43 \function{readmodule()} are listed as a string with the class name
44 instead of class descriptors.
45\end{memberdesc}
46
47\begin{memberdesc}[class descriptor]{methods}
48 A dictionary mapping method names to line numbers.
49\end{memberdesc}
50
51\begin{memberdesc}[class descriptor]{file}
52 Name of the file containing the class statement defining the class.
53\end{memberdesc}
54
55\begin{memberdesc}[class descriptor]{lineno}
56 The line number of the class statement within the file named by
57 \member{file}.
58\end{memberdesc}