Passed
Push — master ( 25a700...042c2b )
by Vinicius
01:48 queued 17s
created

build.utils   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 15
rs 10
c 0
b 0
f 0
ccs 6
cts 6
cp 1
wmc 2

2 Functions

Rating   Name   Duplication   Size   Complexity  
A int_dpid() 0 4 1
A get_cookie() 0 3 1
1
"""Utils module."""
2
3 1
from .settings import COOKIE_PREFIX
4
5
6 1
def int_dpid(dpid):
7
    """Convert a str dpid to an int."""
8 1
    dpid = int(dpid.replace(":", ""), 16)
9 1
    return dpid
10
11
12 1
def get_cookie(dpid):
13
    """Return the cookie integer given a dpid."""
14
    return (0x0000FFFFFFFFFFFF & int(int_dpid(dpid))) | (COOKIE_PREFIX << 56)
15