Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
2 | <html> | |
3 | <head> | |
4 | <link rel="STYLESHEET" href="lib.css" type='text/css' /> | |
5 | <link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" /> | |
6 | <link rel='start' href='../index.html' title='Python Documentation Index' /> | |
7 | <link rel="first" href="lib.html" title='Python Library Reference' /> | |
8 | <link rel='contents' href='contents.html' title="Contents" /> | |
9 | <link rel='index' href='genindex.html' title='Index' /> | |
10 | <link rel='last' href='about.html' title='About this document...' /> | |
11 | <link rel='help' href='about.html' title='About this document...' /> | |
12 | <link rel="next" href="asynchat-example.html" /> | |
13 | <link rel="prev" href="module-asynchat.html" /> | |
14 | <link rel="parent" href="module-asynchat.html" /> | |
15 | <link rel="next" href="asynchat-example.html" /> | |
16 | <meta name='aesop' content='information' /> | |
17 | <title>11.26.1 asynchat - Auxiliary Classes and Functions</title> | |
18 | </head> | |
19 | <body> | |
20 | <DIV CLASS="navigation"> | |
21 | <div id='top-navigation-panel' xml:id='top-navigation-panel'> | |
22 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> | |
23 | <tr> | |
24 | <td class='online-navigation'><a rel="prev" title="11.26 asynchat " | |
25 | href="module-asynchat.html"><img src='../icons/previous.png' | |
26 | border='0' height='32' alt='Previous Page' width='32' /></A></td> | |
27 | <td class='online-navigation'><a rel="parent" title="11.26 asynchat " | |
28 | href="module-asynchat.html"><img src='../icons/up.png' | |
29 | border='0' height='32' alt='Up One Level' width='32' /></A></td> | |
30 | <td class='online-navigation'><a rel="next" title="11.26.2 asynchat Example" | |
31 | href="asynchat-example.html"><img src='../icons/next.png' | |
32 | border='0' height='32' alt='Next Page' width='32' /></A></td> | |
33 | <td align="center" width="100%">Python Library Reference</td> | |
34 | <td class='online-navigation'><a rel="contents" title="Table of Contents" | |
35 | href="contents.html"><img src='../icons/contents.png' | |
36 | border='0' height='32' alt='Contents' width='32' /></A></td> | |
37 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' | |
38 | border='0' height='32' alt='Module Index' width='32' /></a></td> | |
39 | <td class='online-navigation'><a rel="index" title="Index" | |
40 | href="genindex.html"><img src='../icons/index.png' | |
41 | border='0' height='32' alt='Index' width='32' /></A></td> | |
42 | </tr></table> | |
43 | <div class='online-navigation'> | |
44 | <b class="navlabel">Previous:</b> | |
45 | <a class="sectref" rel="prev" href="module-asynchat.html">11.26 asynchat </A> | |
46 | <b class="navlabel">Up:</b> | |
47 | <a class="sectref" rel="parent" href="module-asynchat.html">11.26 asynchat </A> | |
48 | <b class="navlabel">Next:</b> | |
49 | <a class="sectref" rel="next" href="asynchat-example.html">11.26.2 asynchat Example</A> | |
50 | </div> | |
51 | <hr /></div> | |
52 | </DIV> | |
53 | <!--End of Navigation Panel--> | |
54 | ||
55 | <H2><A NAME="SECTION00132610000000000000000"> | |
56 | 11.26.1 asynchat - Auxiliary Classes and Functions</A> | |
57 | </H2> | |
58 | ||
59 | <P> | |
60 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
61 | <td><nobr><b><span class="typelabel">class</span> <tt id='l2h-3780' xml:id='l2h-3780' class="class">simple_producer</tt></b>(</nobr></td> | |
62 | <td><var>data</var><big>[</big><var>, buffer_size=512</var><big>]</big><var></var>)</td></tr></table></dt> | |
63 | <dd> | |
64 | A <tt class="class">simple_producer</tt> takes a chunk of data and an optional buffer size. | |
65 | Repeated calls to its <tt class="method">more()</tt> method yield successive chunks of the | |
66 | data no larger than <var>buffer_size</var>. | |
67 | </dl> | |
68 | ||
69 | <P> | |
70 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
71 | <td><nobr><b><tt id='l2h-3781' xml:id='l2h-3781' class="method">more</tt></b>(</nobr></td> | |
72 | <td><var></var>)</td></tr></table></dt> | |
73 | <dd> | |
74 | Produces the next chunk of information from the producer, or returns the empty string. | |
75 | </dl> | |
76 | ||
77 | <P> | |
78 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
79 | <td><nobr><b><span class="typelabel">class</span> <tt id='l2h-3782' xml:id='l2h-3782' class="class">fifo</tt></b>(</nobr></td> | |
80 | <td><var></var><big>[</big><var>list=None</var><big>]</big><var></var>)</td></tr></table></dt> | |
81 | <dd> | |
82 | Each channel maintains a <tt class="class">fifo</tt> holding data which has been pushed by the | |
83 | application but not yet popped for writing to the channel. | |
84 | A <tt class="class">fifo</tt> is a list used to hold data and/or producers until they are required. | |
85 | If the <var>list</var> argument is provided then it should contain producers or | |
86 | data items to be written to the channel. | |
87 | </dl> | |
88 | ||
89 | <P> | |
90 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
91 | <td><nobr><b><tt id='l2h-3783' xml:id='l2h-3783' class="method">is_empty</tt></b>(</nobr></td> | |
92 | <td><var></var>)</td></tr></table></dt> | |
93 | <dd> | |
94 | Returns <code>True</code> iff the fifo is empty. | |
95 | </dl> | |
96 | ||
97 | <P> | |
98 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
99 | <td><nobr><b><tt id='l2h-3784' xml:id='l2h-3784' class="method">first</tt></b>(</nobr></td> | |
100 | <td><var></var>)</td></tr></table></dt> | |
101 | <dd> | |
102 | Returns the least-recently <tt class="method">push()</tt>ed item from the fifo. | |
103 | </dl> | |
104 | ||
105 | <P> | |
106 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
107 | <td><nobr><b><tt id='l2h-3785' xml:id='l2h-3785' class="method">push</tt></b>(</nobr></td> | |
108 | <td><var>data</var>)</td></tr></table></dt> | |
109 | <dd> | |
110 | Adds the given data (which may be a string or a producer object) to the | |
111 | producer fifo. | |
112 | </dl> | |
113 | ||
114 | <P> | |
115 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
116 | <td><nobr><b><tt id='l2h-3786' xml:id='l2h-3786' class="method">pop</tt></b>(</nobr></td> | |
117 | <td><var></var>)</td></tr></table></dt> | |
118 | <dd> | |
119 | If the fifo is not empty, returns <code>True, first()</code>, deleting the popped | |
120 | item. Returns <code>False, None</code> for an empty fifo. | |
121 | </dl> | |
122 | ||
123 | <P> | |
124 | The <tt class="module">asynchat</tt> module also defines one utility function, which may be | |
125 | of use in network and textual analysis operations. | |
126 | ||
127 | <P> | |
128 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
129 | <td><nobr><b><tt id='l2h-3787' xml:id='l2h-3787' class="function">find_prefix_at_end</tt></b>(</nobr></td> | |
130 | <td><var>haystack, needle</var>)</td></tr></table></dt> | |
131 | <dd> | |
132 | Returns <code>True</code> if string <var>haystack</var> ends with any non-empty | |
133 | prefix of string <var>needle</var>. | |
134 | </dl> | |
135 | ||
136 | <P> | |
137 | ||
138 | <DIV CLASS="navigation"> | |
139 | <div class='online-navigation'> | |
140 | <p></p><hr /> | |
141 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> | |
142 | <tr> | |
143 | <td class='online-navigation'><a rel="prev" title="11.26 asynchat " | |
144 | href="module-asynchat.html"><img src='../icons/previous.png' | |
145 | border='0' height='32' alt='Previous Page' width='32' /></A></td> | |
146 | <td class='online-navigation'><a rel="parent" title="11.26 asynchat " | |
147 | href="module-asynchat.html"><img src='../icons/up.png' | |
148 | border='0' height='32' alt='Up One Level' width='32' /></A></td> | |
149 | <td class='online-navigation'><a rel="next" title="11.26.2 asynchat Example" | |
150 | href="asynchat-example.html"><img src='../icons/next.png' | |
151 | border='0' height='32' alt='Next Page' width='32' /></A></td> | |
152 | <td align="center" width="100%">Python Library Reference</td> | |
153 | <td class='online-navigation'><a rel="contents" title="Table of Contents" | |
154 | href="contents.html"><img src='../icons/contents.png' | |
155 | border='0' height='32' alt='Contents' width='32' /></A></td> | |
156 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' | |
157 | border='0' height='32' alt='Module Index' width='32' /></a></td> | |
158 | <td class='online-navigation'><a rel="index" title="Index" | |
159 | href="genindex.html"><img src='../icons/index.png' | |
160 | border='0' height='32' alt='Index' width='32' /></A></td> | |
161 | </tr></table> | |
162 | <div class='online-navigation'> | |
163 | <b class="navlabel">Previous:</b> | |
164 | <a class="sectref" rel="prev" href="module-asynchat.html">11.26 asynchat </A> | |
165 | <b class="navlabel">Up:</b> | |
166 | <a class="sectref" rel="parent" href="module-asynchat.html">11.26 asynchat </A> | |
167 | <b class="navlabel">Next:</b> | |
168 | <a class="sectref" rel="next" href="asynchat-example.html">11.26.2 asynchat Example</A> | |
169 | </div> | |
170 | </div> | |
171 | <hr /> | |
172 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> | |
173 | </DIV> | |
174 | <!--End of Navigation Panel--> | |
175 | <ADDRESS> | |
176 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. | |
177 | </ADDRESS> | |
178 | </BODY> | |
179 | </HTML> |