[tor-commits] [stem/master] Add stem.directory module

atagar at torproject.org atagar at torproject.org
Tue May 8 20:20:10 UTC 2018


commit 65a5097ff063bd163c4e1e6ce92b4caf4090ec82
Merge: ffb3ade8 4e360223
Author: Damian Johnson <atagar at torproject.org>
Date:   Tue May 8 13:12:02 2018 -0700

    Add stem.directory module
    
    When dirauths were a small constant it made sense to co-locate them in the
    remote module (the sole spot they were used). But they've grown. With the
    addition of fallback directories and from_remote() parsers they're now the bulk
    of the remote module and way past the point where they deserve their own
    module.
    
    Adding a stem.directory module with aliases for backward compatability. Also
    shortening the names. With this the module is a *lot* nicer to use. For
    instance to list the authorities we're going from...
    
      for authority in stem.descriptor.remote.DirectoryAuthority.from_cache():
        print(authority.nickname)
    
    ... to...
    
      for authority in stem.directory.Authority.from_cache():
        print(authority.nickname)
    
    This branch also makes a few additions...
    
      * Authority class now has the from_cache() and from_remote()
        function.
    
      * Added the orport_v6 attribute to Authorities and removed
        is_bandwidth_authority.
    
            * Expanded test coverage.

 docs/_static/example/compare_flags.py              |  15 +-
 .../example/votes_by_bandwidth_authorities.py      |  21 +-
 docs/api/directory.rst                             |   5 +
 docs/change_log.rst                                |   9 +-
 setup.py                                           |   3 +-
 stem/__init__.py                                   |   1 +
 ...llback_directories.cfg => cached_fallbacks.cfg} |   0
 ...ched_tor_manual.sqlite => cached_manual.sqlite} | Bin
 stem/descriptor/remote.py                          | 846 ++++-----------------
 stem/directory.py                                  | 657 ++++++++++++++++
 stem/manual.py                                     |   2 +-
 stem/prereq.py                                     |  51 +-
 stem/util/__init__.py                              |   8 +
 test/integ/descriptor/remote.py                    |  53 +-
 test/integ/directory/__init__.py                   |   8 +
 test/integ/directory/authority.py                  |  18 +
 test/integ/directory/fallback.py                   |  54 ++
 test/settings.cfg                                  |   5 +
 test/unit/__init__.py                              |   1 +
 test/unit/descriptor/remote.py                     | 192 +----
 test/unit/directory/__init__.py                    |   8 +
 test/unit/directory/authority.py                   |  81 ++
 test/unit/directory/fallback.py                    | 200 +++++
 test/unit/installation.py                          |   3 +-
 test/unit/tutorial_examples.py                     |  14 +-
 25 files changed, 1276 insertions(+), 979 deletions(-)





More information about the tor-commits mailing list