@@ -276,16 +276,16 @@ def get_decoder(cls, encoding):
276
276
class Multihash (namedtuple ('Multihash' , 'func digest' )):
277
277
"""A named tuple representing a multihash function and digest.
278
278
279
- The hash function is a `Func` member:
279
+ The hash function is usually a `Func` member.
280
280
281
281
>>> mh = Multihash(Func.sha1, b'BINARY_DIGEST')
282
282
>>> mh == (Func.sha1, b'BINARY_DIGEST')
283
283
True
284
284
>>> mh == (mh.func, mh.digest)
285
285
True
286
286
287
- Although it can also be its integer value (the function code) or its
288
- string name (the function name, with either underscore or hyphen):
287
+ However it can also be its integer value (the function code) or its string
288
+ name (the function name, with either underscore or hyphen).
289
289
290
290
>>> mhfc = Multihash(Func.sha1.value, mh.digest)
291
291
>>> mhfc == mh
@@ -295,7 +295,7 @@ class Multihash(namedtuple('Multihash', 'func digest')):
295
295
True
296
296
297
297
Application-specific codes (0x00-0x0f) are also accepted. Other codes
298
- raise a `ValueError`:
298
+ raise a `ValueError`.
299
299
300
300
>>> mhfc = Multihash(0x01, b'...')
301
301
>>> mhfc.func
@@ -355,7 +355,7 @@ def encode(self, encoding=None):
355
355
b'\x01\x04TEST'
356
356
357
357
If the name of an `encoding` is specified, it is used to encode the
358
- binary digest before returning it (see `Codecs` for supported codecs):
358
+ binary digest before returning it (see `Codecs` for supported codecs).
359
359
360
360
>>> mh.encode('base64')
361
361
b'AQRURVNU'
@@ -417,15 +417,15 @@ def truncate(self, length):
417
417
def decode (mhash , encoding = None ):
418
418
r"""Decode a multihash-encoded digest into a `Multihash`.
419
419
420
- If `encoding` is `None`, a binary digest is assumed:
420
+ If `encoding` is `None`, a binary digest is assumed.
421
421
422
422
>>> mhash = b'\x11\x0a\x0b\xee\xc7\xb5\xea?\x0f\xdb\xc9]'
423
423
>>> mh = decode(mhash)
424
424
>>> mh == (Func.sha1, mhash[2:])
425
425
True
426
426
427
427
If the name of an `encoding` is specified, it is used to decode the digest
428
- before parsing it (see `Codecs` for supported codecs):
428
+ before parsing it (see `Codecs` for supported codecs).
429
429
430
430
>>> import base64
431
431
>>> emhash = base64.b64encode(mhash)
0 commit comments