a new aio_client.py, which contains the AioServerConnection, AioReactor, and AioSimpleIRCClient classes, which inherit from (and maintain most of the functionality of) their analogs in client.py. This was a concerted effort to keep the API as close to the original as possible, and replace only what was necessary to move replace the select() based loop with asyncio's event loop.
two new example scripts, irccat-aio.py and irccat2-aio.py, which replicate their non-asyncio counterparts with the new asyncio-based versions from aio_client
Added docstrings to aio_client.py. These are pretty heavily lifted from client.py, with a particular focus on what's different between these versions and their original, select-based counterpoints
A lone, sad unittest. This was more an attempt to spec out what would be required for unit testing the asyncio-based components (since asyncio brings some weird testing gotchas) than anything.
Not in this PR:
functional/integration tests
DCC integration into the new aio classes
Note: In case you use git/github diffs for code review -- the code in the original irc.client.py had almost no actual changes, but it was reordered due to a referencing issue. The only actual change was on the Reactor class, in which I added the connection_class = ServerConnection field to the class, and changed the server() function from:
def server(self):
"""Creates and returns a ServerConnection object."""
c = ServerConnection(self)
with self.mutex:
self.connections.append(c)
return c
to:
def server(self):
"""Creates and returns a ServerConnection object."""
c = self.connection_class(self)
with self.mutex:
self.connections.append(c)
return c
to allow more modularity in the Reactor. However, the class-level reference to ServerConnection was causing the interpreter some confusion until I moved the ServerConnection above Reactor in the code, which is why github thinks the whole file was re-written.
In this PR:
aio_client.py
, which contains theAioServerConnection
,AioReactor
, andAioSimpleIRCClient
classes, which inherit from (and maintain most of the functionality of) their analogs inclient.py
. This was a concerted effort to keep the API as close to the original as possible, and replace only what was necessary to move replace theselect()
based loop with asyncio's event loop.irccat-aio.py
andirccat2-aio.py
, which replicate their non-asyncio counterparts with the new asyncio-based versions fromaio_client
aio_client.py
. These are pretty heavily lifted fromclient.py
, with a particular focus on what's different between these versions and their original, select-based counterpointsNot in this PR:
Note: In case you use git/github diffs for code review -- the code in the original
irc.client.py
had almost no actual changes, but it was reordered due to a referencing issue. The only actual change was on theReactor
class, in which I added theconnection_class = ServerConnection
field to the class, and changed theserver()
function from:to:
to allow more modularity in the Reactor. However, the class-level reference to
ServerConnection
was causing the interpreter some confusion until I moved theServerConnection
aboveReactor
in the code, which is why github thinks the whole file was re-written.