[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [stem/master] Revised API docs for stem.util.tor_tools
commit 8459d01c2ce4feb9c661e9bf958da5169eae58a3
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date: Sat Oct 27 15:53:41 2012 -0700
Revised API docs for stem.util.tor_tools
---
docs/api.rst | 1 +
docs/contents.rst | 1 +
docs/util/tor_tools.rst | 5 +++++
stem/util/tor_tools.py | 14 +++++++++++---
4 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/docs/api.rst b/docs/api.rst
index e63c2c2..2351775 100644
--- a/docs/api.rst
+++ b/docs/api.rst
@@ -32,4 +32,5 @@ Utilities
* `stem.util.str_tools <util/str_tools.html>`_ - String utilities.
* `stem.util.system <util/system.html>`_ - Tools related to the local system.
* `stem.util.term <util/term.html>`_ - Tools for interacting with the terminal.
+* `stem.util.tor_tools <util/tor_tools.html>`_ - Helper functions for working with tor.
diff --git a/docs/contents.rst b/docs/contents.rst
index 560c14a..58230b3 100644
--- a/docs/contents.rst
+++ b/docs/contents.rst
@@ -28,4 +28,5 @@ Contents
util/str_tools
util/system
util/term
+ util/tor_tools
diff --git a/docs/util/tor_tools.rst b/docs/util/tor_tools.rst
new file mode 100644
index 0000000..87eb2af
--- /dev/null
+++ b/docs/util/tor_tools.rst
@@ -0,0 +1,5 @@
+Tor Utilities
+=============
+
+.. automodule:: stem.util.tor_tools
+
diff --git a/stem/util/tor_tools.py b/stem/util/tor_tools.py
index a651445..c70fbce 100644
--- a/stem/util/tor_tools.py
+++ b/stem/util/tor_tools.py
@@ -1,5 +1,13 @@
"""
Miscellaneous utility functions for working with tor.
+
+**Module Overview:**
+
+::
+
+ 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_hex_digits - checks if a string is only made up of hex digits
"""
import re
@@ -26,7 +34,7 @@ def is_valid_fingerprint(entry, check_prefix = False):
:param str entry: string to be checked
:param bool check_prefix: checks for a '$' prefix
- :returns: True if the string could be a relay fingerprint, False otherwise.
+ :returns: **True** if the string could be a relay fingerprint, **False** otherwise
"""
if not isinstance(entry, str):
@@ -43,7 +51,7 @@ def is_valid_nickname(entry):
:param str entry: string to be checked
- :returns: True if the string could be a nickname, False otherwise.
+ :returns: **True** if the string could be a nickname, **False** otherwise
"""
if not isinstance(entry, str):
@@ -59,7 +67,7 @@ def is_hex_digits(entry, count):
:param str entry: string to be checked
:param int count: number of hex digits to be checked for
- :returns: True if the string matches this number
+ :returns: **True** if the string matches this number
"""
return bool(re.match("^%s{%i}$" % (HEX_DIGIT, count), entry))
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits