[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [tor-bugs] #9380 [BridgeDB]: BridgeDB should use stem for parsing descriptors according to torspec



#9380: BridgeDB should use stem for parsing descriptors according to torspec
-------------------------+-------------------------------------------------
     Reporter:  sysrqb   |      Owner:  isis
         Type:           |     Status:  needs_review
  enhancement            |  Milestone:
     Priority:  normal   |    Version:
    Component:           |   Keywords:  stem,bridgedb-0.2.x,bridgedb-
  BridgeDB               |  parsers
   Resolution:           |  Parent ID:
Actual Points:           |
       Points:           |
-------------------------+-------------------------------------------------

Comment (by atagar):

 > tl;dr: The datetime module is braindamaged. Or Python2.x string types
 are braindamaged. Or both.

 Curious! I'm not sure why one particular system would exhibit a bytes vs
 unicode issue. That's certainly a gotcha if you're using python 3.x on
 some systems, but I've never seen it be related to the platform itself.
 I'm also unsure why chr(0x20) would've helped since that simply returns a
 string.

 Regardless, if you get a clearer understanding of what value might be
 either bytes or unicode then we can normalize to avoid that issue.

 >  Either way (with your code or mine), Stem is getting angry about the
 flag-thresholds line in the networkstatus file:

 Oh, ok. So there *are* some network status document headers. Honestly if
 you don't care about these headers you could just skip down to the first
 router status entry then use router_status_entry._parse_file() as
 suggested.

 > if fingerprint in nonDuplicates.keys():

 You don't need to specify keys() here. Iteration and contents checks are
 via a dictionary's keys so this is equivalent to...

 {{{
 if fingerprint in nonDuplicates:
 }}}

 Glad you found the review helpful! -Damian

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/9380#comment:19>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs