|
1 <?xml version="1.0" encoding="ascii"?> |
|
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
|
3 "DTD/xhtml1-transitional.dtd"> |
|
4 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
|
5 <head> |
|
6 <title>fileutils</title> |
|
7 <link rel="stylesheet" href="epydoc.css" type="text/css" /> |
|
8 <script type="text/javascript" src="epydoc.js"></script> |
|
9 </head> |
|
10 |
|
11 <body bgcolor="white" text="black" link="blue" vlink="#204080" |
|
12 alink="#204080"> |
|
13 <!-- ==================== NAVIGATION BAR ==================== --> |
|
14 <table class="navbar" border="0" width="100%" cellpadding="0" |
|
15 bgcolor="#a0c0ff" cellspacing="0"> |
|
16 <tr valign="middle"> |
|
17 |
|
18 <!-- Tree link --> |
|
19 <th> <a |
|
20 href="module-tree.html">Trees</a> </th> |
|
21 |
|
22 <!-- Index link --> |
|
23 <th> <a |
|
24 href="identifier-index.html">Indices</a> </th> |
|
25 |
|
26 <!-- Help link --> |
|
27 <th> <a |
|
28 href="help.html">Help</a> </th> |
|
29 |
|
30 <th class="navbar" width="100%"></th> |
|
31 </tr> |
|
32 </table> |
|
33 <table width="100%" cellpadding="0" cellspacing="0"> |
|
34 <tr valign="top"> |
|
35 <td width="100%"> |
|
36 <span class="breadcrumbs"> |
|
37 Module fileutils |
|
38 </span> |
|
39 </td> |
|
40 <td> |
|
41 <table cellpadding="0" cellspacing="0"> |
|
42 <!-- hide/show private --> |
|
43 <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink" |
|
44 onclick="toggle_private();">hide private</a>]</span></td></tr> |
|
45 <tr><td align="right"><span class="options" |
|
46 >[<a href="frames.html" target="_top">frames</a |
|
47 >] | <a href="fileutils-module.html" |
|
48 target="_top">no frames</a>]</span></td></tr> |
|
49 </table> |
|
50 </td> |
|
51 </tr> |
|
52 </table> |
|
53 <!-- ==================== MODULE DESCRIPTION ==================== --> |
|
54 <h1 class="epydoc">Module fileutils</h1><span class="codelink"><a href="fileutils-pysrc.html">source code</a></span><br /><br /> |
|
55 <dl class="rst-docutils"> |
|
56 <dt>File manipulation related functionalities:</dt> |
|
57 <dd><ul class="rst-first rst-last rst-simple"> |
|
58 <li>Filescanner</li> |
|
59 <li>rmtree (fixed version)</li> |
|
60 <li>move (fixed version)</li> |
|
61 </ul> |
|
62 </dd> |
|
63 </dl><br /><br /> |
|
64 |
|
65 <!-- ==================== CLASSES ==================== --> |
|
66 <a name="section-Classes"></a> |
|
67 <table class="summary" border="1" cellpadding="3" |
|
68 cellspacing="0" width="100%" bgcolor="white"> |
|
69 <tr bgcolor="#70b0f0" class="table-header"> |
|
70 <td colspan="2" class="table-header"> |
|
71 <table border="0" cellpadding="0" cellspacing="0" width="100%"> |
|
72 <tr valign="top"> |
|
73 <td align="left"><span class="table-header">Classes</span></td> |
|
74 <td align="right" valign="top" |
|
75 ><span class="options">[<a href="#section-Classes" |
|
76 class="privatelink" onclick="toggle_private();" |
|
77 >hide private</a>]</span></td> |
|
78 </tr> |
|
79 </table> |
|
80 </td> |
|
81 </tr> |
|
82 <tr> |
|
83 <td width="15%" align="right" valign="top" class="summary"> |
|
84 <span class="summary-type"> </span> |
|
85 </td><td class="summary"> |
|
86 <a href="fileutils.AbstractScanner-class.html" class="summary-name">AbstractScanner</a><br /> |
|
87 This class implements all the required infrastructure for filescanning. |
|
88 </td> |
|
89 </tr> |
|
90 <tr> |
|
91 <td width="15%" align="right" valign="top" class="summary"> |
|
92 <span class="summary-type"> </span> |
|
93 </td><td class="summary"> |
|
94 <a href="fileutils.FileScanner-class.html" class="summary-name">FileScanner</a><br /> |
|
95 Scans the filesystem for files that match the selection paths. |
|
96 </td> |
|
97 </tr> |
|
98 <tr> |
|
99 <td width="15%" align="right" valign="top" class="summary"> |
|
100 <span class="summary-type"> </span> |
|
101 </td><td class="summary"> |
|
102 <a href="fileutils.LockFailedException-class.html" class="summary-name">LockFailedException</a> |
|
103 </td> |
|
104 </tr> |
|
105 <tr> |
|
106 <td width="15%" align="right" valign="top" class="summary"> |
|
107 <span class="summary-type"> </span> |
|
108 </td><td class="summary"> |
|
109 <a href="fileutils.Lock-class.html" class="summary-name">Lock</a> |
|
110 </td> |
|
111 </tr> |
|
112 </table> |
|
113 <!-- ==================== FUNCTIONS ==================== --> |
|
114 <a name="section-Functions"></a> |
|
115 <table class="summary" border="1" cellpadding="3" |
|
116 cellspacing="0" width="100%" bgcolor="white"> |
|
117 <tr bgcolor="#70b0f0" class="table-header"> |
|
118 <td colspan="2" class="table-header"> |
|
119 <table border="0" cellpadding="0" cellspacing="0" width="100%"> |
|
120 <tr valign="top"> |
|
121 <td align="left"><span class="table-header">Functions</span></td> |
|
122 <td align="right" valign="top" |
|
123 ><span class="options">[<a href="#section-Functions" |
|
124 class="privatelink" onclick="toggle_private();" |
|
125 >hide private</a>]</span></td> |
|
126 </tr> |
|
127 </table> |
|
128 </td> |
|
129 </tr> |
|
130 <tr> |
|
131 <td width="15%" align="right" valign="top" class="summary"> |
|
132 <span class="summary-type"> </span> |
|
133 </td><td class="summary"> |
|
134 <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
|
135 <tr> |
|
136 <td><span class="summary-sig"><a href="fileutils-module.html#move" class="summary-sig-name">move</a>(<span class="summary-sig-arg">src</span>, |
|
137 <span class="summary-sig-arg">dst</span>)</span><br /> |
|
138 Recursively move a file or directory to another location.</td> |
|
139 <td align="right" valign="top"> |
|
140 <span class="codelink"><a href="fileutils-pysrc.html#move">source code</a></span> |
|
141 |
|
142 </td> |
|
143 </tr> |
|
144 </table> |
|
145 |
|
146 </td> |
|
147 </tr> |
|
148 <tr> |
|
149 <td width="15%" align="right" valign="top" class="summary"> |
|
150 <span class="summary-type"> </span> |
|
151 </td><td class="summary"> |
|
152 <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
|
153 <tr> |
|
154 <td><span class="summary-sig"><a href="fileutils-module.html#rmtree" class="summary-sig-name">rmtree</a>(<span class="summary-sig-arg">rootdir</span>)</span><br /> |
|
155 Catch shutil.rmtree failures on Windows when files are read-only.</td> |
|
156 <td align="right" valign="top"> |
|
157 <span class="codelink"><a href="fileutils-pysrc.html#rmtree">source code</a></span> |
|
158 |
|
159 </td> |
|
160 </tr> |
|
161 </table> |
|
162 |
|
163 </td> |
|
164 </tr> |
|
165 <tr> |
|
166 <td width="15%" align="right" valign="top" class="summary"> |
|
167 <span class="summary-type"> </span> |
|
168 </td><td class="summary"> |
|
169 <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
|
170 <tr> |
|
171 <td><span class="summary-sig"><a name="destinsrc"></a><span class="summary-sig-name">destinsrc</span>(<span class="summary-sig-arg">src</span>, |
|
172 <span class="summary-sig-arg">dst</span>)</span><br /> |
|
173 Fixed version of destinscr, that doesn't match dst with same root name.</td> |
|
174 <td align="right" valign="top"> |
|
175 <span class="codelink"><a href="fileutils-pysrc.html#destinsrc">source code</a></span> |
|
176 |
|
177 </td> |
|
178 </tr> |
|
179 </table> |
|
180 |
|
181 </td> |
|
182 </tr> |
|
183 <tr> |
|
184 <td width="15%" align="right" valign="top" class="summary"> |
|
185 <span class="summary-type"> </span> |
|
186 </td><td class="summary"> |
|
187 <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
|
188 <tr> |
|
189 <td><span class="summary-sig"><a name="which"></a><span class="summary-sig-name">which</span>(<span class="summary-sig-arg">executable</span>)</span><br /> |
|
190 Search for executable in the PATH.</td> |
|
191 <td align="right" valign="top"> |
|
192 <span class="codelink"><a href="fileutils-pysrc.html#which">source code</a></span> |
|
193 |
|
194 </td> |
|
195 </tr> |
|
196 </table> |
|
197 |
|
198 </td> |
|
199 </tr> |
|
200 <tr> |
|
201 <td width="15%" align="right" valign="top" class="summary"> |
|
202 <span class="summary-type"> </span> |
|
203 </td><td class="summary"> |
|
204 <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
|
205 <tr> |
|
206 <td><span class="summary-sig"><a href="fileutils-module.html#read_policy_content" class="summary-sig-name">read_policy_content</a>(<span class="summary-sig-arg">filename</span>)</span><br /> |
|
207 Read the policy number from the policy file.</td> |
|
208 <td align="right" valign="top"> |
|
209 <span class="codelink"><a href="fileutils-pysrc.html#read_policy_content">source code</a></span> |
|
210 |
|
211 </td> |
|
212 </tr> |
|
213 </table> |
|
214 |
|
215 </td> |
|
216 </tr> |
|
217 <tr> |
|
218 <td width="15%" align="right" valign="top" class="summary"> |
|
219 <span class="summary-type"> </span> |
|
220 </td><td class="summary"> |
|
221 <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
|
222 <tr> |
|
223 <td><span class="summary-sig"><a name="load_policy_content"></a><span class="summary-sig-name">load_policy_content</span>(<span class="summary-sig-arg">filename</span>)</span><br /> |
|
224 Testing policy content loading.</td> |
|
225 <td align="right" valign="top"> |
|
226 <span class="codelink"><a href="fileutils-pysrc.html#load_policy_content">source code</a></span> |
|
227 |
|
228 </td> |
|
229 </tr> |
|
230 </table> |
|
231 |
|
232 </td> |
|
233 </tr> |
|
234 <tr> |
|
235 <td width="15%" align="right" valign="top" class="summary"> |
|
236 <span class="summary-type"> </span> |
|
237 </td><td class="summary"> |
|
238 <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
|
239 <tr> |
|
240 <td><span class="summary-sig"><a href="fileutils-module.html#guess_encoding" class="summary-sig-name">guess_encoding</a>(<span class="summary-sig-arg">data</span>)</span><br /> |
|
241 Given a byte string, guess the encoding.</td> |
|
242 <td align="right" valign="top"> |
|
243 <span class="codelink"><a href="fileutils-pysrc.html#guess_encoding">source code</a></span> |
|
244 |
|
245 </td> |
|
246 </tr> |
|
247 </table> |
|
248 |
|
249 </td> |
|
250 </tr> |
|
251 <tr> |
|
252 <td width="15%" align="right" valign="top" class="summary"> |
|
253 <span class="summary-type"> </span> |
|
254 </td><td class="summary"> |
|
255 <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
|
256 <tr> |
|
257 <td><span class="summary-sig"><a name="getmd5"></a><span class="summary-sig-name">getmd5</span>(<span class="summary-sig-arg">fullpath</span>, |
|
258 <span class="summary-sig-arg">chunk_size</span>=<span class="summary-sig-default">2**16</span>)</span><br /> |
|
259 returns the md5 value</td> |
|
260 <td align="right" valign="top"> |
|
261 <span class="codelink"><a href="fileutils-pysrc.html#getmd5">source code</a></span> |
|
262 |
|
263 </td> |
|
264 </tr> |
|
265 </table> |
|
266 |
|
267 </td> |
|
268 </tr> |
|
269 <tr> |
|
270 <td width="15%" align="right" valign="top" class="summary"> |
|
271 <span class="summary-type"> </span> |
|
272 </td><td class="summary"> |
|
273 <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
|
274 <tr> |
|
275 <td><span class="summary-sig"><a name="read_symbian_policy_content"></a><span class="summary-sig-name">read_symbian_policy_content</span>(<span class="summary-sig-arg">filename</span>)</span><br /> |
|
276 Read the policy category from the policy file.</td> |
|
277 <td align="right" valign="top"> |
|
278 <span class="codelink"><a href="fileutils-pysrc.html#read_symbian_policy_content">source code</a></span> |
|
279 |
|
280 </td> |
|
281 </tr> |
|
282 </table> |
|
283 |
|
284 </td> |
|
285 </tr> |
|
286 <tr> |
|
287 <td width="15%" align="right" valign="top" class="summary"> |
|
288 <span class="summary-type"> </span> |
|
289 </td><td class="summary"> |
|
290 <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
|
291 <tr> |
|
292 <td><span class="summary-sig"><a name="get_next_free_drive"></a><span class="summary-sig-name">get_next_free_drive</span>()</span><br /> |
|
293 Return the first free drive found else it raise an exception.</td> |
|
294 <td align="right" valign="top"> |
|
295 <span class="codelink"><a href="fileutils-pysrc.html#get_next_free_drive">source code</a></span> |
|
296 |
|
297 </td> |
|
298 </tr> |
|
299 </table> |
|
300 |
|
301 </td> |
|
302 </tr> |
|
303 <tr> |
|
304 <td width="15%" align="right" valign="top" class="summary"> |
|
305 <span class="summary-type"> </span> |
|
306 </td><td class="summary"> |
|
307 <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
|
308 <tr> |
|
309 <td><span class="summary-sig"><a name="subst"></a><span class="summary-sig-name">subst</span>(<span class="summary-sig-arg">drive</span>, |
|
310 <span class="summary-sig-arg">path</span>)</span><br /> |
|
311 Substing path as a drive.</td> |
|
312 <td align="right" valign="top"> |
|
313 <span class="codelink"><a href="fileutils-pysrc.html#subst">source code</a></span> |
|
314 |
|
315 </td> |
|
316 </tr> |
|
317 </table> |
|
318 |
|
319 </td> |
|
320 </tr> |
|
321 <tr> |
|
322 <td width="15%" align="right" valign="top" class="summary"> |
|
323 <span class="summary-type"> </span> |
|
324 </td><td class="summary"> |
|
325 <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
|
326 <tr> |
|
327 <td><span class="summary-sig"><a name="unsubst"></a><span class="summary-sig-name">unsubst</span>(<span class="summary-sig-arg">drive</span>)</span><br /> |
|
328 Unsubsting the drive.</td> |
|
329 <td align="right" valign="top"> |
|
330 <span class="codelink"><a href="fileutils-pysrc.html#unsubst">source code</a></span> |
|
331 |
|
332 </td> |
|
333 </tr> |
|
334 </table> |
|
335 |
|
336 </td> |
|
337 </tr> |
|
338 <tr> |
|
339 <td width="15%" align="right" valign="top" class="summary"> |
|
340 <span class="summary-type"> </span> |
|
341 </td><td class="summary"> |
|
342 <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
|
343 <tr> |
|
344 <td><span class="summary-sig"><a name="mount"></a><span class="summary-sig-name">mount</span>(<span class="summary-sig-arg">drive</span>, |
|
345 <span class="summary-sig-arg">unc</span>, |
|
346 <span class="summary-sig-arg">username</span>=<span class="summary-sig-default">None</span>, |
|
347 <span class="summary-sig-arg">password</span>=<span class="summary-sig-default">None</span>, |
|
348 <span class="summary-sig-arg">persistent</span>=<span class="summary-sig-default">False</span>)</span><br /> |
|
349 Windows helper function to map a network drive.</td> |
|
350 <td align="right" valign="top"> |
|
351 <span class="codelink"><a href="fileutils-pysrc.html#mount">source code</a></span> |
|
352 |
|
353 </td> |
|
354 </tr> |
|
355 </table> |
|
356 |
|
357 </td> |
|
358 </tr> |
|
359 <tr> |
|
360 <td width="15%" align="right" valign="top" class="summary"> |
|
361 <span class="summary-type"> </span> |
|
362 </td><td class="summary"> |
|
363 <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
|
364 <tr> |
|
365 <td><span class="summary-sig"><a name="umount"></a><span class="summary-sig-name">umount</span>(<span class="summary-sig-arg">drive</span>)</span><br /> |
|
366 Windows helper function to map a network drive.</td> |
|
367 <td align="right" valign="top"> |
|
368 <span class="codelink"><a href="fileutils-pysrc.html#umount">source code</a></span> |
|
369 |
|
370 </td> |
|
371 </tr> |
|
372 </table> |
|
373 |
|
374 </td> |
|
375 </tr> |
|
376 <tr> |
|
377 <td width="15%" align="right" valign="top" class="summary"> |
|
378 <span class="summary-type"> </span> |
|
379 </td><td class="summary"> |
|
380 <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
|
381 <tr> |
|
382 <td><span class="summary-sig"><a name="rmdir"></a><span class="summary-sig-name">rmdir</span>(<span class="summary-sig-arg">path</span>)</span></td> |
|
383 <td align="right" valign="top"> |
|
384 <span class="codelink"><a href="fileutils-pysrc.html#rmdir">source code</a></span> |
|
385 |
|
386 </td> |
|
387 </tr> |
|
388 </table> |
|
389 |
|
390 </td> |
|
391 </tr> |
|
392 <tr> |
|
393 <td width="15%" align="right" valign="top" class="summary"> |
|
394 <span class="summary-type"> </span> |
|
395 </td><td class="summary"> |
|
396 <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
|
397 <tr> |
|
398 <td><span class="summary-sig"><a name="remove"></a><span class="summary-sig-name">remove</span>(<span class="summary-sig-arg">path</span>)</span></td> |
|
399 <td align="right" valign="top"> |
|
400 <span class="codelink"><a href="fileutils-pysrc.html#remove">source code</a></span> |
|
401 |
|
402 </td> |
|
403 </tr> |
|
404 </table> |
|
405 |
|
406 </td> |
|
407 </tr> |
|
408 <tr> |
|
409 <td width="15%" align="right" valign="top" class="summary"> |
|
410 <span class="summary-type"> </span> |
|
411 </td><td class="summary"> |
|
412 <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
|
413 <tr> |
|
414 <td><span class="summary-sig"><a href="fileutils-module.html#touch" class="summary-sig-name">touch</a>(<span class="summary-sig-arg">srcdir</span>)</span><br /> |
|
415 Recursively touches all the files in the source path mentioned.</td> |
|
416 <td align="right" valign="top"> |
|
417 <span class="codelink"><a href="fileutils-pysrc.html#touch">source code</a></span> |
|
418 |
|
419 </td> |
|
420 </tr> |
|
421 </table> |
|
422 |
|
423 </td> |
|
424 </tr> |
|
425 </table> |
|
426 <!-- ==================== VARIABLES ==================== --> |
|
427 <a name="section-Variables"></a> |
|
428 <table class="summary" border="1" cellpadding="3" |
|
429 cellspacing="0" width="100%" bgcolor="white"> |
|
430 <tr bgcolor="#70b0f0" class="table-header"> |
|
431 <td colspan="2" class="table-header"> |
|
432 <table border="0" cellpadding="0" cellspacing="0" width="100%"> |
|
433 <tr valign="top"> |
|
434 <td align="left"><span class="table-header">Variables</span></td> |
|
435 <td align="right" valign="top" |
|
436 ><span class="options">[<a href="#section-Variables" |
|
437 class="privatelink" onclick="toggle_private();" |
|
438 >hide private</a>]</span></td> |
|
439 </tr> |
|
440 </table> |
|
441 </td> |
|
442 </tr> |
|
443 <tr> |
|
444 <td width="15%" align="right" valign="top" class="summary"> |
|
445 <span class="summary-type"> </span> |
|
446 </td><td class="summary"> |
|
447 <a name="LOGGER"></a><span class="summary-name">LOGGER</span> = <code title="logging.getLogger('fileutils')">logging.getLogger('fileutils')</code> |
|
448 </td> |
|
449 </tr> |
|
450 <tr> |
|
451 <td width="15%" align="right" valign="top" class="summary"> |
|
452 <span class="summary-type"> </span> |
|
453 </td><td class="summary"> |
|
454 <a name="LOGGER_LOCK"></a><span class="summary-name">LOGGER_LOCK</span> = <code title="logging.getLogger('fileutils.lock')">logging.getLogger('fileutils.lock')</code> |
|
455 </td> |
|
456 </tr> |
|
457 <tr> |
|
458 <td width="15%" align="right" valign="top" class="summary"> |
|
459 <span class="summary-type"> </span> |
|
460 </td><td class="summary"> |
|
461 <a href="fileutils-module.html#ENCODING_MATRIX" class="summary-name">ENCODING_MATRIX</a> = <code title="{codecs.BOM_UTF8: 'utf_8', codecs.BOM_UTF16: 'utf_16', codecs.BOM_UTF1\ |
|
462 6_BE: 'utf_16_be', codecs.BOM_UTF16_LE: 'utf_16_le',}">{codecs.BOM_UTF8: 'utf_8', codecs.BOM_UTF16:<code class="variable-ellipsis">...</code></code> |
|
463 </td> |
|
464 </tr> |
|
465 </table> |
|
466 <!-- ==================== FUNCTION DETAILS ==================== --> |
|
467 <a name="section-FunctionDetails"></a> |
|
468 <table class="details" border="1" cellpadding="3" |
|
469 cellspacing="0" width="100%" bgcolor="white"> |
|
470 <tr bgcolor="#70b0f0" class="table-header"> |
|
471 <td colspan="2" class="table-header"> |
|
472 <table border="0" cellpadding="0" cellspacing="0" width="100%"> |
|
473 <tr valign="top"> |
|
474 <td align="left"><span class="table-header">Function Details</span></td> |
|
475 <td align="right" valign="top" |
|
476 ><span class="options">[<a href="#section-FunctionDetails" |
|
477 class="privatelink" onclick="toggle_private();" |
|
478 >hide private</a>]</span></td> |
|
479 </tr> |
|
480 </table> |
|
481 </td> |
|
482 </tr> |
|
483 </table> |
|
484 <a name="move"></a> |
|
485 <div> |
|
486 <table class="details" border="1" cellpadding="3" |
|
487 cellspacing="0" width="100%" bgcolor="white"> |
|
488 <tr><td> |
|
489 <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
|
490 <tr valign="top"><td> |
|
491 <h3 class="epydoc"><span class="sig"><span class="sig-name">move</span>(<span class="sig-arg">src</span>, |
|
492 <span class="sig-arg">dst</span>)</span> |
|
493 </h3> |
|
494 </td><td align="right" valign="top" |
|
495 ><span class="codelink"><a href="fileutils-pysrc.html#move">source code</a></span> |
|
496 </td> |
|
497 </table> |
|
498 |
|
499 <p>Recursively move a file or directory to another location.</p> |
|
500 <p>If the destination is on our current filesystem, then simply use |
|
501 rename. Otherwise, copy src to the dst and then remove src. |
|
502 A lot more could be done here... A look at a mv.c shows a lot of |
|
503 the issues this implementation glosses over.</p> |
|
504 <dl class="fields"> |
|
505 </dl> |
|
506 </td></tr></table> |
|
507 </div> |
|
508 <a name="rmtree"></a> |
|
509 <div> |
|
510 <table class="details" border="1" cellpadding="3" |
|
511 cellspacing="0" width="100%" bgcolor="white"> |
|
512 <tr><td> |
|
513 <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
|
514 <tr valign="top"><td> |
|
515 <h3 class="epydoc"><span class="sig"><span class="sig-name">rmtree</span>(<span class="sig-arg">rootdir</span>)</span> |
|
516 </h3> |
|
517 </td><td align="right" valign="top" |
|
518 ><span class="codelink"><a href="fileutils-pysrc.html#rmtree">source code</a></span> |
|
519 </td> |
|
520 </table> |
|
521 |
|
522 Catch shutil.rmtree failures on Windows when files are read-only. Thanks Google! |
|
523 <dl class="fields"> |
|
524 </dl> |
|
525 </td></tr></table> |
|
526 </div> |
|
527 <a name="read_policy_content"></a> |
|
528 <div> |
|
529 <table class="details" border="1" cellpadding="3" |
|
530 cellspacing="0" width="100%" bgcolor="white"> |
|
531 <tr><td> |
|
532 <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
|
533 <tr valign="top"><td> |
|
534 <h3 class="epydoc"><span class="sig"><span class="sig-name">read_policy_content</span>(<span class="sig-arg">filename</span>)</span> |
|
535 </h3> |
|
536 </td><td align="right" valign="top" |
|
537 ><span class="codelink"><a href="fileutils-pysrc.html#read_policy_content">source code</a></span> |
|
538 </td> |
|
539 </table> |
|
540 |
|
541 Read the policy number from the policy file. |
|
542 strict allows to activate the new policy scanning. |
|
543 <dl class="fields"> |
|
544 </dl> |
|
545 </td></tr></table> |
|
546 </div> |
|
547 <a name="guess_encoding"></a> |
|
548 <div> |
|
549 <table class="details" border="1" cellpadding="3" |
|
550 cellspacing="0" width="100%" bgcolor="white"> |
|
551 <tr><td> |
|
552 <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
|
553 <tr valign="top"><td> |
|
554 <h3 class="epydoc"><span class="sig"><span class="sig-name">guess_encoding</span>(<span class="sig-arg">data</span>)</span> |
|
555 </h3> |
|
556 </td><td align="right" valign="top" |
|
557 ><span class="codelink"><a href="fileutils-pysrc.html#guess_encoding">source code</a></span> |
|
558 </td> |
|
559 </table> |
|
560 |
|
561 <p>Given a byte string, guess the encoding.</p> |
|
562 <p>First it tries for UTF8/UTF16 BOM.</p> |
|
563 <p>Next it tries the standard 'UTF8', 'ISO-8859-1', and 'cp1252' encodings, |
|
564 Plus several gathered from locale information.</p> |
|
565 <p>The calling program <em>must</em> first call locale.setlocale(locale.LC_ALL, '')</p> |
|
566 <p>If successful it returns (decoded_unicode, successful_encoding) |
|
567 If unsuccessful it raises a <tt class="rst-docutils literal"><span class="pre">UnicodeError</span></tt>.</p> |
|
568 <p>This was taken from <a class="rst-reference external" href="http://www.voidspace.org.uk/python/articles/guessing_encoding.shtml" target="_top">http://www.voidspace.org.uk/python/articles/guessing_encoding.shtml</a></p> |
|
569 <dl class="fields"> |
|
570 </dl> |
|
571 </td></tr></table> |
|
572 </div> |
|
573 <a name="touch"></a> |
|
574 <div> |
|
575 <table class="details" border="1" cellpadding="3" |
|
576 cellspacing="0" width="100%" bgcolor="white"> |
|
577 <tr><td> |
|
578 <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
|
579 <tr valign="top"><td> |
|
580 <h3 class="epydoc"><span class="sig"><span class="sig-name">touch</span>(<span class="sig-arg">srcdir</span>)</span> |
|
581 </h3> |
|
582 </td><td align="right" valign="top" |
|
583 ><span class="codelink"><a href="fileutils-pysrc.html#touch">source code</a></span> |
|
584 </td> |
|
585 </table> |
|
586 |
|
587 Recursively touches all the files in the source path mentioned. |
|
588 It does not touch the directories. |
|
589 <dl class="fields"> |
|
590 </dl> |
|
591 </td></tr></table> |
|
592 </div> |
|
593 <br /> |
|
594 <!-- ==================== VARIABLES DETAILS ==================== --> |
|
595 <a name="section-VariablesDetails"></a> |
|
596 <table class="details" border="1" cellpadding="3" |
|
597 cellspacing="0" width="100%" bgcolor="white"> |
|
598 <tr bgcolor="#70b0f0" class="table-header"> |
|
599 <td colspan="2" class="table-header"> |
|
600 <table border="0" cellpadding="0" cellspacing="0" width="100%"> |
|
601 <tr valign="top"> |
|
602 <td align="left"><span class="table-header">Variables Details</span></td> |
|
603 <td align="right" valign="top" |
|
604 ><span class="options">[<a href="#section-VariablesDetails" |
|
605 class="privatelink" onclick="toggle_private();" |
|
606 >hide private</a>]</span></td> |
|
607 </tr> |
|
608 </table> |
|
609 </td> |
|
610 </tr> |
|
611 </table> |
|
612 <a name="ENCODING_MATRIX"></a> |
|
613 <div> |
|
614 <table class="details" border="1" cellpadding="3" |
|
615 cellspacing="0" width="100%" bgcolor="white"> |
|
616 <tr><td> |
|
617 <h3 class="epydoc">ENCODING_MATRIX</h3> |
|
618 |
|
619 <dl class="fields"> |
|
620 </dl> |
|
621 <dl class="fields"> |
|
622 <dt>Value:</dt> |
|
623 <dd><table><tr><td><pre class="variable"> |
|
624 {codecs.BOM_UTF8: 'utf_8', codecs.BOM_UTF16: 'utf_16', codecs.BOM_UTF1<span class="variable-linewrap"><img src="crarr.png" alt="\" /></span> |
|
625 6_BE: 'utf_16_be', codecs.BOM_UTF16_LE: 'utf_16_le',} |
|
626 </pre></td></tr></table> |
|
627 </dd> |
|
628 </dl> |
|
629 </td></tr></table> |
|
630 </div> |
|
631 <br /> |
|
632 <!-- ==================== NAVIGATION BAR ==================== --> |
|
633 <table class="navbar" border="0" width="100%" cellpadding="0" |
|
634 bgcolor="#a0c0ff" cellspacing="0"> |
|
635 <tr valign="middle"> |
|
636 |
|
637 <!-- Tree link --> |
|
638 <th> <a |
|
639 href="module-tree.html">Trees</a> </th> |
|
640 |
|
641 <!-- Index link --> |
|
642 <th> <a |
|
643 href="identifier-index.html">Indices</a> </th> |
|
644 |
|
645 <!-- Help link --> |
|
646 <th> <a |
|
647 href="help.html">Help</a> </th> |
|
648 |
|
649 <th class="navbar" width="100%"></th> |
|
650 </tr> |
|
651 </table> |
|
652 <table border="0" cellpadding="0" cellspacing="0" width="100%%"> |
|
653 <tr> |
|
654 <td align="left" class="footer"> |
|
655 Generated by Epydoc 3.0beta1 on Wed Sep 09 13:44:16 2009 |
|
656 </td> |
|
657 <td align="right" class="footer"> |
|
658 <a href="http://epydoc.sourceforge.net">http://epydoc.sourceforge.net</a> |
|
659 </td> |
|
660 </tr> |
|
661 </table> |
|
662 |
|
663 <script type="text/javascript"> |
|
664 <!-- |
|
665 // Private objects are initially displayed (because if |
|
666 // javascript is turned off then we want them to be |
|
667 // visible); but by default, we want to hide them. So hide |
|
668 // them unless we have a cookie that says to show them. |
|
669 checkCookie() |
|
670 // --> |
|
671 </script> |
|
672 |
|
673 </body> |
|
674 </html> |