mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-29 15:43:54 +00:00
add docstrings
This commit is contained in:
parent
d0296b9ae8
commit
c2fbbe4f46
@ -1,12 +1,21 @@
|
|||||||
class BadSignature(Exception):
|
class BadSignature(Exception):
|
||||||
pass
|
"""
|
||||||
|
An alleged signature did not match
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
class BadPrefixError(Exception):
|
class BadPrefixError(Exception):
|
||||||
pass
|
"""
|
||||||
|
A key did not start with the required prefix
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
def remove_prefix(s_bytes, prefix):
|
def remove_prefix(s_bytes, prefix):
|
||||||
|
"""
|
||||||
|
Removes `prefix` from `s_bytes` safely
|
||||||
|
"""
|
||||||
if not s_bytes.startswith(prefix):
|
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):]
|
return s_bytes[len(prefix):]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user