31 lines
1014 B
Python
31 lines
1014 B
Python
"""
|
|
Config
|
|
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
|
Copyright © 2023 Project Peter Yefi peteryefi@gmail.com
|
|
"""
|
|
from exports.db_factory import DBFactory as CityExportFactory
|
|
from imports.db_factory import DBFactory
|
|
import os
|
|
import pickle
|
|
|
|
|
|
class Config:
|
|
|
|
def __init__(self):
|
|
self.export_db_factory = CityExportFactory(db_name='hub_prod', app_env='PROD',
|
|
dotenv_path="{}/.env".format(os.path.expanduser('~')))
|
|
self.import_db_factory = DBFactory(db_name='hub_prod', app_env='PROD',
|
|
dotenv_path="{}/.env".format(os.path.expanduser('~')))
|
|
|
|
def get_city(self, city_id):
|
|
city_obj = self.export_db_factory.get_city(city_id)
|
|
city = pickle.loads(city_obj.city)
|
|
for building in city.buildings:
|
|
building.heated = True
|
|
building.cooled = True
|
|
building.attic_heated = 0
|
|
building.basement_heated = 0
|
|
for surface in building.surfaces:
|
|
surface.swr = 0.2
|
|
return city
|