2020-06-09 14:07:47 -04:00
|
|
|
"""
|
|
|
|
UsageFactory retrieve the specific usage module for the given region
|
|
|
|
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
|
|
|
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
|
|
|
|
"""
|
2021-01-06 16:42:38 -05:00
|
|
|
from pathlib import Path
|
2021-05-27 17:20:06 -04:00
|
|
|
from imports.usage_feeders.hft_usage_parameters import HftUsageParameters
|
2020-05-18 13:25:08 -04:00
|
|
|
|
|
|
|
|
|
|
|
class UsageFactory:
|
2020-06-11 16:55:52 -04:00
|
|
|
"""
|
|
|
|
UsageFactory class
|
|
|
|
"""
|
2021-01-06 16:42:38 -05:00
|
|
|
def __init__(self, handler, city, base_path=Path(Path(__file__).parent.parent / 'data/usage')):
|
2020-06-11 16:55:52 -04:00
|
|
|
self._handler = '_' + handler.lower().replace(' ', '_')
|
2020-05-18 13:25:08 -04:00
|
|
|
self._city = city
|
2021-01-06 16:42:38 -05:00
|
|
|
self._base_path = base_path
|
2020-05-18 13:25:08 -04:00
|
|
|
|
2021-05-27 17:20:06 -04:00
|
|
|
def _hft(self):
|
|
|
|
HftUsageParameters(self._city, self._base_path).enrich_buildings()
|
2020-05-18 13:25:08 -04:00
|
|
|
|
2021-05-27 17:20:06 -04:00
|
|
|
def _other_usage_library_format(self):
|
2020-05-18 13:25:08 -04:00
|
|
|
raise Exception('Not implemented')
|
|
|
|
|
2021-04-07 11:46:44 -04:00
|
|
|
def enrich(self):
|
2020-06-11 16:55:52 -04:00
|
|
|
"""
|
|
|
|
Enrich the city with the usage information
|
|
|
|
:return: None
|
|
|
|
"""
|
2020-05-18 13:25:08 -04:00
|
|
|
getattr(self, self._handler, lambda: None)()
|