city_retrofit/usage/usage_factory.py

30 lines
847 B
Python

"""
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
"""
from usage.usage_feeders.de_usage_parameters import DeUsageParameters
from usage.usage_feeders.us_new_york_city_usage_parameters import UsNewYorkCityUsageParameters
class UsageFactory:
def __init__(self, handler, city):
self._handler = handler.lower().replace(' ', '_')
self._city = city
self.factory()
def us_new_york_city(self):
UsNewYorkCityUsageParameters(self._city)
def ca(self):
raise Exception('Not implemented')
def de(self):
DeUsageParameters(self._city)
def es(self):
raise Exception('Not implemented')
def factory(self):
getattr(self, self._handler, lambda: None)()