mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-30 09:48:56 +00:00
add docstrings
This commit is contained in:
parent
d0296b9ae8
commit
c2fbbe4f46
@ -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):]
|
||||
|
Loading…
Reference in New Issue
Block a user