2020-06-09 14:07:47 -04:00
|
|
|
"""
|
2020-12-15 15:15:40 -05:00
|
|
|
SchedulesFactory retrieve the specific schedules module for the given standard
|
2020-06-09 14:07:47 -04:00
|
|
|
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
|
|
|
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
|
|
|
|
"""
|
2020-05-18 13:25:08 -04:00
|
|
|
|
2020-12-15 15:15:40 -05:00
|
|
|
from pathlib import Path
|
|
|
|
from factories.occupancy_feeders.usage_schedules import ComnetSchedules
|
2020-05-18 13:25:08 -04:00
|
|
|
|
2020-12-15 15:15:40 -05:00
|
|
|
|
|
|
|
class SchedulesFactory:
|
2020-06-15 11:38:18 -04:00
|
|
|
"""
|
2020-12-15 15:15:40 -05:00
|
|
|
SchedulesFactor class
|
2020-06-15 11:38:18 -04:00
|
|
|
"""
|
2020-12-15 15:15:40 -05:00
|
|
|
def __init__(self, handler, city, base_path=Path(Path(__file__).parent.parent / 'data/occupancy')):
|
|
|
|
self._handler = '_' + handler.lower().replace(' ', '_')
|
|
|
|
self._city = city
|
|
|
|
self._base_path = base_path
|
|
|
|
self.factory()
|
2020-06-30 16:14:39 -04:00
|
|
|
|
2020-12-15 15:15:40 -05:00
|
|
|
def _comnet(self):
|
|
|
|
ComnetSchedules(self._city, self._base_path)
|
2020-06-30 16:14:39 -04:00
|
|
|
|
2020-12-15 15:15:40 -05:00
|
|
|
def factory(self):
|
2020-06-30 16:14:39 -04:00
|
|
|
"""
|
2020-12-15 15:15:40 -05:00
|
|
|
Enrich the city with the schedules information
|
|
|
|
:return: None
|
2020-06-30 16:14:39 -04:00
|
|
|
"""
|
2020-12-15 15:15:40 -05:00
|
|
|
getattr(self, self._handler, lambda: None)()
|