[tor-commits] [stem/master] Localize protocol attributes into a LinkProtocol class

atagar at torproject.org atagar at torproject.org
Sun Jun 17 00:23:10 UTC 2018

commit 7f7f1714f54326c6f75f5abf42ec8fa059003f11
Merge: 7b3df73f 526dc8b2
Author: Damian Johnson <atagar at torproject.org>
Date:   Sat Jun 16 16:44:32 2018 -0700

    Localize protocol attributes into a LinkProtocol class
    Several constants vary depending on our link protocol version. Rather than
    encoding a bunch of 'x if link_protocol > y else z' conditionals centralizing
    this in a LinkProtocol class.
    LinkPrococol.for_version() normalizes an integer *or* LinkProtocol into a
    Pattern we should follow is:
      * Public methods should always accept an integer.
      * Any time we use or store a link protocol version it's normalized to a
        LinkPrococol class.

 stem/client/__init__.py | 16 +++++-----------
 stem/client/cell.py     | 20 +++++++++++---------
 stem/client/datatype.py | 30 ++++++++++++++++++++++++++++++
 3 files changed, 46 insertions(+), 20 deletions(-)

More information about the tor-commits mailing list