From 135751e6e6544cc79b721fddefd75fb80eb1f833 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Giampaolo=20Rodol=C3=A0?= Date: Thu, 29 Apr 2010 20:47:09 +0000 Subject: [PATCH] Merged revisions 80633 via svnmerge from svn+ssh://pythondev@svn.python.org/python/branches/py3k ................ r80633 | giampaolo.rodola | 2010-04-29 22:45:01 +0200 (gio, 29 apr 2010) | 9 lines Merged revisions 80631 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r80631 | giampaolo.rodola | 2010-04-29 22:31:17 +0200 (gio, 29 apr 2010) | 1 line Fixes issue 8543 (asynchat documentation issues) ........ ................ --- Doc/library/asynchat.rst | 101 ++++----------------------------------- 1 file changed, 10 insertions(+), 91 deletions(-) diff --git a/Doc/library/asynchat.rst b/Doc/library/asynchat.rst index e511a052160..3b8eb1240f3 100644 --- a/Doc/library/asynchat.rst +++ b/Doc/library/asynchat.rst @@ -80,12 +80,6 @@ connection requests. :exc:`NotImplementedError` exception. -.. method:: async_chat._collect_incoming_data(data) - - Sample implementation of a data collection rutine to be used in conjunction - with :meth:`_get_data` in a user-specified :meth:`found_terminator`. - - .. method:: async_chat.discard_buffers() In emergencies this method will discard any data held in the input and/or @@ -100,49 +94,17 @@ connection requests. should be available via an instance attribute. -.. method:: async_chat._get_data() - - Will return and clear the data received with the sample - :meth:`_collect_incoming_data` implementation. - - .. method:: async_chat.get_terminator() Returns the current terminator for the channel. -.. method:: async_chat.handle_close() - - Called when the channel is closed. The default method silently closes the - channel's socket. - - -.. method:: async_chat.handle_read() - - Called when a read event fires on the channel's socket in the asynchronous - loop. The default method checks for the termination condition established - by :meth:`set_terminator`, which can be either the appearance of a - particular string in the input stream or the receipt of a particular number - of characters. When the terminator is found, :meth:`handle_read` calls the - :meth:`found_terminator` method after calling :meth:`collect_incoming_data` - with any data preceding the terminating condition. - - -.. method:: async_chat.handle_write() - - Called when the application may write data to the channel. The default - method calls the :meth:`initiate_send` method, which in turn will call - :meth:`refill_buffer` to collect data from the producer fifo associated - with the channel. - - .. method:: async_chat.push(data) - Creates a :class:`simple_producer` object (*see below*) containing the data - and pushes it on to the channel's ``producer_fifo`` to ensure its - transmission. This is all you need to do to have the channel write the - data out to the network, although it is possible to use your own producers - in more complex schemes to implement encryption and chunking, for example. + Pushes data on to the channel's fifo to ensure its transmission. + This is all you need to do to have the channel write the data out to the + network, although it is possible to use your own producers in more complex + schemes to implement encryption and chunking, for example. .. method:: async_chat.push_with_producer(producer) @@ -153,20 +115,6 @@ connection requests. method and send the data to the remote endpoint. -.. method:: async_chat.readable() - - Should return ``True`` for the channel to be included in the set of - channels tested by the :cfunc:`select` loop for readability. - - -.. method:: async_chat.refill_buffer() - - Refills the output buffer by calling the :meth:`more` method of the - producer at the head of the fifo. If it is exhausted then the producer is - popped off the fifo and the next producer is activated. If the current - producer is, or becomes, ``None`` then the channel is closed. - - .. method:: async_chat.set_terminator(term) Sets the terminating condition to be recognized on the channel. ``term`` @@ -191,36 +139,16 @@ connection requests. by the channel after :meth:`found_terminator` is called. -.. method:: async_chat.writable() - - Should return ``True`` as long as items remain on the producer fifo, or the - channel is connected and the channel's output buffer is non-empty. - - -asynchat - Auxiliary Classes and Functions +asynchat - Auxiliary Classes ------------------------------------------ - -.. class:: simple_producer(data, buffer_size=512) - - A :class:`simple_producer` takes a chunk of data and an optional buffer - size. Repeated calls to its :meth:`more` method yield successive chunks of - the data no larger than *buffer_size*. - - - .. method:: more() - - Produces the next chunk of information from the producer, or returns the - empty string. - - .. class:: fifo(list=None) - Each channel maintains a :class:`fifo` holding data which has been pushed - by the application but not yet popped for writing to the channel. A - :class:`fifo` is a list used to hold data and/or producers until they are - required. If the *list* argument is provided then it should contain - producers or data items to be written to the channel. + A :class:`fifo` holding data which has been pushed by the application but + not yet popped for writing to the channel. A :class:`fifo` is a list used + to hold data and/or producers until they are required. If the *list* + argument is provided then it should contain producers or data items to be + written to the channel. .. method:: is_empty() @@ -244,15 +172,6 @@ asynchat - Auxiliary Classes and Functions If the fifo is not empty, returns ``True, first()``, deleting the popped item. Returns ``False, None`` for an empty fifo. -The :mod:`asynchat` module also defines one utility function, which may be of -use in network and textual analysis operations. - - -.. function:: find_prefix_at_end(haystack, needle) - - Returns ``True`` if string *haystack* ends with any non-empty prefix of - string *needle*. - .. _asynchat-example: