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
|
|
|
|
"""
|
2020-10-28 13:14:05 -04:00
|
|
|
from factories.usage.usage_feeders.de_usage_parameters import DeUsageParameters
|
|
|
|
from factories.usage.usage_feeders.us_new_york_city_usage_parameters import UsNewYorkCityUsageParameters
|
2020-05-18 13:25:08 -04:00
|
|
|
|
|
|
|
|
|
|
|
class UsageFactory:
|
2020-06-11 16:55:52 -04:00
|
|
|
"""
|
|
|
|
UsageFactory class
|
|
|
|
"""
|
2020-05-18 13:25:08 -04:00
|
|
|
def __init__(self, handler, city):
|
2020-06-11 16:55:52 -04:00
|
|
|
self._handler = '_' + handler.lower().replace(' ', '_')
|
2020-05-18 13:25:08 -04:00
|
|
|
self._city = city
|
|
|
|
self.factory()
|
|
|
|
|
2020-06-26 21:10:56 -04:00
|
|
|
def _us_new_york(self):
|
2020-05-18 13:25:08 -04:00
|
|
|
UsNewYorkCityUsageParameters(self._city)
|
|
|
|
|
2020-06-11 16:55:52 -04:00
|
|
|
def _ca(self):
|
2020-05-18 13:25:08 -04:00
|
|
|
raise Exception('Not implemented')
|
|
|
|
|
2020-06-11 16:55:52 -04:00
|
|
|
def _de(self):
|
2020-05-18 13:25:08 -04:00
|
|
|
DeUsageParameters(self._city)
|
|
|
|
|
2020-06-11 16:55:52 -04:00
|
|
|
def _es(self):
|
2020-05-18 13:25:08 -04:00
|
|
|
raise Exception('Not implemented')
|
|
|
|
|
|
|
|
def factory(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)()
|