SoldItem.__init__()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 10
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1.4218

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 10
ccs 1
cts 4
cp 0.25
rs 10
c 0
b 0
f 0
cc 1
nop 4
crap 1.4218
1
#!/usr/bin/python
2
# -*- coding: utf-8 -*-
3 1
from time import time
4
5 1
from kuon.watcher.adapters.models import AbstractEntity
6
7
8 1
class SoldItem(AbstractEntity):
9
10 1
    def __init__(self, price: int, wear_value: float, sold_at: [float, int] = time()) -> None:
11
        """Initializing function
12
13
        :type price:
14
        :type wear_value:
15
        :type sold_at:
16
        """
17
        self._price = price
18
        self._wear_value = wear_value
19
        self._sold_at = int(sold_at)
20
21 1
    @property
22 1
    def value(self) -> dict:
23
        """Return all important information from the API response like price, wear value and the time it was sold
24
25
        :return:
26
        """
27
        return {
28
            'price': self._price,
29
            'wear_value': self._wear_value,
30
            'sold_at': self._sold_at
31
        }
32