30 lines
1.1 KiB
Python
30 lines
1.1 KiB
Python
"""
|
|
CustomizedImportsFactory is used to import any information using user customized formats
|
|
This factory can only be called after calling the construction factory.
|
|
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
|
Copyright © 2020 Project Author Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
|
"""
|
|
from pathlib import Path
|
|
|
|
|
|
class CustomizedImportsFactory:
|
|
"""
|
|
CustomizedImportsFactory class
|
|
"""
|
|
def __init__(self, city, importer_class, base_path):
|
|
if base_path is None:
|
|
base_path = Path(Path(__file__).parent.parent / 'data/customized_imports')
|
|
self._city = city
|
|
self._importer_class = importer_class
|
|
self._base_path = base_path
|
|
for building in city.buildings:
|
|
if len(building.thermal_zones) == 0:
|
|
raise Exception('It seems that the customized imports factory is being called before the construction factory. '
|
|
'Please ensure that the construction factory is called first.')
|
|
|
|
def enrich(self):
|
|
"""
|
|
Enrich the city given to the class using the given importer class
|
|
:return: None
|
|
"""
|