You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Inside NetworkStatusDocumentV3 you have is_fresh method:
defis_fresh(self):
""" Checks if the current time is between this document's **valid_after** and **fresh_until** timestamps. To be fresh means this should be the latest consensus. .. versionadded:: 1.8.0 :returns: **True** if this consensus is presently fresh and **False** otherwise """returnself.valid_after<datetime.datetime.utcnow() <self.fresh_until
May be better to define it as property.
May be better follow original tor source client which naming it as networkstatus_is_live.
We need second propery is_reasonably_live like networkstatus_consensus_reasonably_live. It is used when tor client try use old consensus but not so old.
Need to double check is it really < and > or <= and >=
From torpy sources:
@propertydefis_live(self):
# tor ref: networkstatus_is_livereturnself.valid_after<=datetime.utcnow() <=self.valid_until@propertydefis_reasonably_live(self):
# tor ref: networkstatus_consensus_reasonably_livereturnself.valid_after-timedelta(hours=24) <=datetime.utcnow() <=self.valid_until+timedelta(hours=24)
The text was updated successfully, but these errors were encountered:
Hi James. This is an interesting idea but I'm torn. The rule of thumb I use is 'property for static values, method for dynamic'. Personally I'd find it confusing to have our object's is_live attribute be True now, and False five minutes from now.
Methods by contrast are clearly evaluated at runtime, fulfilling the python axium Explicit is better than implicit..
Inside NetworkStatusDocumentV3 you have is_fresh method:
is_reasonably_live
likenetworkstatus_consensus_reasonably_live
. It is used when tor client try use old consensus but not so old.<
and>
or<=
and>=
From torpy sources:
The text was updated successfully, but these errors were encountered: