예제 #1
0
 def parserTest(cls):
     base_api = API()
     cls.test_data = {}
     for region in base_api.supported_regions:
         api = API(region)
         cls.test_data.update({region: api.retrieve_all()})
예제 #2
0
PARTS = None
api = API()
INTEL = 'Intel'
AMD = 'AMD'
CPU_BRANDS = set((AMD, INTEL))
HZ_IN_GHZ = 1_000_000_000
HZ_IN_MHZ = 1_000_000
BYTES_IN_GB = 1_000_000_000

try:
    PARTS = pickle.load(open('parts.pkl', 'rb'))
    print('parts successfully loaded from local pickle')
except FileNotFoundError:
    print('Couldn\'t find parts pickle, downloading...')
    PARTS = api.retrieve_all()
    pickle.dump(PARTS, open('parts.pkl', 'wb'))


class Computer:
    def __init__(self):
        self.cpu = None
        self.gpu = None
        self.mobo = None
        self.case = None
        self.psu = None
        self.memory = {}
        self.storage = {}

    def __str__(self):
        return str(self.__dict__)