ivilata / pymultihash

Python implementation of the multihash specification
19 stars 8 forks source link

Document supported codecs #13

Closed za3k closed 1 year ago

za3k commented 3 years ago

In the docs for 'multihash.decode', it says "If the name of an encoding is specified, it is used to decode the digest before parsing it (see CodecReg for supported codecs)."

But in the docs for CodecReg, no list of supported codecs is provided, and there is not even a method to get them at runtime. Please add such a list to the documentation.

ivilata commented 1 year ago

Hi @za3k, thanks for the report, and sorry for the delay.

In the main documentation of the multihash module, under "The codec registry" section, you may find this:

`CodecReg` also allows you to iterate over registered codec names, and check
if it contains a given codec (i.e. whether it is registered or not).

>>> {'hex', 'base64'}.issubset(multihash.CodecReg)
True
>>> 'base32' in multihash.CodecReg
True

That is, it documents the fact that iterating over the CodecReg class gives you the names of all supported encodings.

I'm closing the issue, but feel free to reopen it if you don't find the answer satisfactory. Thanks!