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

[tor-commits] [sbws/master] Stop to require consensus path to be str



commit 1defb776b3db0d272ed255e6fea6acd2d0befa50
Author: juga0 <juga@xxxxxxxxxx>
Date:   Tue Oct 23 15:15:24 2018 +0000

    Stop to require consensus path to be str
    
    And catch exception.
    This way the tests do not need to be modified to include a
    consensus path.
---
 sbws/lib/v3bwfile.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sbws/lib/v3bwfile.py b/sbws/lib/v3bwfile.py
index 225724f..c35c865 100644
--- a/sbws/lib/v3bwfile.py
+++ b/sbws/lib/v3bwfile.py
@@ -795,11 +795,10 @@ class V3BWFile(object):
     def read_num_net_relays(consensus_path):
         """Read the number of relays in the Network from the cached consensus
         file."""
-        assert isinstance(consensus_path, str)
         num = None
         try:
             num = len(list(parse_file(consensus_path)))
-        except FileNotFoundError:
+        except (FileNotFoundError, AttributeError):
             log.info("It is not possible to obtain statistics about the "
                      "percentage of measured relays because the cached "
                      "consensus file is not found.")



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits