serverboerse/classes/server.py

23 lines
633 B
Python
Raw Normal View History

2021-05-02 10:19:17 +00:00
class Server:
def __init__(self, key, name, cpu, ram, price, hdd, next_reduce, datacenter, freetext):
self.key = key
self.name = name
self.cpu = cpu
self.ram = ram
self.price = float(price)
self.hdd = hdd
self.next_reduce = next_reduce
self.datacenter = datacenter
self.freetext = freetext
@property
def price_per_cpu(self):
return self.price / self.cpu.benchmark
@property
def price_per_ram(self):
return self.price / self.ram
@property
def price_per_hdd(self):
return self.price / self.hdd.total_size