content_hash.utils.raw_cid_value()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 3
nop 1
dl 0
loc 4
ccs 0
cts 2
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
"""Util functions used in the project"""
2
3
from multiformats import multicodec
4
5
def raw_cid_value(cid):
6
    """Return raw representation of the CID as seen in multiformats_cid in bytes"""
7
    return b''.join(
8
        [cid.version.to_bytes(1, byteorder='big'), multicodec.wrap(cid.codec, cid.digest)],
9
    )
10