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

[tor-commits] [stem/master] Add is_valid_stream_id helper function



commit 959e1506892c5f11e24a9a4fdfb3eafd73b4bd56
Author: Sean Robinson <seankrobinson@xxxxxxxxx>
Date:   Sat Dec 1 13:27:35 2012 -0700

    Add is_valid_stream_id helper function
    
    This is an alias to is_valid_circuit_id since stream and circuit
    identifiers follow the same pattern.
    
    Signed-off-by: Sean Robinson <seankrobinson@xxxxxxxxx>
---
 stem/util/tor_tools.py |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/stem/util/tor_tools.py b/stem/util/tor_tools.py
index 3673be9..ea59092 100644
--- a/stem/util/tor_tools.py
+++ b/stem/util/tor_tools.py
@@ -8,6 +8,7 @@ Miscellaneous utility functions for working with tor.
   is_valid_fingerprint - checks if a string is a valid tor relay fingerprint
   is_valid_nickname - checks if a string is a valid tor relay nickname
   is_valid_circuit_id - checks if a string is a valid tor circuit id
+  is_valid_stream_id - checks if a string is a valid tor stream id
   is_hex_digits - checks if a string is only made up of hex digits
 """
 
@@ -77,6 +78,14 @@ def is_valid_circuit_id(entry):
   
   return bool(CIRC_ID_PATTERN.match(entry))
 
+is_valid_stream_id = is_valid_circuit_id
+"""
+  Checks if a string is a valid format for being a stream identifier.
+  Currently, this is just an alias to :func:`~stem.util.tor_tools.is_valid_circuit_id`.
+  
+  :returns: **True** if the string could be a stream id, **False** otherwise
+"""
+
 def is_hex_digits(entry, count):
   """
   Checks if a string is the given number of hex digits. Digits represented by



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