[tor-commits] [stem/master] Migrate to asyncio

atagar at torproject.org atagar at torproject.org
Thu Jul 16 01:29:00 UTC 2020


commit 6f8f8d5c26079ed0e1e08bbb5815f2f39891a46e
Merge: 8634aa04 46dec7b9
Author: Damian Johnson <atagar at torproject.org>
Date:   Wed Jul 15 18:10:33 2020 -0700

    Migrate to asyncio
    
    Python 3.5 added asyncio, an asynchronous IO framework similar to Twisted...
    
      https://www.python.org/dev/peps/pep-0492/
    
    This added new python keywords (async and await) which give callers more
    control over how they await asynchronous operations (for instance,
    asyncio.wait_for() to apply a timeout).
    
    This branch migrates our stem.control, stem.client, and stem.descriptor.remote
    modules from a synchronous to asynchronous implementation. Usually this would
    preclude us from being used by non-asyncio users, but this also adds a
    Synchronous mixin that allows us to be used from either context.
    
    In other words, internally Stem is now an asynchronous library that is usable
    by asyncio users, while retaining its ability to be used by synchronous users
    in the exact same way we always have.
    
    Win-win for everyone. Many thanks to Illia for all his hard work on this
    branch!

 .gitignore                              |   3 +
 run_tests.py                            |  19 +-
 stem/client/__init__.py                 |  93 ++--
 stem/connection.py                      | 227 ++++++---
 stem/control.py                         | 648 ++++++++++++++-----------
 stem/descriptor/remote.py               | 266 +++++-----
 stem/interpreter/__init__.py            |   5 +-
 stem/interpreter/autocomplete.py        |   8 +-
 stem/interpreter/commands.py            |  12 +-
 stem/interpreter/help.py                |   9 +-
 stem/response/__init__.py               |   2 +-
 stem/socket.py                          | 441 +++++++++--------
 stem/util/__init__.py                   | 226 ++++++++-
 stem/util/test_tools.py                 |  61 ++-
 test/integ/client/connection.py         |  38 +-
 test/integ/connection/authentication.py | 143 +++---
 test/integ/connection/connect.py        |  17 +-
 test/integ/control/base_controller.py   | 133 ++---
 test/integ/control/controller.py        | 828 ++++++++++++++++++--------------
 test/integ/process.py                   |  28 +-
 test/integ/response/protocolinfo.py     |  43 +-
 test/integ/socket/control_message.py    |  84 ++--
 test/integ/socket/control_socket.py     |  84 ++--
 test/integ/util/connection.py           |   6 +-
 test/integ/util/proc.py                 |   6 +-
 test/integ/version.py                   |  12 +-
 test/runner.py                          |  48 +-
 test/settings.cfg                       |  11 +
 test/unit/connection/authentication.py  |  36 +-
 test/unit/connection/connect.py         |  54 ++-
 test/unit/control/controller.py         | 206 ++++----
 test/unit/descriptor/remote.py          | 230 ++++-----
 test/unit/response/control_message.py   |  10 +-
 test/unit/util/synchronous.py           | 237 +++++++++
 34 files changed, 2602 insertions(+), 1672 deletions(-)



More information about the tor-commits mailing list