commit 56e6b940cc80ae930c1883957c603f0739905deb Author: Isis Lovecruft isis@torproject.org Date: Sat Mar 21 00:33:23 2015 +0000
Fix several docstrings which generated Sphinx build warnings. --- lib/bridgedb/parse/addr.py | 7 +++++++ lib/bridgedb/parse/descriptors.py | 10 +++++----- lib/bridgedb/util.py | 8 +++----- 3 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/lib/bridgedb/parse/addr.py b/lib/bridgedb/parse/addr.py index 750ed78..af63192 100644 --- a/lib/bridgedb/parse/addr.py +++ b/lib/bridgedb/parse/addr.py @@ -224,6 +224,7 @@ def canonicalizeEmailDomain(domain, domainmap): example:: EMAIL_DOMAIN_MAP = {'mail.google.com': 'gmail.com', 'googlemail.com': 'gmail.com'} + :raises UnsupportedDomain: if the domain portion of the email address is not within the map of alternate to canonical allowed domain names. :rtype: str @@ -448,18 +449,24 @@ def normalizeEmail(emailaddr, domainmap, domainrules, ignorePlus=True): to their canonical domain names (in lowercase). This can be configured with the ``EMAIL_DOMAIN_MAP`` option in ``bridgedb.conf``, for example:: + EMAIL_DOMAIN_MAP = {'mail.google.com': 'gmail.com', 'googlemail.com': 'gmail.com'} + :param dict domainrules: A mapping of canonical permitted domain names to a list of rules which should be applied to processing them, for example:: + EMAIL_DOMAIN_RULES = {'gmail.com': ["ignore_dots", "dkim"] + Currently, ``"ignore_dots"`` means that all ``"."`` characters will be removed from the local part of the validated email address. + :param bool ignorePlus: If ``True``, assume that ``blackhole+kerr@torproject.org`` is an alias for ``blackhole@torproject.org``, and remove everything after the first ``'+'`` character. + :raises UnsupportedDomain: if the email address originated from a domain that we do not explicitly support. :raises BadEmail: if the email address could not be parsed or validated. diff --git a/lib/bridgedb/parse/descriptors.py b/lib/bridgedb/parse/descriptors.py index c1e4706..80063ca 100644 --- a/lib/bridgedb/parse/descriptors.py +++ b/lib/bridgedb/parse/descriptors.py @@ -94,7 +94,7 @@ def parseNetworkStatusFile(filename, validate=True, skipAnnotations=True, :raises IOError: if the file at **filename** can't be read. :rtype: list :returns: A list of - :api:`stem.descriptor.router_status_entry.RouterStatusEntryV#`s. + :api:`stem.descriptor.router_status_entry.RouterStatusEntryV`s. """ routers = []
@@ -127,11 +127,11 @@ def parseServerDescriptorsFile(filename, validate=True): bug in Leekspin, the fake descriptor generator, where Stem thinks the fingerprint doesn't match the key…
- .. note:: We have to lie to Stem, pretending that these are ``@type - server-descriptor``s, **not** ``@type bridge-server-descriptor``s. - See ticket `#11257`_. + .. note:: We have to lie to Stem, pretending that these are + ``@type server-descriptor``s, **not** + ``@type bridge-server-descriptor``s. See ticket #`11257`_.
- .. _`#11257`: https://trac.torproject.org/projects/tor/ticket/11257 + .. _`11257`: https://bugs.torproject.org/11257
:param str filename: The file to parse descriptors from. :param bool validate: Whether or not to validate descriptor diff --git a/lib/bridgedb/util.py b/lib/bridgedb/util.py index 4253d4e..ca2a88f 100644 --- a/lib/bridgedb/util.py +++ b/lib/bridgedb/util.py @@ -146,13 +146,11 @@ def levenshteinDistance(s1, s2, len1=None, len2=None, offset1=0, offset2=0, memo=None): """Compute the Levenstein Distance between two strings.
- The `Levenshtein String Distance Algorithm`_ efficiently computes the - number of characters which must be changed in **s1** to make it + The `Levenshtein String Distance Algorithm + https://en.wikipedia.org/wiki/Levenshtein_distance` efficiently computes + the number of characters which must be changed in **s1** to make it identical to **s2**.
- .. `Levenshtein String Distance Algorithm`: - https://en.wikipedia.org/wiki/Levenshtein_distance - >>> levenshteinDistance('cat', 'cat') 0 >>> levenshteinDistance('cat', 'hat')
tor-commits@lists.torproject.org