[tor-bugs] #28450 [Core Tor/Stem]: Add a parse_bytes function to load descriptors from bytes

Tor Bug Tracker & Wiki blackhole at torproject.org
Tue Nov 20 21:50:29 UTC 2018


#28450: Add a parse_bytes function to load descriptors from bytes
---------------------------+-----------------------------------
 Reporter:  irl            |          Owner:  irl
     Type:  enhancement    |         Status:  needs_information
 Priority:  Medium         |      Milestone:
Component:  Core Tor/Stem  |        Version:
 Severity:  Normal         |     Resolution:
 Keywords:                 |  Actual Points:
Parent ID:                 |         Points:
 Reviewer:  atagar         |        Sponsor:
---------------------------+-----------------------------------
Changes (by atagar):

 * status:  needs_review => needs_information


Comment:

 Thanks irl! I took this in a slightly different direction.

 https://gitweb.torproject.org/stem.git/commit/?id=670f403

 Changes from your patch are...

 * Moved this to Descriptor.from_str() to match the convention used
 elsewhere in stem's codebase.

 * Fixed a bug where the kwargs weren't passed along.

 * The method provides a single descriptor by default, with a **multiple =
 True** argument that must be supplied if you want a list instead. I did
 this because for the common case of parsing a single descriptor stem's
 been a little clunky.

 * Descriptor type inference can now be done in three ways: a
 **descriptor_type** argument, a **@type** annotation, and use of
 from_str() on subclasses (for example,
 **RelayServerDescriptor.from_str()**).

 * Test coverage.

 Thoughts?

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/28450#comment:3>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list