File: epydoc.imports-module.html

package info (click to toggle)
epydoc 2.1-8
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 5,364 kB
  • ctags: 2,878
  • sloc: python: 9,010; makefile: 85; sh: 73
file content (345 lines) | stat: -rw-r--r-- 16,713 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>epydoc.imports</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css"></link>
</head>
<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">

<!-- =========== START OF NAVBAR =========== -->
<table class="navbar" border="0" width="100%" cellpadding="0" bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="center">
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="epydoc-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="trees.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="indices.html">Index</a>&nbsp;&nbsp;&nbsp;</th>
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
    <th class="navbar" align="right" width="100%">
      <table border="0" cellpadding="0" cellspacing="0">
      <tr><th class="navbar" align="center">
        <p class="nomargin">
          <a class="navbar" target="_top" href="http://epydoc.sourceforge.net">epydoc 2.0</a>
      </p></th></tr></table>
    </th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <font size="-1"><b class="breadcrumbs">
        <a href="epydoc-module.html">Package&nbsp;epydoc</a> ::
        Module&nbsp;imports
      </b></font></br>
    </td>
    <td><table cellpadding="0" cellspacing="0">
      <tr><td align="right"><font size="-2">[show&nbsp;private&nbsp;|&nbsp;<a href="../public/epydoc.imports-module.html">hide&nbsp;private</a>]</font></td></tr>
      <tr><td align="right"><font size="-2">[<a href="frames.html"target="_top">frames</a>&nbsp;|&nbsp;<a href="epydoc.imports-module.html" target="_top">no&nbsp;frames</a>]</font></td></tr>
    </table></td>
</tr></table>

<!-- =========== START OF MODULE DESCRIPTION =========== -->
<h2 class="module">Module epydoc.imports</h2>

Module import support for epydoc.
<hr/>

<!-- =========== START OF CLASSES =========== -->
<table class="summary" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="summary">
  <th colspan="2">Classes</th></tr>
<tr><td width="15%">
  <b><a href="../private/epydoc.imports._DevNull-class.html"><code>_DevNull</code></a></b></td>
  <td>A &quot;file-like&quot; object that discards anything that is written 
and always reports end-of-file when read.</td></tr>
</table><br />


<!-- =========== START OF FUNCTION SUMMARY =========== -->
<table class="summary" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="summary">
  <th colspan="2">Function Summary</th></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">        <code>list</code> of <code>string</code>
</font></td>
  <td><code><span class="summary-sig"><a href="epydoc.imports-module.html#find_modules" class="summary-sig-name"><code>find_modules</code></a>(<span class=summary-sig-arg>dirname</span>)</span></code>
<br />
If <code>dirname</code> contains a package, then return the filenames 
for the package, its modules, and all of its descendant packages and 
modules.</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">        <code>list</code> of <code>module</code>
</font></td>
  <td><code><span class="summary-sig"><a href="epydoc.imports-module.html#import_module" class="summary-sig-name"><code>import_module</code></a>(<span class=summary-sig-arg>name_or_filename</span>)</span></code>
<br />
Return the module with the given module name or filename.</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">        <code>(string, string)</code>
</font></td>
  <td><code><span class="summary-sig"><a href="../private/epydoc.imports-module.html#_find_module_from_filename" class="summary-sig-name"><code>_find_module_from_filename</code></a>(<span class=summary-sig-arg>filename</span>)</span></code>
<br />
Break a module/package filename into a base directory and a module 
name.</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">&nbsp;</font></td>
  <td><code><span class="summary-sig"><a href="../private/epydoc.imports-module.html#_find_modules" class="summary-sig-name"><code>_find_modules</code></a>(<span class=summary-sig-arg>pkg</span>)</span></code>
<br />
Helper function for <a href="epydoc.imports-module.html#find_modules" 
class="link"><code>find_modules</code></a>.</td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1">        <code>module</code>
</font></td>
  <td><code><span class="summary-sig"><a href="../private/epydoc.imports-module.html#_import_module" class="summary-sig-name"><code>_import_module</code></a>(<span class=summary-sig-arg>name</span>)</span></code>
<br />
Return the module with the given name.</td></tr>
</table><br />


<!-- =========== START OF VARIABLE SUMMARY =========== -->
<table class="summary" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="summary">
  <th colspan="2">Variable Summary</th></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1"><a href="../private/epydoc.imports._DevNull-class.html" 
          class="link"><code>_DevNull</code></a></font></td>
<td><b><a href="../private/epydoc.imports-module.html#_dev_null"><code>_dev_null</code></a></b> = <span title="&lt;epydoc.imports._DevNull instance at 0x819a044&gt;"><code>&lt;epydoc.imports._DevNull&nbsp;instance&nbsp;at&nbsp;0x819a0<span class="variable-ellipsis">...</span></code>
</span></td></tr>
<tr><td align="right" valign="top" width="15%"><font size="-1"><code>SRE_Pattern</code></font></td>
<td><b><a href="../private/epydoc.imports-module.html#_VALID_MODULE_NAME"><code>_VALID_MODULE_NAME</code></a></b> = <span title="&lt;_sre.SRE_Pattern object at 0x819a540&gt;"><code><span class="re"><span class="re-char">^</span><span class="re-group">[</span>a<span class="re-group">-</span>zA<span class="re-group">-</span>Z_<span class="re-group">]</span><span class="re-char">\w</span><span class="re-op">*</span><span class="re-group">(</span><span class="re-char">\.</span><span class="re-group">[</span>a<span class="re-group">-</span>zA<span class="re-group">-</span>Z_<span class="re-group">]</span><span class="re-char">\w</span><span class="re-op">*</span><span class="re-group">)</span><span class="re-op">*</span><span class="re-char">$</span></span>     </code>
</span></td></tr>
</table><br />


<!-- =========== START OF FUNCTION DETAILS =========== -->
<table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="details">
  <th colspan="2">Function Details</th></tr>
</table>

<a name="find_modules"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
  <h3><span class="sig"><span class="sig-name">find_modules</span>(<span class=sig-arg>dirname</span>)</span>
  </h3>
  If <code>dirname</code> contains a package, then return the 
  filenames for the package, its modules, and all of its descendant 
  packages and modules. If <code>dirname</code> does not contain a 
  package, then return an empty list.
  <dl><dt></dt><dd>
    <dl><dt><b>Parameters:</b></dt>
      <dd><code><b>dirname</b></code> -
         The directory name to search.
        <br /><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        (type=<code>string</code>)</i>
      </dd>
    </dl>
    <dl><dt><b>Returns:</b></dt>
      <dd>
        The filenames for the package in <code>dirname</code>, its 
        modules, and all of its descendant packages and modules.
        <br /><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        (type=<code>list</code> of <code>string</code>)</i>
      </dd>
    </dl>
  </dd></dl>
</td></tr></table>

<a name="import_module"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
  <h3><span class="sig"><span class="sig-name">import_module</span>(<span class=sig-arg>name_or_filename</span>)</span>
  </h3>
  <dl><dt></dt><dd>
    <dl><dt><b>Parameters:</b></dt>
      <dd><code><b>name_or_filename</b></code> -
         The module name or filename specifying which module to 
        import.
        <br /><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        (type=<code>string</code>)</i>
      </dd>
    </dl>
    <dl><dt><b>Returns:</b></dt>
      <dd>
        The module with the given module name or filename.
        <ul>
          <li>
            If <code>name_or_filename</code> is the name of a module 
            (such as <code>os.path</code>), then return that module.
          </li>
          <li>
            If <code>name_or_filename</code> is the name of a file 
            (such as <code>epytext.py</code> or 
            <code>multiarray.so</code>), then return the module defined 
            by that file.
          </li>
        </ul>
        If <code>name_or_filename</code> names both a file and a 
        module, then <code>import_module</code> will treat it as a file 
        name.
        <br /><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        (type=<code>list</code> of <code>module</code>)</i>
      </dd>
    </dl>
    <dl><dt><b>Raises:</b></dt>
      <dd><code><b>ImportError</b></code> -
        If there was any problem importing the given object. In 
        particular, an <code>ImportError</code> is raised if the given 
        file does not exist; if the given file name does not name a valid 
        module; or if importing the module causes any exception to be 
        raised.
    </dl>
  </dd></dl>
</td></tr></table>

<a name="_find_module_from_filename"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
  <h3><span class="sig"><span class="sig-name">_find_module_from_filename</span>(<span class=sig-arg>filename</span>)</span>
  </h3>
  Break a module/package filename into a base directory and a module 
  name. <code>_find_module_from_filename</code> checks directories in the 
  filename to see if they contain <code>&quot;__init__.py&quot;</code> 
  files; if they do, then it assumes that the module is part of a 
  package, and returns the full module name. For example, if 
  <code>filename</code> is 
  <code>&quot;/tmp/epydoc/imports.py&quot;</code>, and the file 
  <code>&quot;/tmp/epydoc/__init__.py&quot;</code> exists, then the base 
  directory will be <code>&quot;/tmp/&quot;</code> and the module name 
  will be <code>&quot;epydoc.imports&quot;</code>.
  <dl><dt></dt><dd>
    <dl><dt><b>Parameters:</b></dt>
      <dd><code><b>filename</b></code> -
         The filename that contains the module. <code>filename</code> 
        can be a directory (for a package); a <code>.py</code> file; a 
        <code>.pyc</code> file; a <code>.pyo</code> file; or an 
        <code>.so</code> file.
        <br /><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        (type=<code>string</code>)</i>
      </dd>
    </dl>
    <dl><dt><b>Returns:</b></dt>
      <dd>
        A pair <code>(basedir, module)</code>, where 
        <code>basedir</code> is the base directory from which the module 
        can be imported; and <code>module</code> is the name of the 
        module itself.
        <br /><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        (type=<code>(string, string)</code>)</i>
      </dd>
    </dl>
  </dd></dl>
</td></tr></table>

<a name="_find_modules"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
  <h3><span class="sig"><span class="sig-name">_find_modules</span>(<span class=sig-arg>pkg</span>)</span>
  </h3>
  Helper function for <a 
  href="epydoc.imports-module.html#find_modules" 
  class="link"><code>find_modules</code></a>.
  <dl><dt></dt><dd>
  </dd></dl>
</td></tr></table>

<a name="_import_module"></a>
<table width="100%" class="func-details" bgcolor="#e0e0e0"><tr><td>
  <h3><span class="sig"><span class="sig-name">_import_module</span>(<span class=sig-arg>name</span>)</span>
  </h3>
  <dl><dt></dt><dd>
    <dl><dt><b>Parameters:</b></dt>
      <dd><code><b>name</b></code> -
         The name of the module to import. <code>name</code> is a fully 
        qualified module name, such as <code>os.path</code>.
        <br /><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        (type=<code>string</code>)</i>
      </dd>
    </dl>
    <dl><dt><b>Returns:</b></dt>
      <dd>
        the module with the given name. <code>import_module</code> 
        makes some attempts to prevent the imported module from modifying 
        <code>sys</code> and <code>__builtins__</code>. In the future, 
        more sandboxing might be added (e.g., using the 
        <code>rexec</code> module).
        <br /><i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        (type=<code>module</code>)</i>
      </dd>
    </dl>
    <dl><dt><b>Raises:</b></dt>
      <dd><code><b>ImportError</b></code> -
        If there was any problem importing the given object. In 
        particular, if importing the module causes any exception to be 
        raised.
    </dl>
  </dd></dl>
</td></tr></table>
<br />


<!-- =========== START OF VARIABLE DETAILS =========== -->
<table class="details" border="1" cellpadding="3" cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="details">
  <th colspan="2">Variable Details</th></tr>
</table>
<table width="100%" class="var-details" bgcolor="#e0e0e0"><tr><td>
<a name="_dev_null"></a>
<h3>_dev_null</h3>
<dl>
  <dt></dt>
  <dd>
    <dl>
      <dt><b>Type:</b></dt>
      <dd>
          <a href="../private/epydoc.imports._DevNull-class.html" 
          class="link"><code>_DevNull</code></a>

      </dd>
<span title="&lt;epydoc.imports._DevNull instance at 0x819a044&gt;">      <dt><b>Value:</b></dt>
      <dd><table><tr><td>
<pre class="variable">
&lt;epydoc.imports._DevNull instance at 0x819a044&gt;                        </pre>
        </td></tr></table></dd>
</span>    </dl>
  </dd>
</dl></td></tr></table>
<table width="100%" class="var-details" bgcolor="#e0e0e0"><tr><td>
<a name="_VALID_MODULE_NAME"></a>
<h3>_VALID_MODULE_NAME</h3>
<dl>
  <dt></dt>
  <dd>
    <dl>
      <dt><b>Type:</b></dt>
      <dd>
          <code>SRE_Pattern</code>

      </dd>
<span title="&lt;_sre.SRE_Pattern object at 0x819a540&gt;">      <dt><b>Value:</b></dt>
      <dd><table><tr><td>
<pre class="variable">
<span class="re"><span class="re-char">^</span><span class="re-group">[</span>a<span class="re-group">-</span>zA<span class="re-group">-</span>Z_<span class="re-group">]</span><span class="re-char">\w</span><span class="re-op">*</span><span class="re-group">(</span><span class="re-char">\.</span><span class="re-group">[</span>a<span class="re-group">-</span>zA<span class="re-group">-</span>Z_<span class="re-group">]</span><span class="re-char">\w</span><span class="re-op">*</span><span class="re-group">)</span><span class="re-op">*</span><span class="re-char">$</span></span>                                        </pre>
        </td></tr></table></dd>
</span>    </dl>
  </dd>
</dl></td></tr></table>
<br />


<!-- =========== START OF NAVBAR =========== -->
<table class="navbar" border="0" width="100%" cellpadding="0" bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="center">
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="epydoc-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="trees.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="indices.html">Index</a>&nbsp;&nbsp;&nbsp;</th>
    <th class="navbar">&nbsp;&nbsp;&nbsp;<a class="navbar" href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
    <th class="navbar" align="right" width="100%">
      <table border="0" cellpadding="0" cellspacing="0">
      <tr><th class="navbar" align="center">
        <p class="nomargin">
          <a class="navbar" target="_top" href="http://epydoc.sourceforge.net">epydoc 2.0</a>
      </p></th></tr></table>
    </th>
  </tr>
</table>

<table border="0" cellpadding="0" cellspacing="0" width="100%">
  <tr>
    <td align="left"><font size="-2">Generated by Epydoc 2.1 on Sat Mar 20 17:46:16 2004</font></td>
    <td align="right"><a href="http://epydoc.sourceforge.net"
                      ><font size="-2">http://epydoc.sf.net</font></a></td>
  </tr>
</table>
</body>
</html>