kuon.watcher.adapters.models.sold_item   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 60%

Importance

Changes 0
Metric Value
wmc 2
eloc 14
dl 0
loc 31
ccs 6
cts 10
cp 0.6
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A SoldItem.value() 0 10 1
A SoldItem.__init__() 0 10 1
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