Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
a01f6892
Commit
a01f6892
authored
Apr 29, 2010
by
Giampaolo Rodolà
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes issue 8543 (asynchat documentation issues)
parent
f62b50f3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
91 deletions
+10
-91
Doc/library/asynchat.rst
Doc/library/asynchat.rst
+10
-91
No files found.
Doc/library/asynchat.rst
View file @
a01f6892
...
...
@@ -81,12 +81,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
...
...
@@ -101,49 +95,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)
...
...
@@ -154,20 +116,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``
...
...
@@ -192,36 +140,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()
...
...
@@ -245,15 +173,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:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment