GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

kerapu.clean_bool()   A
last analyzed

Complexity

Conditions 3

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 3

Importance

Changes 0
Metric Value
cc 3
eloc 6
nop 1
dl 0
loc 8
ccs 4
cts 4
cp 1
crap 3
rs 10
c 0
b 0
f 0
1
# ----------------------------------------------------------------------------------------------------------------------
2
from typing import Optional, Any
3
4
LEN_DIAGNOSE_CODE = 4
5 1
LEN_SPECIALISME_CODE = 4
6
LEN_ZORG_ACTIVITEIT_CODE = 6
7 1
LEN_ZORG_INSTELLING_CODE = 8
8 1
LEN_ZORG_PRODUCT_CODE = 9
9 1
LEN_ZORG_PRODUCT_GROEP_CODE = 6
10 1
LEN_ZORG_TYPE_CODE = 2
11 1
LEN_ZORG_VRAAG_CODE = 3
12 1
13 1
14 1
# ----------------------------------------------------------------------------------------------------------------------
15
def clean_bool(x: str) -> bool:
16
    if x == '0':
17
        return False
18 1
19 1
    if x == '1':
20 1
        return True
21
22 1
    raise RuntimeError("Not a boolean value '%s'." % x)
23 1
24
25
# ----------------------------------------------------------------------------------------------------------------------
26
def clean_code(code: str, lengte: int) -> str:
27
    """
28
    Schoont een code van voor- en naloop whitespace en voorziet de code van het juiste aantal voorloop nullen.
29 1
30
    :param str code: De code.
31
    :param int lengte: De gewenste lengte van de code.
32
33
    :rtype: str
34
    """
35
    return code.zfill(lengte)
36
37
38 1
# ----------------------------------------------------------------------------------------------------------------------
39
def clean_date(x: str) -> str:
40
    if x == '':
41
        return '9999-12-31'
42 1
43 1
    return str(x)
44 1
45
46 1
# ----------------------------------------------------------------------------------------------------------------------
47
def clean_int(x: Any, leeg: Optional[int] = None) -> Optional[int]:
48
    if x == '' or not x:
49
        return leeg
50 1
51 1
    return int(x)
52 1
53
54 1
# ----------------------------------------------------------------------------------------------------------------------
55
def clean_str(x: Any) -> Optional[str]:
56
    if x == '':
57
        return None
58 1
59 1
    return str(x)
60 1
61
# ----------------------------------------------------------------------------------------------------------------------
62