Mercurial > cpython-lru_cache-weakref
annotate Doc/lib/libdircache.tex @ 21467:4e35fa5d5708 legacy-trunk
Add documentation for the help() built-in; contributed by Ka-Ping Yee.
This is part of SF patch #494622.
| author | Fred Drake <fdrake@acm.org> |
|---|---|
| date | Tue, 18 Dec 2001 16:31:08 +0000 |
| parents | d7864345b1c8 |
| children | 7ea067d749a0 |
| rev | line source |
|---|---|
|
10996
84ab14d85763
New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
1 \section{\module{dircache} --- |
|
84ab14d85763
New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
2 Cached directory listings} |
|
84ab14d85763
New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
3 |
|
84ab14d85763
New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
4 \declaremodule{standard}{dircache} |
|
15467
d7864345b1c8
Update Moshe Zadka's email address to one works and might last a while.
Fred Drake <fdrake@acm.org>
parents:
13625
diff
changeset
|
5 \sectionauthor{Moshe Zadka}{moshez@zadka.site.co.il} |
|
10996
84ab14d85763
New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
6 \modulesynopsis{Return directory listing, with cache mechanism.} |
|
84ab14d85763
New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
7 |
|
84ab14d85763
New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
8 The \module{dircache} module defines a function for reading directory listing |
|
84ab14d85763
New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
9 using a cache, and cache invalidation using the \var{mtime} of the directory. |
|
84ab14d85763
New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
10 Additionally, it defines a function to annotate directories by appending |
|
84ab14d85763
New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
11 a slash. |
|
84ab14d85763
New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
12 |
|
84ab14d85763
New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
13 The \module{dircache} module defines the following functions: |
|
84ab14d85763
New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
14 |
|
84ab14d85763
New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
15 \begin{funcdesc}{listdir}{path} |
|
84ab14d85763
New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
16 Return a directory listing of \var{path}, as gotten from |
|
84ab14d85763
New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
17 \function{os.listdir()}. Note that unless \var{path} changes, further call |
|
84ab14d85763
New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
18 to \function{listdir()} will not re-read the directory structure. |
|
84ab14d85763
New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
19 |
|
84ab14d85763
New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
20 Note that the list returned should be regarded as read-only. (Perhaps |
|
84ab14d85763
New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
21 a future version should change it to return a tuple?) |
|
84ab14d85763
New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
22 \end{funcdesc} |
|
84ab14d85763
New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
23 |
|
84ab14d85763
New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
24 \begin{funcdesc}{opendir}{path} |
|
13625
fdfd1049f36e
Rob W. W. Hooft's spelling fixes for the Library Reference. I hope
Thomas Wouters <thomas@python.org>
parents:
11419
diff
changeset
|
25 Same as \function{listdir()}. Defined for backwards compatibility. |
|
10996
84ab14d85763
New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
26 \end{funcdesc} |
|
84ab14d85763
New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
27 |
|
84ab14d85763
New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
28 \begin{funcdesc}{annotate}{head, list} |
|
11419
10ad370bc5bd
pathes --> paths; typo reported by Gerry Wiener <gerry@ucar.edu>.
Fred Drake <fdrake@acm.org>
parents:
10996
diff
changeset
|
29 Assume \var{list} is a list of paths relative to \var{head}, and append, |
|
10996
84ab14d85763
New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
30 in place, a \character{/} to each path which points to a directory. |
|
84ab14d85763
New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
31 \end{funcdesc} |
|
84ab14d85763
New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
32 |
|
84ab14d85763
New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
33 \begin{verbatim} |
|
84ab14d85763
New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
34 >>> import dircache |
|
84ab14d85763
New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
35 >>> a=dircache.listdir('/') |
|
84ab14d85763
New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
36 >>> a=a[:] # Copy the return value so we can change 'a' |
|
84ab14d85763
New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
37 >>> a |
|
84ab14d85763
New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
38 ['bin', 'boot', 'cdrom', 'dev', 'etc', 'floppy', 'home', 'initrd', 'lib', 'lost+ |
|
84ab14d85763
New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
39 found', 'mnt', 'proc', 'root', 'sbin', 'tmp', 'usr', 'var', 'vmlinuz'] |
|
84ab14d85763
New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
40 >>> dircache.annotate('/', a) |
|
84ab14d85763
New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
41 >>> a |
|
84ab14d85763
New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
42 ['bin/', 'boot/', 'cdrom/', 'dev/', 'etc/', 'floppy/', 'home/', 'initrd/', 'lib/ |
|
84ab14d85763
New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
43 ', 'lost+found/', 'mnt/', 'proc/', 'root/', 'sbin/', 'tmp/', 'usr/', 'var/', 'vm |
|
84ab14d85763
New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
44 linuz'] |
|
84ab14d85763
New module documentation sections from Moshe Zadka <moshez@math.huji.ac.il>!
Fred Drake <fdrake@acm.org>
parents:
diff
changeset
|
45 \end{verbatim} |
