hub/factories/weather_factory.py
2020-11-26 09:26:55 -05:00

35 lines
1020 B
Python

"""
WeatherFactory retrieve the specific weather module for the given source format
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Pilar Monsalvete pilar_monsalvete@yahoo.es
"""
from pathlib import Path
from factories.weather_feeders.dat_weather_parameters import DatWeatherParameters
class WeatherFactory:
"""
WeatherFactory class
"""
# todo: modify full_path_weather to make it depending on "city"
def __init__(self, handler, city, base_path=Path(Path(__file__).parent.parent / 'data/weather')):
self._handler = '_' + handler.lower().replace(' ', '_')
self._city = city
self._base_path = base_path
self._city_name = 'new_york_city'
self.factory()
def _dat(self):
DatWeatherParameters(self._city, self._base_path, self._city_name)
def _tmy(self):
raise Exception('Not implemented')
def factory(self):
"""
Enrich the city with the usage information
:return: None
"""
getattr(self, self._handler, lambda: None)()