From c2fbbe4f4607f1eaea407e0be26b9f86a9f4eaf6 Mon Sep 17 00:00:00 2001 From: meejah Date: Mon, 17 Jun 2019 18:55:26 -0600 Subject: [PATCH] add docstrings --- src/allmydata/crypto/__init__.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/allmydata/crypto/__init__.py b/src/allmydata/crypto/__init__.py index 95d085a65..4ce95a24d 100644 --- a/src/allmydata/crypto/__init__.py +++ b/src/allmydata/crypto/__init__.py @@ -1,12 +1,21 @@ class BadSignature(Exception): - pass + """ + An alleged signature did not match + """ class BadPrefixError(Exception): - pass + """ + A key did not start with the required prefix + """ def remove_prefix(s_bytes, prefix): + """ + Removes `prefix` from `s_bytes` safely + """ if not s_bytes.startswith(prefix): - raise BadPrefixError("did not see expected '%s' prefix" % (prefix,)) + raise BadPrefixError( + "did not see expected '{}' prefix".format(prefix) + ) return s_bytes[len(prefix):]